Payara 服务器上的 NoSuchMethodError (wss4j jar) 但在 Tomcat 中工作

NoSuchMethodError (wss4j jar) on Payara server but work in Tomcat

我尝试从 alfresco 4.0.2 企业版获取文档 URL。我用 Java 8 创建了一个 WAR 的网络服务。它在 tomcat 9 (java 8) 中工作,但在我的 Payara 社区服务器 5.2021.1.[=13 中不起作用=]

war 在 Payara 中正确部署,但是当我获得网络服务配方时出现 NoSuchMethodError:

java.lang.NoSuchMethodError: org.apache.xml.security.transforms.Transform.init()V
at org.apache.ws.security.WSSConfig.staticInit(WSSConfig.java:308) ~[wss4j-1.5.12.jar:na]
at org.apache.ws.security.WSSConfig.<init>(WSSConfig.java:324) ~[wss4j-1.5.12.jar:na]
at org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:333) ~[wss4j-1.5.12.jar:na]
at org.apache.ws.security.WSSConfig.getDefaultWSConfig(WSSConfig.java:342) ~[wss4j-1.5.12.jar:na]
at org.apache.ws.security.WSSecurityEngine.getWssConfig(WSSecurityEngine.java:157) ~[wss4j-1.5.12.jar:na]
at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:97) ~[wss4j-1.5.12.jar:na]
at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:170) ~[wss4j-1.5.12.jar:na]
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) ~[axis-1.4.jar:na]
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) ~[axis-1.4.jar:na]
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) ~[axis-1.4.jar:na]
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:127) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invokeEngine(Call.java:2784) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invoke(Call.java:2767) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invoke(Call.java:2443) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invoke(Call.java:2366) ~[axis-1.4.jar:na]
at org.apache.axis.client.Call.invoke(Call.java:1812) ~[axis-1.4.jar:na]
at org.alfresco.webservice.content.ContentServiceSoapBindingStub.read(ContentServiceSoapBindingStub.java:467) ~[alfresco-web-service-client-3.4.b.jar:na]
at com.cfemex.lv.apps.alfresco.models.dao.AlfrescoDAO.getArchivoURL(AlfrescoDAO.java:349) ~[AlfrescoDAO.class:na]
at com.cfemex.lv.apps.alfresco.models.services.AlfrescoBO.mostrarArchivo(AlfrescoBO.java:132) ~[AlfrescoBO.class:na]
at com.cfemex.lv.apps.alfresco.controlllers.PruebaRestController.prueba2(PruebaRestController.java:32) ~[PruebaRestController.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.4.jar:5.3.4]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.4.jar:5.3.4]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.4.jar:5.3.4]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.4.jar:5.3.4]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.4.jar:5.3.4]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.4.jar:5.3.4]

rute org.apache.xml.security.transforms.Transform.init() 不在 wss4j-1.5.12.jar 中,它在 xmlsec-1.4.1.jar 中。我不知道为什么在 Payara 中出现此错误,但在 Tomcat.

中却没有

在 payara 中,我将罐子放入:

错误来自我的连接方法:

private void Conection(String user, String password){
    try {
        WebServiceFactory.setEndpointAddress(Util.getAlfrescoServer());
        AuthenticationUtils.startSession(user, password);
    } catch (Exception authenticationFault) {
        System.out.println(authenticationFault.getMessage());
        authenticationFault.printStackTrace();
    } }

我使用这个罐子:

提前致谢。

我解决了在 payara5/glassfish/domains/domain1/applications/MYAPP/WEB-INF

中添加 glassfish-web.xml

行 class-loader delegate="false" 问题消失了。但我还有其他与白名单相关的问题。

我的玻璃鱼-web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
  <class-loader delegate="false"/>
  <whitelist-package>com.google</whitelist-package>
  <whitelist-package>org.alfresco</whitelist-package>
  <whitelist-package>org.apache</whitelist-package>
</glassfish-web-app>