Spring MVC Project Export jar package does not recognize normal mapping issues

Source: Internet
Author: User

The author of the code is very simple, the usual configuration file, Web. Xml as follows

 <servlet>       <!--name -       <Servlet-name>Springmvc</Servlet-name>       <!--servlet class -       <Servlet-class>Org.springframework.web.servlet.DispatcherServlet</Servlet-class>          <Init-param>           <!--SPRINGMVC location of configuration parameter files -           <Param-name>Contextconfiglocation</Param-name>           <!--The default name is Servletname-servlet.xml -           <Param-value>Classpath*:springmvc-servlet.xml</Param-value>       </Init-param>       <!--start sequence, the smaller the number, the earlier the start -       <Load-on-startup>1</Load-on-startup>           </servlet>   <!--all requests will be intercepted by Springmvc . -   <servlet-mapping>       <Servlet-name>Springmvc</Servlet-name>       <Url-pattern>/frontend/*</Url-pattern>   </servlet-mapping>

MyEclipse development project, according to the normal method right-click Project Export-->jar but cannot execute.

The @controller on the web said the annotations could not work in jars, and later found the answer in StackOverflow:

Spring annotation-based Controllers not working if it is inside Jar file

Workaround: When exporting the jar file, tick the following: Add directory entries check box

When you export the jar file using the Export utility in eclipse there is a option called Add directory entries. Check this option and export the jar file, this would solve the problem.

Additional reference information:

Why spring MVC isn't able to the read URL from the controller class kept in jar file

@Controller not working while packaged in external jar

Spring MVC Project Export jar package does not recognize normal mapping issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.