java.lang.ClassNotFoundException:com.sun.faces.将MyFaces与WASCE/Geronimo一起使用时的config.ConfigureListener

uurity8g  于 2023-04-28  发布在  Java
关注(0)|答案(4)|浏览(151)

我正在尝试使用MyFaces v 2创建一个简单的JSF Web应用程序。WebSphere Application Server Community Edition v3。0.0.1和Eclipse Juno,但当我尝试运行应用程序时,返回以下错误:

java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
org.apache.geronimo.common.DeploymentException: java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
    at org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebAppClassFinder(AbstractWebModuleBuilder.java:665)
    at org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBasicWebModuleAttributes(AbstractWebModuleBuilder.java:698)
    at org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.addGBeans(TomcatModuleBuilder.java:469)
    at org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.addGBeans(SwitchingModuleBuilder.java:174)
    at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:764)
    at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:255)
    at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:140)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
    at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
    at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
    at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
    at org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:344)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
    at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
    at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
    at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
    at org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:773)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1438)
    at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:83)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1276)
    at java.security.AccessController.doPrivileged(AccessController.java:284)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1378)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:799)
    at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
    at sun.rmi.transport.Transport$1.run(Transport.java:171)
    at java.security.AccessController.doPrivileged(AccessController.java:284)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:167)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:547)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:802)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:661)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
    at java.lang.Thread.run(Thread.java:736)
Caused by: java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
    at org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.addClass(AbstractWebModuleBuilder.java:670)
    at org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.createWebAppClassFinder(AbstractWebModuleBuilder.java:661)
    ... 45 more

可能是因为MyFacesjar文件不在类路径中,但是我不能找出哪里出错了,因为Eclipse中的构建路径包含所需的jar。我还尝试将jar文件复制到WEB-INF/lib目录中,但没有成功。
下面的屏幕截图显示了项目结构沿着库。

在Eclipse或WASCE中是否需要做一些特定的事情来包含jar文件,或者问题是否存在于其他地方?

5t7ly7z5

5t7ly7z51#

Caused by: java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener

缺少的类是Mojarra的一部分,它实际上是MyFaces的竞争对手。
在使用MyFaces时,您根本不需要这个类。此异常可能有以下原因:

  • 在webapp的web.xml/WEB-INF/lib中任何已部署JAR的web-fragment.xml中有一个手动定义的<listener>条目,它引用了这个特定于Mojarra的侦听器类。
  • 类路径中有一个松散的Mojarra .tld文件(不太可能,谁会提取JAR文件并将其松散的内容放在类路径中?). TLD文件会自动初始化,并且可以包含<listener>条目,该条目可以触发ServletContextListener实现的自动注册(例如Mojarra ConfigureListener)。

这些冲突可以通过消除它来解决。

zyfwsgd6

zyfwsgd62#

我在Jetty服务器上部署了一个带有Myfaces的Web应用程序,需要使用一个监听器和一个额外的init参数来使用facelets:

<context-param>
    <param-name>org.apache.myfaces.FACES_INITIALIZER </param-name>
    <param-value>org.apache.myfaces.webapp.FaceletsInitilializer</param-value>
</context-param>
<listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
ukqbszuj

ukqbszuj3#

我使用mojarra实现进行编译,运行时依赖于apache tomcat。但是tomcat使用myfaces实现。因此不得不在WEB-INF/lib中包含mojarra impl jar来解决这个问题

tcbh2hod

tcbh2hod4#

我也有同样的问题。当我试图运行一个。html文件与Eclipse使用Tomcat 7作为本地服务器我收到了404错误的浏览器。在Eclipse的控制台中显示错误“ClassNotFoundException:com.sun.faces.config.ConfigureListener”。
Mojarra图书馆(Mojarra Library)jar)我在我的动态Web项目中使用的。我用的是javax。faces-2.3.0-m04.jar

相关问题