5 Replies Latest reply: Nov 27, 2006 8:35 PM by Ignacio Pérez RSS

ClassNotFoundException using wscompile task

William Newbie

Which attribute in this task shows where to find the class file that the compiler is looking for in the error msg? AFAIK, the source files are generated off of the interface file and placed in sourcebase, and then the classes are compiled and put in the base attrib.

Any help much appreciated.

 <wscompile
 base="${proj.temp}/classes"
 sourcebase="${proj.temp}/gen"
 server="true"
 model="${proj.etc}/model.xml.gz"
 keep="true"
 config="${proj.etc}/config.xml"
 xPrintStackTrace="true">
 <classpath refid="classpath.jwsdp"/>
 </wscompile>


<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
 <service name="OrderIF_Service"
 targetNamespace="http://localhost/wsdl"
 typeNamespace="http://localhost/types"
 packageName="com.example.services">

 <interface
 name="com.example.services.OrderIF_Service"
 servantName="com.example.services.OrderImpl">
 </interface>
 </service>
</configuration>



compilews:
[echo] JWSDP: /home/public/jwsdp-1.5/jaxrpc/lib
[wscompile] RmiModeler error: java.lang.ClassNotFoundException: com$example$services$OrderIF_Service
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiModeler.modelPort(RmiModeler.java:685)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiModeler.buildEncodedModel(RmiModeler.java:523)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiModeler.buildModel(RmiModeler.java:459)
[wscompile] at com.sun.xml.rpc.processor.config.ModelInfo.buildModel(ModelInfo.java:88)
[wscompile] at com.sun.xml.rpc.processor.Processor.runModeler(Processor.java:63)
[wscompile] at com.sun.xml.rpc.tools.wscompile.CompileTool.run(CompileTool.java:714)
[wscompile] at com.sun.xml.rpc.util.ToolBase.run(ToolBase.java:43)
[wscompile] at com.sun.xml.rpc.tools.ant.Wscompile.execute(Wscompile.java:746)
[wscompile] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[wscompile] at org.apache.tools.ant.Task.perform(Task.java:364)
[wscompile] at org.apache.tools.ant.Target.execute(Target.java:341)
[wscompile] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[wscompile] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)[wscompile] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[wscompile] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[wscompile] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[wscompile] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[wscompile] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

[wscompile] CAUSE:

[wscompile] java.lang.ClassNotFoundException: com$example$services$OrderIF_Service
[wscompile] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[wscompile] at java.security.AccessController.doPrivileged(Native Method)
[wscompile] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[wscompile] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[wscompile] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[wscompile] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)[wscompile] at java.lang.Class.forName0(Native Method)
[wscompile] at java.lang.Class.forName(Class.java:242)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiUtils.getLoadableClassName(RmiUtils.java:78)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiUtils.getLoadableClassName(RmiUtils.java:84)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiUtils.getLoadableClassName(RmiUtils.java:84)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiUtils.getLoadableClassName(RmiUtils.java:84)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiUtils.getRealName(RmiUtils.java:54)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiModeler.modelPort(RmiModeler.java:676)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiModeler.buildEncodedModel(RmiModeler.java:523)
[wscompile] at com.sun.xml.rpc.processor.modeler.rmi.RmiModeler.buildModel(RmiModeler.java:459)
[wscompile] at com.sun.xml.rpc.processor.config.ModelInfo.buildModel(ModelInfo.java:88)
[wscompile] at com.sun.xml.rpc.processor.Processor.runModeler(Processor.java:63)
[wscompile] at com.sun.xml.rpc.tools.wscompile.CompileTool.run(CompileTool.java:714)
[wscompile] at com.sun.xml.rpc.util.ToolBase.run(ToolBase.java:43)
[wscompile] at com.sun.xml.rpc.tools.ant.Wscompile.execute(Wscompile.java:746)
[wscompile] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[wscompile] at org.apache.tools.ant.Task.perform(Task.java:364)
[wscompile] at org.apache.tools.ant.Target.execute(Target.java:341)
[wscompile] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[wscompile] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)[wscompile] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[wscompile] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[wscompile] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[wscompile] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[wscompile] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
[wscompile] error: RmiModeler error: java.lang.ClassNotFoundException: com$example$services$OrderIF_Service

[wscompile] Command invoked: wscompile -d /home/myProject/projects/egServer/build/classes -gen:server -keep -model /home/myProject/projects/egServer/etc/model.xml.gz -s /home/myProject/projects/egServer/build/gen -Xprintstacktrace /home/myProject/projects/egServer/etc/config.xml -classpath /home/public/jwsdp-1.5/jaxrpc/lib/jaxrpc-api.jar:/home/public/jwsdp-1.5/jaxrpc/lib/jaxrpc-impl.jar:/home/public/jwsdp-1.5/jaxrpc/lib/jaxrpc-spi.jar


  • 1. Re: ClassNotFoundException using wscompile task
    jspaeth Newbie

    I believe you just need to add the folder containing your interface class and your implementation class to the classpath passed into the wscompile. This is in addition to the jwsdp classes. For example, my classpath looks like:







    where ${build.classes.dir} is the location of my compiled web service classes, ${jwsdp.shared.home} is the location of the jwsdp-shared subfolder of the java web service development pack and ${jaxrpc.home} is the jaxrpc subfolder of the java web service development pack.

  • 2. Re: ClassNotFoundException using wscompile task
    jspaeth Newbie

     

    "jspaeth" wrote:
    I believe you just need to add the folder containing your interface class and your implementation class to the classpath passed into the wscompile. This is in addition to the jwsdp classes. For example, my classpath looks like:

    <path id="my.libs">
     <pathelement path="${build.classes.dir}"/>
     <fileset dir="${jwsdp.shared.home}/lib"/>
     <fileset dir="${jaxrpc.home}/lib"/>
    </path>


    where ${build.classes.dir} is the location of my compiled web service classes, ${jwsdp.shared.home} is the location of the jwsdp-shared subfolder of the java web service development pack and ${jaxrpc.home} is the jaxrpc subfolder of the java web service development pack.


  • 3. Re: ClassNotFoundException using wscompile task
    William Newbie

    I wonder if my not having an implementation class has something to do with it. I'm following along in the Wiki, and it just shows an interface class.

    I'm doing a service endpoint in an ejb. Can't I genereate everything I need just from the interface class?

  • 4. Re: ClassNotFoundException using wscompile task
    William Newbie

    I may have something wrong w/ my wscompile ant task as to why that class is not being found.

     <wscompile
     base="${proj.temp}/classes"
     sourcebase="${proj.temp}/gen"
     server="true"
     model="${proj.etc}/model.xml.gz"
     keep="true"
     config="${proj.etc}/config.xml"
     xPrintStackTrace="true">
     <classpath refid="classpath.jwsdp"/>
     </wscompile>
    


    If I'm understanding these correctly, I have ...

    base=where my class files are placed after compiling from the generated src files.
    sourcebase=this is where my generated sourcefiles are to be placed.

    in the <classpath tag, I also have the path to where my service endpoint (which is just an interface source file) can be found.


  • 5. Re: ClassNotFoundException using wscompile task
    Ignacio Pérez Newbie

    I'm not sure of this answer in this case, but it was a good solution with the same error message in another circumstances (wsdp 1.6). Put .class files of OrderIF_Service in folders with a tree structure, in this case, the folders are com->example->services-> files .class (i.e. the package descriptor?). When eclipse IDE with wtools generate the sources and the binaries for a web service with top down methodology, the IDE put the folders with this structure.


    saludos
    Ignacio

    P.D sorry for my english :p