我正在运行一个相对简单的注释驱动的Spring配置的Web应用程序。我正在使用Java 1.6,Tomcat 7,并相信pom.xml中的适当依赖项,即jsp-api:2.2,javax.servlet- api:3.0.1。尽管我的Web应用程序在运行时似乎没有任何问题,但我仍然不断收到以下错误。我确实在网上找到了对此错误的一个参考,它建议在我的web.xml文件中添加’metadata- complete =“ true”’,这使@HandleTypes错误消失了,但阻止了我的应用正确构建自身。
任何建议/帮助将不胜感激。谢谢!
Sep 5, 2012 1:29:52 PM org.apache.catalina.startup.ContextConfig checkHandlesTypes WARNING: Unable to load class [javax.servlet.jsp.el.ImplicitObjectELResolver$ImplicitObjects] to check against the @HandlesTypes annotation of one or more ServletContentInitializers. java.lang.ClassNotFoundException: javax.servlet.jsp.el.ImplicitObjectELResolver$ImplicitObjects at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533) at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:1988) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1951) at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1840) at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1808) at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1794) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1214) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:828) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:302) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5148) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
Sep 5, 2012 1:29:52 PM org.apache.catalina.startup.ContextConfig checkHandlesTypes WARNING: Unable to load class [javax.servlet.jsp.el.ImplicitObjectELResolver$ImplicitObjects] to check against the @HandlesTypes annotation of one or more ServletContentInitializers.
java.lang.ClassNotFoundException: javax.servlet.jsp.el.ImplicitObjectELResolver$ImplicitObjects at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533) at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:1988) at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1951) at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1840) at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1808) at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1794) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1214) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:828) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:302) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5148) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
您应该确保war文件不包含Servlet API和JSP API jar,否则会遇到棘手的类加载问题。
war
jar
但是,您仍然需要它们作为编译时依赖项。对于这种情况,Maven允许您使用scope声明这些依赖项provided。
provided
因此,确保jsp-api:2.2和javax.servlet-api:3.0.1有<scope>provided</scope>。
jsp-api:2.2
javax.servlet-api:3.0.1
<scope>provided</scope>