Why should the classes directory be placed in the Web-inf directory?

Source: Internet
Author: User

as a question, today's project Operation Error

... Nosuchbeandefinitionexception:no Bean named ' Shirofilter '

The exception explained clearly that the Web container did not find the corresponding bean. Then, the query will start from two aspects:

    1. Have a problem with the corresponding XML configuration file?

    2. The specified bean is not found?

Then one after another, and the colleague confirmed after the first problem, because the same code his OK run well. Focus on the second question, along with the XML configuration to find the appropriate class file, are found. This problem is big, configuration good + files are in, is not start, is the need to replace the Web container (some colleagues at this time mentioned their replacement to TOMCAT7 after solving this problem), in my replacement of the previous step, I tried once.


Finally

I tried to succeed, modified the Java file compiled class file storage directory classes. Before adjusting the directory configuration in the Web-inf sibling, adjust to ". /web-inf/classes"The world has since returned to order, stable operation. O (∩_∩) o haha ~

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/59/78/wKioL1TULaGDYdi6AAFbLYDWdxc712.jpg "title=" 976ea0d72990a7876ffb8102aea70631.jpg "width=" 272 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:272PX; height:200px; "alt=" wkiol1tulagdydi6aafblydwdxc712.jpg "/>

Extended Reading

Why should the classes directory be placed in the Web-inf directory?

A: You must understand the servlet's conventions here. For the problem in question, use the Tomcat container, which is the order in which the class files are loaded.

If a class is to be used, the WEB application tries to load the class into the/web-inf/classes, and, if none, tries to find the class file from the/web-inf/lib jar file (if it is not found yet, it looks in the directory where the container implementation itself holds the class or jar, But the location depends on the implementation of the vendor, and in Tomcat the search path is the Lib directory in the Tomcat installation directory.

So, everybody knows why. We will classes directories and Web-inf directories at the same time, the Web container is not found at all.

Why should the classes directory be placed in the Web-inf directory?

Related Article

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.