I try to get a document URL from alfresco 4.0.2 enterprise. I maked an webservice as WAR with Java 8. It work in tomcat 9 (java 8), but not in my Payara community server 5.2021.1.
The war deploys correctly in Payara, but when I get the webservice recibe an 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]
The rute org.apache.xml.security.transforms.Transform.init() is not in wss4j-1.5.12.jar, its on xmlsec-1.4.1.jar. I don't know why get this error in Payara but not in Tomcat.
In payara i put the jars in:
The error comes from my conection method:
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();
} }
I using this jars:
thanks in advance.
I solved it adding a glassfish-web.xml in payara5/glassfish/domains/domain1/applications/MYAPP/WEB-INF
The line class-loader delegate="false" the problem gone. But I have others problems related with the whitelist.
My glassfish-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>