I am trying to consume apache-cxf Web Services In Liferay-7 portlet ,I got the following error in linux environment.
13:39:14,374 ERROR [http-nio-4080-exec-9][status_jsp:950] com.liferay.portal.kernel.portlet.PortletContainerException: com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.LinkageError: com/sun/org/apache/xpath/internal/jaxp/XPathImpl
If I run the same portlet in liferay 7 windows environment it is working fine
And here is the sample jsp code (view.jsp)
<portlet:defineObjects />
<%@ page import="org.apache.cxf.endpoint.Client" %>
<%@ page import="org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%
String endpoint="http://*******/***-ws/soap/login?wsdl";
String method ="login";
String uname ="admin";
String pwd = "admin";
String result = "";
Object[] params = new Object[2] ;
params[0] = (Object)uname;
params[1] = (Object)pwd;
result = call(endpoint, method, params);
System.out.println("Result : "+result);
%>
<%!
public static String call(String endpoint, String method, Object[] params) {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
try {
Client client = dcf.createClient(endpoint);
System.out.println("Client Object Create successfully :");
Object[] returnVals = client.invoke(method, params);
//extract returned value. getting 1st value as sakai ws calls returns only one value.
if(returnVals!=null && returnVals.length>0)
return (String)returnVals[0];
}
catch (Exception e) {
e.printStackTrace();
System.out.println("A connection error occurred: " + e.getClass() + ": " + e.getMessage());
}
return null;
}
%>
The Problem is occurring at Client client = dcf.createClient(endpoint);
Here is the dependencies we are using
==============================
cxf-core-3.1.8.jar
cxf-rt-bindings-soap-3.1.8.jar
cxf-rt-databinding-jaxb-3.1.8.jar
cxf-rt-frontend-jaxws-3.1.8.jar
cxf-rt-frontend-simple-3.1.8.jar
cxf-rt-transports-http-3.1.8.jar
cxf-rt-wsdl-3.1.8.jar
neethi-3.0.3.jar
==============================
Same Code I have checked in Liferay 6.2 and its working fine in both windows and linux environment, but I have added some more jar files.
==============================
cxf-rt-bindings-xml-3.1.8.jar
cxf-rt-ws-addr-3.1.8.jar
cxf-rt-ws-policy-3.1.8.jar
jaxb-impl-2.2.11.jar
jaxb-core-2.2.11.jar
xmlschema-core-2.2.1.jar
stax2-api-3.1.4.jar
woodstox-core-asl-4.4.1.jar
wsdl4j-1.6.3.jar
==============================
Please Help me out .
Thanks & Regards,
P.V.B.Raju.