In Linux, Tomcat cannot find the solution of the class specified by import on the JSP page.

Source: Internet
Author: User

If you are not using any IDE, just write it in your favorite text editorCodeAnd manually deploy it to webapps/, you will often encounter the error "class cannot be reloved to a type. Solution:

1. Check whether your. Class file is in the/WEB-INF/classes/directory. If not, create the desired directory and put it in.

2. if the location of the. Class file is correct, the problem of the package is also handled, but still cannot find the class, then there is only one reason-there is no web. xml file under the WEB-INF directory. Without this file, Tomcat will not go to the WEB-INF/classes/to find your class even if you put your. Class in the correct position... Therefore, manually create web. xml and add the following code: (Tomcat 1.7 is used)

<? XML version = "1.0" encoding = "ISO-8859-1"?> <Web-app xmlns = "http://java.sun.com/xml/ns/javaee" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation = "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version = "3.0" metadata-complete = "true"> </Web-app>

Now the problem is solved.

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.