1

I want to transfer my web application from tomcat7 / java7 to tomcat 8.5 / java8. My application consists of a directory with some JSP files & WEB-INF folder which contains my application's web.xml :

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                          http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
      version="3.1"
      metadata-complete="false">
      ...
</web-app>

& here is part of tomcat virtual host config:

<Host name="my-domain.ir" appBase="/path/to/my/webapp" >
    <Context path="" docBase="base-dir" 
     xmlValidation="false" xmlNamespaceAware="false" crossContext="false" reloadable="false" >
    ...
    </Context>
    ...
</Host>

Suppose that I've following servlet implementation:

@WebServlet(
    name = "MyServlet1",
    urlPatterns = {"/MyServlet1"}
)
@SuppressWarnings("serial")
public class MyServlet1 extends HTTPServlet {
    ...
}

I've made a separate jar file which contains all of my servlet implementations and added it to TOMCAT-HOME/lib folder (Because it's used by several virtual hosts & I don't want to load it in the memory separately for every virtual host).

The problem is that when tomcat starts, I get this message it catalina.out:

02-Dec-2016 19:32:44.442 FINE [localhost-startStop-1] org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan No TLD files were found in [file:/opt/tomcat/lib/MY-SERVLETS-IMPL.jar]. Consider adding the JAR to the tomcat.util.scan.StandardJarScanFilter.jarsToSkip property in CATALINA_BASE/conf/catalina.properties file.

& when I want to access my servlet using address my-domain.ir/MyServlet1 I get a 404 not found error page, but if I add servlet mapping in web.xml instead of using annotations, It works fine. In both cases my JSP files works fine.

Any suggestion?

Ehsan Khodarahmi
  • 285
  • 1
  • 7
  • 17

1 Answers1

0

In the conf/context.xml please add below code it may works

<JarScanner scanClassPath="false" />

By default scanAllDirectories, scanAllFiles, and scanBootstrapClassPath are set to false, but scanClassPath is true. So making it false may work.

If it does not work please let me know.

Aslo read this, it will help.