This discussion is archived
1 2 Previous Next 17 Replies Latest reply: Oct 9, 2012 8:27 AM by 967174 RSS

Generating a webserivce client with ClientGen

532725 Newbie
Currently Being Moderated
I'm using Workshop for Weblogic 10.3 and I'm trying to generate a webservice client. When I generate it with ClientGen and I try to use it I get the following error:

Exception in thread "Main Thread" java.lang.NoClassDefFoundError: weblogic/j2ee/descriptor/ServiceRefHandlerBean
     at weblogic.wsee.jaxrpc.HandlerRegistryImpl.<init>(HandlerRegistryImpl.java:32)
     at weblogic.wsee.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:88)
     at com_service_osadia_interface.wovenware.SERVICE_OSADIA_Impl.<init>(Unknown Source)
     at com_service_osadia_interface.wovenware.SERVICE_OSADIA_Impl.<init>(Unknown Source)
     at testClient.main(testClient.java:18)


If I add the com.bea.core.descriptor.j2ee_1.1.0.0.jar to the libraries then I get the following error:

Exception in thread "Main Thread" java.lang.NoClassDefFoundError: com/sun/xml/ws/util/JAXWSUtils
     at weblogic.wsee.util.is.InputSourceUtil.loadURL(InputSourceUtil.java:44)
     at weblogic.wsee.util.dom.DOMParser.getWebLogicDocumentImpl(DOMParser.java:118)
     at weblogic.wsee.util.dom.DOMParser.getDocument(DOMParser.java:65)
     at weblogic.wsee.wsdl.WsdlReader.getDocument(WsdlReader.java:311)
     at weblogic.wsee.wsdl.WsdlDefinitions.parse(WsdlDefinitions.java:403)
     at weblogic.wsee.wsdl.WsdlDefinitions.parse(WsdlDefinitions.java:389)
     at weblogic.wsee.wsdl.WsdlFactory.parse(WsdlFactory.java:79)
     at weblogic.wsee.wsdl.WsdlFactory.parse(WsdlFactory.java:66)
     at weblogic.wsee.jaxrpc.ServiceImpl.loadWsdlDefinition(ServiceImpl.java:476)
     at weblogic.wsee.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:119)
     at com_service_osadia_interface.wovenware.SERVICE_OSADIA_Impl.<init>(Unknown Source)
     at com_service_osadia_interface.wovenware.SERVICE_OSADIA_Impl.<init>(Unknown Source)
     at testClient.main(testClient.java:18)


How can I fix it?
  • 1. Re: Generating a webserivce client with ClientGen
    gstachni Explorer
    Currently Being Moderated
    Did you invoke ClientGen from within the IDE? This looks like a classpath issue where Weblogic Server's wseeclient.zip is not found on the classpath. Could you provide more information on how you are using and running this web service client?
  • 2. Re: Generating a webserivce client with ClientGen
    user9503787 Newbie
    Currently Being Moderated
    I tried to build a web service client using clientgen from Ant build. How many and what jars I need to be in classpath? In old version I had
    server/lib/weblogic.jar,
    server/lib/webservices.jar,
    server/lib/webserviceclient.jar,
    server/lib/webserviceclient+ssl.jar
    Thanks
  • 3. Re: Generating a webserivce client with ClientGen
    676890 Newbie
    Currently Being Moderated
    Even I got the same exception, I am getting the following exception , if I run the webservice client


    Exception in thread "Main Thread" java.lang.NoClassDefFoundError: weblogic/j2ee/descriptor/ServiceRefHandlerBean
         at weblogic.wsee.jaxrpc.HandlerRegistryImpl.<init>(HandlerRegistryImpl.java:32)
         at weblogic.wsee.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:88)
         at com.loggingconfig.client.Loggingconfigservice_Service_Impl.<init>(Unknown Source)
         at com.loggingconfig.client.Loggingconfigservice_Service_Impl.<init>(Unknown Source)
         at com.loggingconfig.client.Loggingconfigclient.main(Unknown Source).

    I have added all the the jar files on the classpath.


    webserviceclient.jar
         wseeclient.jar
         com.bea.core.descriptor_1.4.0.0
         com.bea.core.logging_1.4.0.0
         com.bea.core.descriptor.j2ee_1.1.0.0.jar
         glassfish.jaxws.rt_2.1.3.jar
         com.bea.core.weblogic.saaj_1.3.0.0.jar
         com.bea.core.weblogic.stax_1.4.0.0.jar
         com.bea.core.xml.beaxmlbeans_1.0.0.0_2-4-0.jar
         javax.jms_1.1.1.jar                               
         com.bea.core.xml.staxb.runtime_1.3.0.0.jar      


    Any help can be appreciated.


    Thanks
    sree
  • 4. Re: Generating a webserivce client with ClientGen
    670909 Newbie
    Currently Being Moderated
    What version of workshop are you using? What type of project are you using?

    If you create a webservice project in workshop, the appropriate jars should be on your classpath. in workshop 10.3, there is a clientgen wizard, which you will probably want to use to create the client jar.

    As to the specific set of jars, you actually need to add everything from the wlserver_10.3/server/lib/wseeclient.zip.
  • 5. Re: Generating a webserivce client with ClientGen
    676890 Newbie
    Currently Being Moderated
    I am using Workshop for Weblogic 10gR3. I created weblogic webservice project.

    The webservice that I created is working fine if I right click the service and select the option Run on the Server. It goes to weblogic Test client.


    My webservice is as follows:


    @WebService(serviceName="Loggingconfigservice")
    public class Loggingconfigservice {

         public Logger logger;
         public String response;
         @WebMethod
         public String logMessage(String msg){
              logger = LoggerFactory.getLogger("source");
              logger.log(Level.DEBUG_TERSE_LEVEL, msg);
              logger.log(Level.INFO_LEVEL, msg);
              logger.log(Level.MINOR_LEVEL, msg);
              logger.log(Level.MAJOR_LEVEL, msg);
              logger.log(Level.CRITICAL_LEVEL, msg);
              
              response = msg + " is logged";
              return response;
              
              
         }
         
    }


    Whenever I run the webservice file thru above Run on Server, it would automatically create all the service related files, deployment descriptor files and wsdl under build folder.

    I ran the clientgen ant task by specifying the wsdl .


    <target name="client">
         <!--<mkdir dir="${clientclass-dir}"/>-->
         <clientgen
         wsdl="${basedir}/build/jws/weboutput/WEB-INF/Loggingconfigservice.wsdl"
         destDir="${basedir}/src"
         packageName="com.loggingconfig.client"/>
         <javac
         srcdir="${basedir}/src/com/loggingconfig/client"
         destdir="${clientclass-dir}"
         includes="/**/*.java"/>
         <javac
         srcdir="${clientclass-dir}/com/loggingconfig/client"
         destdir="${clientclass-dir}"
         includes="Loggingconfigclient.java"/>     
         </target>
         

    Then I ran the Loggingconfigclient program by right click Run as Java application. I got the exception as follows::

    Exception in thread "Main Thread" java.lang.NoClassDefFoundError: weblogic/j2ee/descriptor/ServiceRefHandlerBean
    at weblogic.wsee.jaxrpc.HandlerRegistryImpl.<init>(HandlerRegistryImpl.java:32)
    at weblogic.wsee.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:88)
    at com.loggingconfig.client.Loggingconfigservice_Service_Impl.<init>(Unknown Source)
    at com.loggingconfig.client.Loggingconfigservice_Service_Impl.<init>(Unknown Source)
    at com.loggingconfig.client.Loggingconfigclient.main(Unknown Source).




    But If run the client Loggingconfigclient thru ant task run then I am getting the following exception.

    <target name="run">
         <java classname="com.loggingconfig.client.Loggingconfigclient" fork="true"
         failonerror="true" >
         <classpath refid="client.class.path"/>
         <!--<arg line="http://localhost:2001/Loggingconfigwsdl2service/service?WSDL" />-->
         </java>
         </target>



    javac Note: Recompile with -Xlint:unchecked for details.
    run:
    java Exception in thread "Main Thread" javax.xml.rpc.ServiceException: Failed to load weblogic client internal deployment descriptor. java.io.IOException
    java at weblogic.wsee.jaxrpc.ServiceImpl.throwServiceException(ServiceImpl.java:174)
    java at weblogic.wsee.jaxrpc.ServiceImpl.loadWeblogicDD(ServiceImpl.java:449)
    java at weblogic.wsee.jaxrpc.ServiceImpl.loadInternalDD(ServiceImpl.java:382)
    java at weblogic.wsee.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:121)
    java at com.loggingconfig.client.Loggingconfigservice_Service_Impl.<init>(Unknown Source)
    java at com.loggingconfig.client.Loggingconfigservice_Service_Impl.<init>(Unknown Source)
    java at com.loggingconfig.client.Loggingconfigclient.main(Unknown Source)
    java Caused by: java.io.IOException
    java at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:50)
    java at weblogic.descriptor.BasicDescriptorManager.getMarshallerFactory(BasicDescriptorManager.java:137)
    java at weblogic.descriptor.BasicDescriptorManager.getDescriptorFactory(BasicDescriptorManager.java:171)
    java at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:303)
    java at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:270)
    java at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:336)
    java at weblogic.wsee.jaxrpc.ServiceImpl.loadWeblogicDD(ServiceImpl.java:440)
    java ... 5 more
    java Caused by: com.bea.xml.XmlException: unable to load type library from classloader sun.misc.Launcher$AppClassLoader@1a53dd
    java at com.bea.staxb.runtime.internal.BindingContextFactoryImpl.createBindingContext(BindingContextFactoryImpl.java:50)
    java at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:48)
    java ... 11 more

    BUILD FAILED


    I tried with the workshop samples , getting the same problme everywhere. Your help is really very valuable .


    Thanks
    sree
  • 6. Re: Generating a webserivce client with ClientGen
    670909 Newbie
    Currently Being Moderated
    Are your webservice and client projects the same project? I wouldn't suggest this configuration. It will make resolving the classpath more difficult.

    You should have a seperate project for the client.

    You should copy or create a new wsdl in the client project. Because you are using a local wsdl I would suggest using the wsdllocation attribute of the clientgen task.

    The classpath used for the run as java application probably won't be able to find the necessary jars. Weblogic.jar doesn't include any of the classes it links to the jars that contain the classes.

    In the ant task where you are running the client, where is the definition for client.class.path? What does it include?
  • 7. Re: Generating a webserivce client with ClientGen
    676890 Newbie
    Currently Being Moderated
    1)Are your webservice and client projects the same project? I wouldn't suggest this configuration. It will make resolving the classpath more difficult.

    You should have a seperate project for the client.

    Ans : Yes I used the same werbservice project for webservice client. I would try to create a separate project now.

    2)Because you are using a local wsdl I would suggest using the wsdllocation attribute of the clientgen task.


    Ans :: I used the wsdllocation attribute of the clientgen taks to generate the client related classes to invoke the webservice.

    3) The classpath used for the run as java application probably won't be able to find the necessary jars. Weblogic.jar doesn't include any of the classes it links to the jars that contain the classes.

    Ans:: I included all the jars necessary to run the client. But its not able to find the client generated internal deployment descriptor. The wonder is, the client file is in the same package and same folder of the client generated classes.

    Please have a look at the complete build.xml file.


    ?xml version="1.0" encoding="ISO-8859-1"?>
    <project name="webservices-wsdl2service" default="" basedir=".">

    <!-- set global properties for this build -->

    <property file="build.properties"/>
         
    <property name="loggingconfig.src.dir" value="${basedir}/src"/>
    <property name="dist" value="${basedir}/dist"/>

         <!-- Temperature WS Directories -->
    <property name="loggingconfigJwsDir" value="${loggingconfig.src.dir}/jws"/>
    <property name="loggingconfigImplDir" value="${loggingconfig.src.dir}/imp"/>
    <property name="build.class.path" value="build/classes"/>

    <property name="loggingconfig.ear" value="${dist}/loggingconfigEar"/>

         <!-- Names of deployed Web Services -->
    <property name="loggingconfig.ear.deployed.name" value="LoggingconfigService"/>

    <property name="clientclass-dir" value="${basedir}/build/classes" />

    <path id="client.class.path">
         <pathelement path="${clientclass-dir}"/>
         <pathelement path="lib/webserviceclient.jar"/>
         <pathelement path="lib/wseeclient.jar"/>
                   
    </path>
         
         <path id="service.support.class.path">
              <pathelement path="${build.class.path}"/>
              
         </path>
    <taskdef name="clientgen"
              classname="weblogic.wsee.tools.anttasks.ClientGenTask"/>

    <!-- The clientgen Ant task generates, from an existing WSDL file, the client
                   component files that client applications use to invoke both WebLogic and
                   non-WebLogic Web Services -->
         <target name="client">
         <!--<mkdir dir="${clientclass-dir}"/>-->
         <clientgen
         wsdl="${basedir}/build/jws/weboutput/WEB-INF/Loggingconfigservice.wsdl"
         destDir="${basedir}/src"
         packageName="com.loggingconfig.client"/>
         <javac
         srcdir="${basedir}/src/com/loggingconfig/client"
         destdir="${clientclass-dir}"
         includes="/**/*.java"/>
         <javac
         srcdir="${clientclass-dir}/com/loggingconfig/client"
         destdir="${clientclass-dir}"
         includes="Loggingconfigclient.java"/>     
         </target>
         
         <target name="run">
         <java classname="com.loggingconfig.client.Loggingconfigclient" fork="true"
         failonerror="true" >
         <classpath refid="client.class.path"/>
         <!--<arg line="http://localhost:2001/Loggingconfigwsdl2service/service?WSDL" />-->
         </java>
         </target>
  • 8. Re: Generating a webserivce client with ClientGen
    676890 Newbie
    Currently Being Moderated
    I tried with the workshop samples also, but it also gave the same exception while trying to load the client internal deployment descriptor file.

    Didnt you find any problem or mistake in my code?

    If you tell me how to get around from loading the client internal generated deployment descriptor files.

    Its failing to load this xml file Loggingconfigservice_Service_internaldd.xml. Its failing at the following point in the clientgen generated file as

    public Loggingconfigservice_Service_Impl(String wsdlurl, weblogic.wsee.connection.transport.TransportInfo transportInfo) throws javax.xml.rpc.ServiceException {
    super(wsdlurl,
    new javax.xml.namespace.QName("http://www.bizilab.com/loggingconfigservice/", "Loggingconfigservice"),
    "com/loggingconfig/client/Loggingconfigservice_Service_internaldd.xml", transportInfo);
    }

    You can see com/loggingconfig/client/Loggingconfigservice_Service_internaldd.xml.

    The client code is as

    public class Loggingconfigclient {

    /**
    * @param args
    */
    public static void main(String[] args) throws ServiceException, RemoteException {
    // TODO Auto-generated method stub

    Loggingconfigservice_Service service = new Loggingconfigservice_Service_Impl("http://localhost:2001/Loggingconfigwsdl2service/service?WSDL");

    Loggingconfigservice_PortType portType = service.getLoggingconfigport();

    String response = portType.logMessage("MSG222");

    System.out.println("The Response : " + response);


    }

    }

    This client and all the client generated files are in the same folder as com.loggingconfig.client.


    If I create separate standalone java project for webservice client, would my problem solved, please let me know I would create it now.

    Have you ever tried sir? is it working in your workshop 10gR3 workshop?

    Please let me know.
  • 9. Re: Generating a webserivce client with ClientGen
    670909 Newbie
    Currently Being Moderated
    Sorry for the long delay. I was away for the US holidays.

    Have you resolved your issue? Did you create the client project?
  • 10. Re: Generating a webserivce client with ClientGen
    676890 Newbie
    Currently Being Moderated
    HI,

    I didnt try this after that. I was busy with some other. I would try this weekend. Have you ever encountered this problem. can u able to call webservice thru clientGen task?
  • 11. Re: Generating a webserivce client with ClientGen
    709993 Newbie
    Currently Being Moderated
    Hi there.

    Did you find a solution for the javax.xml.rpc.ServiceException: Failed to load weblogic client internal deployment descriptor. java.io.IOException?

    I am having the same exception and I haven't been able to find a workaround yet.
  • 12. Re: Generating a webserivce client with ClientGen
    709993 Newbie
    Currently Being Moderated
    I have found the solution for this issue (thanks Isabel for letting me know).

    The jar files which you MUST include in your web service client are the ones inside the $WEBLOGIC_10_3/wlserver_10.3/server/lib/wseeclient.zip file

    I assume those jar files are set to be used with webservice client. The previous jar you added in your CLASSPATH are used by the server.

    Please look at this URL for more information:

    http://e-docs.bea.com/wls/docs103/webserv/client.html#wp229351
  • 13. Re: Generating a webserivce client with ClientGen
    711758 Newbie
    Currently Being Moderated
    Please find the build.xml file

    <project name="webservices-simple_client" default="all"> <!-- set global properties for this build -->
    <property name="example-output" value="output" />
    <property name="clientclass-dir" value="${example-output}/clientclass" />
    <path id="client.class.path">
    <pathelement path="${clientclass-dir}" />
    <pathelement path="${java.class.path}" />
    </path>
    <taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" />
    <target name="clean">

    <delete dir="${clientclass-dir}" />
    <echo message="Raja Completed cleaning"/>
    </target>
    <target name="all" depends="clean,build-client,run" />
    <target name="build-client">
    <clientgen
    wsdl="http://localhost:8002/parlayx21/presence/PresenceConsumer?WSDL" destDir="${clientclass-dir}"/>
    <javac srcdir="${clientclass-dir}" destdir="${clientclass-dir}"
    includes="**/*.java" />
    </target>
    <target name="run">
    <java fork="true" classname="examples.webservices.simple_client.Main"
    failonerror="true">
    <classpath refid="client.class.path" />
    <arg line="http://localhost:8002/parlayx21/presence/PresenceConsumer" />
    </java>
    </target>
    </project>


    I am getting error at build-client target , and error is displayed as below

    Buildfile: D:\Raja1\Demo4\build\build.xml
    clean:
    [echo] Raja Completed cleaning
    build-client:

    BUILD FAILED
    D:\Raja1\Demo4\build\build.xml:17: java.lang.NoClassDefFoundError: weblogic/diagnostics/debug/DebugLogger

    Total time: 471 milliseconds


    From above error, i understood that clean is working fine , but build-client target is not working, and it is not finding ClientGenTask class, and I placed weblogic.jar ,wseeclient.jar in project class path and i added them too in windows->preferences->ant runtime libraries in eclipse , but still getting same error, any suggestions are really helpful


    I am adding additional information

    I am using weblogic server 10.3 and eclipse for Java EE IDE 1.2 version .

    Edited by: user8627120 on Jul 30, 2009 12:01 AM
  • 14. Re: Generating a webserivce client with ClientGen
    710557 Newbie
    Currently Being Moderated
    Hi,

    To overcome java.lang.NoClassDefFoundError:weblogic/diagnostics/debug/DebugLogger, you have to place com.bea.core.logging_1.4.0.0.jar file in the class path. This will resolve the issue.

    Regards,
    Sankar Sekar
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points