4 Replies Latest reply: Oct 12, 2010 7:11 AM by sandeep_singh RSS

    clientgen Ant Task fails with "ClassNotFoundException: [B"

    804726
      I'm trying to run the clientgen Ant Task and I get weird error: a java.lang.ClassNotFoundException: [B

      Maybe Im missing something on my classpath but the cryptic message is preventing me from determining what exactly.

      Do you guys have any ideas?

      Extract build.xml:
      <clientgen ear="${expl.dir}"
      serviceName="SwiftcomInterfaceService"
      packageName="com.jnj.gtsc.swiftcom2.business.swiftcom.business.webservice.client"
      useServerTypes="True"
           warName="InterfaceWS"
           savewsdl="true"
      clientJar="${dist.dir}/swiftcomWS_client.jar" >
      <classpath refid="wsclient-classpath" />
      </clientgen>

      wsclient-classpath:
      contains only Weblogic 8.1 sp 6 webservice.jar and webserviceclient.jar

      Stacktrace:
      [clientgen] Generating client jar for swiftcom2Ear(SwiftcomInterfaceService) ...
      [clientgen] weblogic.webservice.server.ConfigException: unable to load class:[ java.lang.ClassNotFoundException: [B
      [clientgen] at weblogic.webservice.server.WebServiceFactory.loadClass(WebServiceFactory.java:1295)
      [clientgen] at weblogic.webservice.dd.MethodDescriptor.<init>(MethodDescriptor.java:45)
      [clientgen] at weblogic.webservice.server.WebServiceFactory.registerOperation(WebServiceFactory.java:813)
      [clientgen] at weblogic.webservice.server.WebServiceFactory.initOperations(WebServiceFactory.java:633)
      [clientgen] at weblogic.webservice.server.WebServiceFactory.createFromMBean(WebServiceFactory.java:220)
      [clientgen] at weblogic.webservice.tools.build.internal.WSDLGenImpl.getWebServiceRuntime(WSDLGenImpl.java:240)
      [clientgen] at weblogic.webservice.tools.build.internal.WSDLGenImpl.run(WSDLGenImpl.java:135)
      [clientgen] at weblogic.webservice.tools.build.internal.ClientGenImpl.doClientGenFromEAR(ClientGenImpl.java:454)
      [clientgen] at weblogic.webservice.tools.build.internal.ClientGenImpl.run(ClientGenImpl.java:348)
      [clientgen] at weblogic.ant.taskdefs.webservices.clientgen.ClientGenTask.doClientGen(ClientGenTask.java:352)
      [clientgen] at weblogic.ant.taskdefs.webservices.clientgen.ClientGenTask.execute(ClientGenTask.java:208)
      [clientgen] at org.apache.tools.ant.Task.perform(Task.java:341)
      [clientgen] at org.apache.tools.ant.Target.execute(Target.java:309)
      [clientgen] at org.apache.tools.ant.Target.performTasks(Target.java:336)
      [clientgen] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
      [clientgen] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:397)
      [clientgen] at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:143)
      [clientgen] at org.apache.tools.ant.Task.perform(Task.java:341)
      [clientgen] at org.apache.tools.ant.Target.execute(Target.java:309)
      [clientgen] at org.apache.tools.ant.Target.performTasks(Target.java:336)
      [clientgen] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
      [clientgen] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:397)
      [clientgen] at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:143)
      [clientgen] at org.apache.tools.ant.Task.perform(Task.java:341)
      [clientgen] at org.apache.tools.ant.Target.execute(Target.java:309)
      [clientgen] at org.apache.tools.ant.Target.performTasks(Target.java:336)
      [clientgen] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
      [clientgen] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
      [clientgen] at org.apache.tools.ant.Main.runBuild(Main.java:609)
      [clientgen] at org.apache.tools.ant.Main.start(Main.java:196)
      [clientgen] at org.apache.tools.ant.Main.main(Main.java:235)
        • 1. Re: clientgen Ant Task fails with "ClassNotFoundException: [B"
          sandeep_singh
          use weblogic.jar also in the classpath.

          thanks,
          Sandeep
          • 2. Re: clientgen Ant Task fails with "ClassNotFoundException: [B"
            804726
            Unfortunately, the same result:

            print-path:
            [echo] |-- path
            [echo] | |
            [echo] | |-- C:\repo\weblogic\weblogic\8.1.6\weblogic-8.1.6.jar
            [echo] | |-- C:\repo\weblogic\webservices\8.1\webservices-8.1.jar
            [echo] | |-- C:\repo\weblogic\webserviceclient\8.1.6\webserviceclient-8.1.6.jar

            [clientgen] Generating client jar for swiftcom2Ear(SwiftcomInterfaceService) ...
            [clientgen] weblogic.webservice.server.ConfigException: unable to load class:[ java.lang.ClassNotFoundException: [B
            [clientgen] at weblogic.webservice.server.WebServiceFactory.loadClass(WebServiceFactory.java:1295)
            [clientgen] at weblogic.webservice.dd.MethodDescriptor.<init>(MethodDescriptor.java:45)
            ...
            • 3. Re: clientgen Ant Task fails with "ClassNotFoundException: [B"
              804726
              I found out what the problem was: wrong version of JDK.

              I was calling my Ant script from Maven and it was executing the Ant script with the Java 6. Once I set the JAVA_HOME in the Maven call to a 1.4 JDK it worked.

              <plugin>
                                  <groupId>org.codehaus.mojo</groupId>
                                  <artifactId>exec-maven-plugin</artifactId>
                                  <version>1.2</version>
                                  <executions>
                                       <execution>
                                            <id>run-ant</id>
                                            <phase>package</phase>
                                            <goals>
                                                 <goal>exec</goal>
                                            </goals>
                                       </execution>
                                  </executions>
                                  <configuration>
                                       <executable>cmd.exe</executable>
                                       <commandlineArgs>/X /C ${env.ANT_HOME}/bin/ant build-all</commandlineArgs>
                                       <environmentVariables>
                                            <JAVA_HOME>${jdk-1.4}</JAVA_HOME>
                                       </environmentVariables>
                                  </configuration>
                             </plugin>
              • 4. Re: clientgen Ant Task fails with "ClassNotFoundException: [B"
                sandeep_singh
                thanks for sharing this info.