Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-75835

Linkage Error While Consuming Web Services Using Apache CXF Framework

    Details

    • Type: Bug
    • Status: Verified
    • Resolution: Unresolved
    • Affects Version/s: 7.0.1 CE GA2
    • Fix Version/s: None
    • Component/s: Web Services > SOAP
    • Labels:
    • Fix Priority:
      2
    • OS:
      Ubuntu LTS 14.04
    • JDK:
      Oracle Sun JDK 8
    • Application Servers:
      Apache Tomcat 8.0.x
    • Browsers:
      Chrome (latest)
    • Databases:
      MySQL 5.6
    • Device Type:
      Desktop

      Description

      I am trying to consume a SOAP web service by using apache-cxf framework 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

      And here is the sample jsp code (view.jsp)

      // code placeholder
      <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;
      }
      %>
      

      Here is the dependencies I am 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

      Note: The issue is not coming regularly,it is coming when you re-deploy the portlet or restart the serer.

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              pvbraju.vidyayug pvbraju
              Participants of an Issue:
              Recent user:
              Sherry Zhu
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                2 years, 1 week, 3 days ago

                Packages

                Version Package