0

我正在从 JBoss 5 -> JBoss 7 迁移,根据https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7,打包在 WEB-INF/lib 中的本地资源应该在部署间依赖项之前加载。

在我的 WEB-INF/lib 目录中,我有 wss4j(版本 1.5.7)库 jar,其中包含 Transform.init() 方法。

在我部署并运行我的应用程序后,我收到以下错误。

错误 [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[Resteasy]] (http--127.0.0.1-8080-1) Servlet.service() for servlet Resteasy 抛出异常:org.jboss.resteasy.spi.UnhandledException: java.lang.NoSuchMethodError: org.apache.xml.security.transforms.Transform.init()V at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException( SynchronousDispatcher.java:340) [resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) [resteasy-jaxrs-2.3.2.Final. jar:] 在 org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) [resteasy-jaxrs-2.3.2.Final.jar:] 在 org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher .java:540) [resteasy-jaxrs-2.3.2.Final.jar:] 在org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:] 在 org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher .java:208) [resteasy-jaxrs-2.3.2.Final.jar:] 在 org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2 .Final.jar:] 在 org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar:] 在 javax.servlet.http。 HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13 .Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardWrapperValve.invoke( StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] 在 org.apache.catalina.core。 StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:] at org.apache。 catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0. 13.Final.jar:] 在 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:] 在 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler .process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13 .Final.jar:] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_05] 原因:java.lang.NoSuchMethodError: org.apache.xml.security.transforms.Transform.init()V 在 org.apache.ws.security.WSSConfig.(WSSConfig.java:81) [wss4j-1.5.2.jar:]在 org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:95) [wss4j-1.5.2.jar:] 在 org.apache.ws.security.WSSConfig.(WSSConfig.java:47) [wss4j- 1.5.2.jar:] 在 org.apache.ws.security.WSSecurityEngine.(WSSecurityEngine.java:51) [wss4j-1.5.2.jar:] 在 org.apache.ws.security.handler.WSHandler.(WSHandler .java:62) [wss4j-1.5.2.jar:] at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_05] at java.lang.Class.forName(Class.java:264 ) [rt.jar:1.7.0_05] 在 org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:177) [axis-1.4.jar:] 在 java.security.AccessController。doPrivileged(Native Method) [rt.jar:1.7.0_05] at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160) [axis-1.4.jar:] at org.apache.axis.utils。 ClassUtils.forName(ClassUtils.java:100) [axis-1.4.jar:] 在 org.apache.axis.deployment.wsdd.WSDDDeployableItem.getJavaClass(WSDDDeployableItem.java:353) [axis-1.4.jar:] 在 org. apache.axis.deployment.wsdd.WSDDDeployableItem.makeNewInstance(WSDDDeployableItem.java:295) [axis-1.4.jar:] at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274) [axis- 1.4.jar:] 在 org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260) [axis-1.4.jar:] 在 org.apache.axis.deployment.wsdd.WSDDChain.makeNewInstance(WSDDChain .java:125) [axis-1.4.jar:] 在 org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274) [axis-1.4.jar:] at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260) [axis- 1.4.jar:] 在 org.apache.axis.deployment.wsdd.WSDDDeployment.getGlobalRequest(WSDDDeployment.java:473) [axis-1.4.jar:] 在 org.apache.axis.configuration.FileProvider.getGlobalRequest(FileProvider.java :269) [axis-1.4.jar:] at org.apache.axis.AxisEngine.getGlobalRequest(AxisEngine.java:365) [axis-1.4.jar:] at org.apache.axis.client.AxisClient.invoke(AxisClient .java:126) [axis-1.4.jar:] 在 org.apache.axis.client.Call.invokeEngine(Call.java:2784) [axis-1.4.jar:] 在 org.apache.axis.client.Call .invoke(Call.java:2767) [axis-1.4.jar:] 在 org.apache.axis.client。Call.invoke(Call.java:2443) [axis-1.4.jar:] 在 org.apache.axis.client.Call.invoke(Call.java:2366) [axis-1.4.jar:] 在 org.apache。 axis.client.Call.invoke(Call.java:1812) [axis-1.4.jar:] 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_05] 在 sun.reflect.NativeMethodAccessorImpl。调用(NativeMethodAccessorImpl.java:57)[rt.jar:1.7.0_05] 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_05] 在 java.lang.reflect.Method。在 org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155) [resteasy-jaxrs-2.3.2.Final.jar:] 调用(Method.java:601)[rt.jar:1.7.0_05]在 org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.core.ResourceMethod.invoke (ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:] at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final .jar:] ... 还有 19 个

4

2 回答 2

1

从我能找到的信息来看,似乎该方法在 1.4 版之后的 xmlsec 中不可用。您可以尝试使用旧版本的 jar,例如:

http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/santuario/xmlsec/1.4.2/xmlsec-1.4.2.jar

于 2014-05-15T22:57:37.630 回答
0

我发现了同样的问题,并在 META-INF/jboss-deployment-structure.xml 中设置了以下 JBoss 部署排除(在 7.1.1 中)解决了它:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
    <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
    <deployment>
        <dependencies>
            <module name="deployment.javaee.api" />
        </dependencies>
        <exclusions>
            <module name="javaee.api" />
        </exclusions>
    </deployment>
    <module name="deployment.javaee.api">
        <dependencies>
            <module name="javaee.api" export="true">
                <imports>
                    <exclude path="org/apache/xml/security/**" />
                </imports>
            </module>
        </dependencies>
    </module>
</jboss-deployment-structure>

来自https://community.jboss.org/message/747491#747491

于 2013-02-13T14:53:54.237 回答