How to avoid the error "javax.servlet-api-3.0.1.jar - jar not loaded"?

I am using Windows 7, Java 1.7, Grails 2.1.4, Groovy 2.0.4 and Tomcat 7.0.37.
When I run my project, I get the error message below:

Apr 5, 2013 11:08:00 AM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(/software/apache-tomcat-7.0.37/webapps/aaaportal-0.1/WEB-INF/lib/javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class Apr 5, 2013 11:08:13 AM org.apache.catalina.loader.WebappClassLoader loadClass INFO: Illegal access: this web application instance has been stopped already. Could not load org.bouncycastle.jce.provider.JDKKeyPairGenerator$RSABeanInfo. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. java.lang.IllegalStateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1599) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558) at java.beans.Introspector.instantiate(Introspector.java:1444) at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:428) at java.beans.Introspector.<init>(Introspector.java:377) at java.beans.Introspector.getBeanInfo(Introspector.java:164) at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:2948) 

I tried different versions of servlet-api and bcprov-ext-jdk15 - *. jar, but that didn't help.

Should I worry about this error?
How can I make it disappear?

+7
source share
2 answers

You just need to use the provided scope for your dependency, for example:

 <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> 

Thus, it will no longer be packaged in your WAR / EAR file.

+12
source

The servlet-api flag should not be in your WEB-INF / lib at all, as provided by the container. The warning message is fairly explicit: the servlet specification requires that containers ignore any jar files in webapp that contain javax.servlet classes. You can safely ignore this message.

The second bouncycastle report is also probably not what it seems. There was probably another error due to which webapp did not start correctly, and this message appears when something else tries to load the class from the already disabled webapp. Check your other log files and perhaps edit your log4j options in Config.groovy to make the log more verbose and see if this shows a real underlying error.

+7
source