Spring MVC configuration throws strange exception

I am trying to deploy a new spring MVC application, I have done this a dozen times, but now I am launching a really strange error, I can’t even understand what is happening:

  • My javaee-api is contrary to servlet-api. In the console, he writes:

    INFO: validateJarFile(E:\development\workspace\conference\src\main\webapp\WEB- INF\lib\javaee-api-6.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class 

Well, yes, this is a warning, but this jar is not loaded, and I need it. Also, I don't have servlet-api packages in my applications, etc.

  • In addition, the console throws this exception:

      SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener 

I mean, this jar belongs to the JSF and all that. I do not use it at all, where should he try to get such a class? O_o

I am running an application on tomcat 7

Any ideas what is going on?

+1
source share
2 answers

The problem with the jar file is that the Tomcat class loader checks all the classes that it loads in the JVM. In your case, it ran into a class from the servlet API - javax.servlet.Servlet . Application code should not contain such classes inside WEB-INF/lib . These classes come with the servlet container itself. If you are using maven, just change the scope of javax.servlet:servlet-api to provided .

After you fix this, try reloading the entire application, because it may happen that classloader just blocked javaee-api-6.0.jar completely, preventing it from loading other classes.

+2
source

You can delete the javaee-api-6.0.jar from the WEB-INF / lib directory in webapps by setting the provided scope to your dependency.

Spec indicates that the Servlet container (here, Tomcat) will provide implementation classes for the Java EE specification. Implementing specific applications is a stability and security issue that is prohibited by the / Tomcat specification.

Thanks!

0
source

Source: https://habr.com/ru/post/1481067/


All Articles