我正在尝试将从Eclipse工作区导入的Web应用程序部署到NetBeans。但它没有部署,而是给了我以下例外。
15 Jul, 2011 5:59:04 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.apache.myfaces.component.html.util.StreamingDestroyerListener
java.lang.NoClassDefFoundError: javax/faces/FacesException
at org.apache.myfaces.shared_tomahawk.config.MyfacesConfig.<clinit>(MyfacesConfig.java:80)
at org.apache.myfaces.component.html.util.StreamingDestroyerListener.contextInitialized(StreamingDestroyerListener.java:32)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:521)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
**at java.lang.reflect.Method.invoke(Method.java:597)**
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
**at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)**
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1500)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:849)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:351)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:199)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:558)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
**at java.lang.Thread.run(Thread.java:619)**
我错过了一些JAR吗?
答案 0 :(得分:11)
NoClassDefFoundError
表示该类在编译期间存在于类路径中。 Tomahawk在代码库中有一个import javax.faces.FacesException;
行。这是核心JSF API的一个类。
这意味着webapp的类路径中缺少JSF库。该项目在Netbeans中显然与已经与JSF捆绑的服务器相关联,例如Glassfish,JBoss AS等.Eclipse中的项目似乎与服务器没有正确关联,或者有问题的服务器不有捆绑的JSF,如Tomcat,Jetty等。
stacktrace暗示您正在使用Tomcat。您需要单独download JSF并将JAR文件放在webapp的/WEB-INF/lib
中(您的Tomahawk库也在那里)。
答案 1 :(得分:3)
是的,CNF异常总是意味着缺少JAR。类加载器找不到这个:
javax.faces.FacesException
你通过切割和发现它找到它将类名粘贴到findjar.com中,如下所示:
http://www.findjar.com/index.x?query=javax.faces.FacesException
答案 2 :(得分:0)
添加不同的体验:当我遇到这个问题时,因为我使用的是ICEFaces,并且已将ICEFaces jar包含在Tomcat的$CATALINA_BASE/lib
目录中,但在我的webapp javax.faces.jar
中包含/WEB-INF/lib
} 目录。对我而言,解决方案是将javax.faces.jar
从/WEB-INF/lib
移至$CATALINA_BASE/lib
。另外,如果您使用ICEFaces之类的东西,请确保使用正确版本的javax.faces.jar
。