JBoss 7 类未找到错误

JBoss 7 ClassNotFoundError

尝试在 JBoss7 中部署新的 ear 文件并尝试访问服务时出现以下错误:

16:17:39,114 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/my-app-ejb-1.0-SNAPSHOT].[MyServicesBean]] (http--10.232.165.117-8080-1) Servlet.service() for servlet MyServicesBean threw exception: java.util.MissingResourceException: Could not instantiate factory delegate, got exception(s): java.lang.ClassNotFoundException: com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl from [Module "deployment.my-app-ear-1.0-SNAPSHOT.ear:main" from Service Module Loader] java.lang.ClassNotFoundException: com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl from [Module "deployment.my-app-ear-1.0-SNAPSHOT.ear:main" from Service Module Loader] java.lang.ClassNotFoundException: org.apache.xalan.processor.TransformerFactoryImpl from [Module "deployment.my-app-ear-1.0-SNAPSHOT.ear:main" from Service Module Loader] at weblogic.xml.jaxp.Utils.getDelegate(Utils.java:28) [wlfullclient5-12.1.3.0.0.jar:12.1.3.0.0] at weblogic.xml.jaxp.WebLogicTransformerFactory.(WebLogicTransformerFactory.java:79) [wlfullclient5-12.1.3.0.0.jar:12.1.3.0.0] at weblogic.xml.jaxp.RegistryTransformerFactory.(RegistryTransformerFactory.java:62) [wlfullclient5-12.1.3.0.0.jar:12.1.3.0.0] at weblogic.xml.jaxp.RegistrySAXTransformerFactory.(RegistrySAXTransformerFactory.java:12) [wlfullclient5-12.1.3.0.0.jar:12.1.3.0.0] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_65] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_65] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_65] at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_65] at __redirected.__TransformerFactory.(__TransformerFactory.java:111) [jboss-modules.jar:1.1.1.GA] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_65] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_65]

能否请您建议如何解决这个问题?

这个问题可能是因为你的项目中没有xalan库。

因此,您可以将它添加到 http://mvnrepository.com/artifact/xalan/xalan/2.7.2 的项目中,或者您可以通过创建 jboss-deployment-[ 来使用 JBoss 服务器中包含的那个=24=] 文件:

<jboss-deployment-structure>
    <deployment>            
        <exclusions>            
            <module name="org.apache.xalan" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

如果您遇到任何问题 - 还要添加 xerces 库:

<jboss-deployment-structure>
    <deployment>            
        <exclusions>            
            <module name="org.apache.xalan" />
            <module name="org.apache.xerces" /> 
        </dependencies>
    </deployment>
</jboss-deployment-structure>

希望这对您有所帮助。

P.S。 JBoss 关于 Class 的文档正在 JBoss 中加载:https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7