web-dev-qa-db-ja.com

java.lang.ClassNotFoundException:WASCE / GeronimoでMyFacesを使用する場合のcom.Sun.faces.config.ConfigureListener

MyFaces v 2.1とWebSphere Application Server Community Edition v3.0.0.1およびEclipse Junoを使用して簡単なJSF Webアプリケーションを作成しようとしていますが、アプリケーションを実行しようとすると、次のエラーが返されます

    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

MyFaces jarファイルがクラスパスにないためにエラーが発生していると思われますが、Eclipseのビルドパスに必要なjarが含まれているため、どこが間違っているのかわかりません。また、jarファイルをWEB-INF/libディレクトリにコピーしようとしましたが、役に立ちませんでした。

以下のスクリーンショットは、プロジェクト構造とライブラリを示しています。

Eclipse Project Structure

Jarファイルを含めるためにEclipseまたはWASCEで行う必要がある特定の何かがありますか、または問題は他の場所にありますか?

19
Paul H
Caused by: Java.lang.ClassNotFoundException: com.Sun.faces.config.ConfigureListener

欠落しているクラスは Mojarra の一部であり、実際には MyFaces の競合です。

MyFacesを使用する場合、そのクラスはまったく必要ありません。この例外には、次の原因が考えられます。

  • Webappの<listener>に手動で定義されたweb.xmlエントリ、またはこのMojarra固有のリスナークラスを参照するweb-fragment.xmlのデプロイされたJARの/WEB-INF/libがあります。

  • クラスパスのどこかにゆるいMojarra .tldファイルがあります(JARファイルを抽出してそのゆるい内容をクラスパスに入れる人はほとんどいません)。 TLDファイルは自動初期化され、ServletContextListener実装(Mojarra ConfigureListenerなど)の自動登録をトリガーできる<listener>エントリを含めることができます。

これらの競合は、削除するだけで修正できます。

31
BalusC

JettyサーバーにMyfacesを使用してWebアプリケーションをデプロイしましたが、faceletを使用するにはリスナーと追加のinitパラメーターを使用する必要がありました。

<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>
4

私も同じ問題を抱えていました。 Tomcat7をローカルサーバーとして使用してEclipseで.htmlファイルを実行しようとすると、ブラウザーで404エラーを受け取りました。また、Eclipseのコンソールで「ClassNotFoundException:com.Sun.faces.config.ConfigureListener」というエラーが表示されていました。

問題は、ダイナミックWebプロジェクトで使用していたMojarraライブラリ(.jar)でした。 javax.faces-2.3.0-m04.jarを使用していました。

->解決策:

Mojarraのリポジトリに古いバージョンをダウンロードします https://maven.Java.net/content/repositories/releases/org/glassfish/javax.faces/ 私の場合、2.2.7バージョン(javax.faces-2.2.7.jar)をダウンロードしました。

次に、JSF v2.0を使用してEclipseで新しい動的Webプロジェクトを作成し、ライブラリセクションでjavax.faces-2.2.7.jarファイルを割り当てました。

1
Fernando Costa

コンパイルにはmojarra実装を使用し、ランタイムはApache Tomcatに依存していました。ただし、Tomcatはmyfaces実装を使用します。そのため、問題を解決するためにWEB-INF/libにmojarra impl jarを含める必要がありました

1
Pramod Shivale