0 Replies Latest reply: Sep 23, 2011 2:35 AM by Zhaoyuan Jia RSS

    java.lang.ClassNotFoundException: com.sun.xml.ws.developer.StreamingDataHandler

    Zhaoyuan Jia Newbie

      Hello everyone!

       

      I am new comer here and I encounter a problem that when I deploy a file upload and download server under JBOSS5.1 using eclipse. I have spent two weeks in searching the solutions using Google, but still has no useful answers.The jbossws I using is jbossws-native-3.2.0.GA.

       

      The server side code like this:

       

      package org.example.www.filetransmission;

       

      import org.example.www.filetransmission.FileTransmission;

       

      import java.io.File;

      import javax.activation.DataHandler;

      import javax.jws.WebService;

      import javax.xml.ws.WebServiceException;

      import javax.xml.ws.soap.MTOM;

       

      import com.sun.xml.ws.developer.StreamingDataHandler;

       

       

      @MTOM

      @WebService(name = "FileTransmissionImpl", serviceName = "FileTransmission", endpointInterface = "org.example.www.filetransmission.FileTransmission")

      public class FileTransmissionImpl implements FileTransmission {

                public String upload(DataHandler data) {

                try {

                  StreamingDataHandler dh = (StreamingDataHandler) data;

                  File file = new File("C://test1");

                  dh.moveTo(file);

                  dh.close();

                  return "";

           

          } catch (Exception e) {

                throw new WebServiceException(e);

          }

                }

       

       

                public DataHandler download(String filePath) {

                          return null;

                }

      }

       

      The client code like this:

       

      package org.example.www.filetransmission.clientsample;

       

       

      import java.util.Map;

       

       

      import javax.activation.DataHandler;

      import javax.activation.FileDataSource;

      import javax.xml.namespace.QName;

      import javax.xml.ws.BindingProvider;

      import javax.xml.ws.soap.MTOMFeature;

       

       

      import org.example.www.filetransmission.FileTransmission;

      import org.example.www.filetransmission.FileTransmission_Service;

       

       

      import com.sun.xml.ws.developer.JAXWSProperties;

       

       

      public class ClientSample {

       

       

                public static void main(String[] args) {

                        System.out.println("***********************");

                        System.out.println("Create Web Service Client...");

                        FileTransmission_Service service1 = new FileTransmission_Service();

                        System.out.println("Create Web Service...");

                             FileTransmission port = service1.getPort(new QName("http://www.example.org/FileTransmission/", "FileTransmissionSOAP"), FileTransmission.class,new MTOMFeature());

                        System.out.println("Call Web Service Operation...");

                        Map<String, Object> ctxt=((BindingProvider)port).getRequestContext();

                        ctxt.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);

                         System.out.println("Server said: " + port.upload(new DataHandler(new FileDataSource("C:\test"))));

                       System.out.println(port.upload(new DataHandler(new FileDataSource("C://test"))));

                        System.out.println("Server said: " + port.download(""));

                        System.out.println("***********************");

                        System.out.println("Call Over!");

                }

      }

       

      But when run the test, there comes the problems like this:

       

      ERROR [InvocationHandlerJAXWS] Method invocation failed with exception: null

      java.lang.reflect.InvocationTargetException

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at org.jboss.webservices.integration.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:129)

                at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)

                at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:468)

                at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:294)

                at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:204)

                at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:130)

                at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:87)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

                at java.lang.Thread.run(Thread.java:722)

      Caused by: java.lang.NoClassDefFoundError: com/sun/xml/ws/developer/StreamingDataHandler

                at org.example.www.filetransmission.FileTransmissionImpl.upload(FileTransmissionImpl.java:23)

                ... 32 more

      Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.developer.StreamingDataHandler from BaseClassLoader@162764f{VFSClassLoaderPolicy@1456c6e{name=vfsfile:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/FileTransmissionEAR.ear/FileTransmission.war/ domain=ClassLoaderDomain@1e02801{name=vfsfile:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/FileTransmissionEAR.ear/FileTransmission.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE parent=BaseClassLoader@c47d73{vfsfile:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/FileTransmissionEAR.ear/}} roots=[FileHandler@13754567[path=FileTransmissionEAR.ear/FileTransmission.war/WEB-INF/classes context=file:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/ real=file:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/FileTransmissionEAR.ear/FileTransmission.war/WEB-INF/classes/]]  delegates=null exported=[org.example.www.filetransmission.clientsample, org.example.www.filetransmission] <IMPORT-ALL>NON_EMPTY}}

                at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

                ... 33 more

      17:01:52,370 ERROR [SOAPFaultHelperJAXWS] SOAP request exception

      java.lang.reflect.UndeclaredThrowableException

                at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:228)

                at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:468)

                at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:294)

                at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:204)

                at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:130)

                at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:87)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

                at java.lang.Thread.run(Thread.java:722)

      Caused by: java.lang.NoClassDefFoundError: com/sun/xml/ws/developer/StreamingDataHandler

                at org.example.www.filetransmission.FileTransmissionImpl.upload(FileTransmissionImpl.java:23)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at org.jboss.webservices.integration.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:129)

                at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)

                ... 26 more

      Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.developer.StreamingDataHandler from BaseClassLoader@162764f{VFSClassLoaderPolicy@1456c6e{name=vfsfile:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/FileTransmissionEAR.ear/FileTransmission.war/ domain=ClassLoaderDomain@1e02801{name=vfsfile:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/FileTransmissionEAR.ear/FileTransmission.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE parent=BaseClassLoader@c47d73{vfsfile:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/FileTransmissionEAR.ear/}} roots=[FileHandler@13754567[path=FileTransmissionEAR.ear/FileTransmission.war/WEB-INF/classes context=file:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/ real=file:/C:/Users/denchao/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server1316420898164/deploy/FileTransmissionEAR.ear/FileTransmission.war/WEB-INF/classes/]]  delegates=null exported=[org.example.www.filetransmission.clientsample, org.example.www.filetransmission] <IMPORT-ALL>NON_EMPTY}}

                at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)

                at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

                ... 33 more

       

      Can anyone gives me some hints to solve this? I follow the example inhttp://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv_adv/mtom.html

       

      Thanks very much!