source2wsdd error : In doclet class weblogic.webservice.tools.ddgen.Service - weblogic.developer.interest.webservices.general(Archived)

I'm trying to use source2wsdd ant task through the following build-webss.xml :
<project name="sample" default="webss.build">
     <property file="./WebContent/WEB-INF/etc/properties.txt" />
     <taskdef name="source2wsdd" classname="weblogic.ant.taskdefs.webservices.autotype.JavaSource2DD">
     <classpath path="webservices.jar"/>
     <classpath path="weblogic.jar"/>
     </taskdef>
     <target name="clean" description="delete generated stuff" >
          <delete dir="./tmp/output" />
          <delete dir="./tmp/client_classes" />
          <delete dir="./tmp/wlws/config/mydomain/applications" />
     </target>
     <target name="setup" description="create output directories" >
          <mkdir dir="./tmp/server_classes" />
          <mkdir dir="./tmp/client_classes" />
          <mkdir dir="./tmp/wlws/config/mydomain/applications" />
     </target>
     <target name="webss.build" depends="clean,setup">
          <source2wsdd
          description="create web service descriptor and wsdl from source file"
          javaSource="./src/ws/HelloWorldService.java"
          ddFile="./tmp/output/WEB-INF/web-services.xml"
          serviceURI="${webss.service.url}"
          wsdlFile="./tmp/output/${webss.service.name}.wsdl" >
          <classpath>
          <pathelement location="./build" />
          <pathelement location="./WebContent/WEB-INF/lib" />
          <pathelement path="${java.class.path}" />
          </classpath>
          </source2wsdd>
</target>
</project>
I get the following error, and I could not find any solution :
source2wsdd: error - In doclet class weblogic.webservice.tools.ddgen.ServiceGen, method start has thrown an exception java.lang.reflect.InvocationTargetException
[source2wsdd] weblogic.xml.schema.binding.util.ClassUtil$ClassUtilException: unable to load class:java.lang.ClassNotFoundException: ws.HelloWorldService
[source2wsdd]      at weblogic.xml.schema.binding.util.ClassUtil.loadClass(ClassUtil.java:76)
[source2wsdd]      at weblogic.webservice.tools.ddgen.ServiceGen.canCreate(ServiceGen.java:252)
...
Of course I checked that src/ws.HelloWorldService.java exists, so I really don't know where to look at to solve this pb. 

Hi.....
Is your class compiled? The error is looking for the .class file. Use JavaC or wlcompile before you run source2wsdd and make sure its in you compile classpath. 

Yes my class is compiled both automatically with Eclipse, and with javac ant task, and this is added to the compile classpath, so I don't see where the problem is.
thanks,
Here is the code as modified :
<target name="compile.server"
     description="compile classes needed on the server side" >
     <javac srcdir="./src/ws/" includes="*.java" excludes="client/*"
     destdir="${server_classes}" >
     </javac>
          <echo message="step 3 - task compile.server -"/>
     </target>
     <target name="webss.build" depends="clean,setup,compile.server">
          <source2wsdd
          description="create web service descriptor and wsdl from source file"
          javaSource="./src/ws/HelloWorldService.java"
          ddFile="./tmp/output/WEB-INF/web-services.xml"
          serviceURI="${webss.service.url}"
          wsdlFile="./tmp/output/${webss.service.name}.wsdl" >
          <classpath>
          <pathelement location="./build" />
          <pathelement location="./build/classes/ws" />
          <pathelement location="./WebContent/WEB-INF/lib" />
          <pathelement path="${java.class.path}" />
          </classpath>
          </source2wsdd> 

No its not!. (According to your post)
Add "${server_classes}" to the path!
<classpath>
<pathelement location="${server_classes" />
<pathelement location="./build" />
<pathelement location="./WebContent/WEB-INF/lib" />
<pathelement path="${java.class.path}" />
</classpath>

Related

Error using wsdlc ANT task: NoClassDefFoundError

I'm trying to generate Java code from an existing WSDL using the wsdlc ant task.
I've added all weblogic libraries (as they were installed during weblogic installation) to the path in the ant build file.
<path id="weblogic.classpath">
     <fileset dir="lib">
     <include name="*.jar" />
</fileset>
</path>     
I've created the following taskdef for the wsdlc task:
<taskdef name="wsdlc"
classname="weblogic.wsee.tools.anttasks.WsdlcTask">
<classpath refid="weblogic.classpath" />
</taskdef>
And I've created the wsdlc target to execute:
<target name="generate-from-wsdl">
     <wsdlc
     srcWsdl="BS_LowTax_v01.wsdl"
     destJwsDir="src"
     destImplDir="src"
     packageName="com.everett.nl.taxservices"
     type="JAXWS"/>
</target>
When I run the generate-from-wsdl ant target, I run in to the following exception: java.lang.NoClassDefFoundError: weblogic/utils/classloaders/FilteringClassLoader
My first idea was that a library is missing. However as I already mentioned, I've added all libraries available from $BEA_HOME/wlserver_10.3/server/lib.
Anyone got a clue on what my problem is and how I can resolve it? Many thanks 
Hi,
seems your dir is a relative path, your should define it as bellow or you must run the build file at the $BEA_HOME/wlserver_10.3/server directory:
<path id="weblogic.classpath">
<fileset dir="$BEA_HOME/wlserver_10.3/serverlib">
<include name="*.jar" />
</fileset>
</path>
HTH,
Kevin 
Hi Chris,
It seems every thing is fine in your code snippet ...Except one Most important thing:
OK
<path id="weblogic.classpath">
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</path>
Above one is OK but in the "*generate-from-wsdl*"
-----------------
*"generate-from-wsdl" target the "classpath" attribute is missing*
Below one is OK
<target name="generate-from-wsdl">
<wsdlc
srcWsdl="BS_LowTax_v01.wsdl"
destJwsDir="src"
destImplDir="src"
packageName="com.everett.nl.taxservices"
type="JAXWS"
*classpath="${weblogic.classpath}"*
/>
</target> 
I am getting class not found error while generating java codes from wsdl file.
*******************
cu dmwls(338)$ ant generate-from-wsdl
Buildfile: build.xml
BUILD FAILED
file:/ffdt01/resmgt/kul/build.xml:14: taskdef class weblogic.wsee.tools.anttasks.WsdlcTask cannot be found
Total time: 1 second
cu dmwls(339)$ cat -n build.xml
1 <project default="all">
2 <property name="bea.home" value="/opt/bea/wls/8.1sp4" />
3 <property name="jdk.home" value="${bea.home}/jdk142_05" />
4 <property name="weblogic.home" value="${bea.home}/weblogic81" />
5
6 <path id="weblogic.classpath">
7 <fileset dir="${weblogic.home}/server/lib">
8 <include name="*.jar" />
9 </fileset>
10 </path>
11
12 <taskdef name="wsdlc"
13 classname="weblogic.wsee.tools.anttasks.WsdlcTask"
14 classpathref="weblogic.classpath" />
15
16 <target name="generate-from-wsdl">
17 <wsdlc
18 srcWsdl="/ffdt01/resmgt/kul/ksr.wsdl"
19 destJwsDir="/ffdt01/resmgt/kul"
20 destImplDir="/ffdt01/resmgt/kul"
21 classpathref="${weblogic.classpath}"
22 classpath="${weblogic.classpath}"
23 packageName="examples.webservices.wsdlc" />
24 </target>
25 </project>
*******************
I checked this class in weblogic.jar file using unzip command but there is no "WsdlcTask" class.
Is my weblogic.jar file is missing some required classes or there is something wrong with my build.xml file?
Please help.
Kuldeep 
Hi Kuldeep,
please refer to taskdef class not found while generating code from wsdl using ant
Thanks
Jay SenSharma 
Hi All,
I'm trying to generate Java code from an existing WSDL using the wsdlc ant task.
I've added all weblogic libraries (as they were installed during weblogic installation) to the path in the ant build file.
<property name="wclibs" value="${src.dir}/lib/weblogicLibs" />
<path id="project.class.path">
          <fileset dir="${wclibs}">
               <include name=".jar" />
          </fileset>
          <
     </path>
I've created the following taskdef for the wsdlc task:
<taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask">
          <classpath>
               <path refid="project.class.path" />
          </classpath>
     </taskdef>
     <taskdef name="wsdlc" classname="weblogic.wsee.tools.anttasks.WsdlcTask">
          <classpath>
               <path refid="project.class.path" />
          </classpath>
     </taskdef>
     <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy">
          <classpath>
               <path refid="project.class.path" />
          </classpath>
     </taskdef>
When I run the generate-from-wsdl ant target, I run in to the following Error:
javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.XMLOutputFactoryBase not found

Newbie - Need help with jwsc ant task - JavadocClassloadingException

Hi experts,
I am new to the weblogic jwsc environment.
I am using weblogic 10.
Ant verion: 1.7
I am trying to deploy a sample web service (User defined Types) as per the document.
I change the file BasicStruct.java to import a java.util.Vector type, hoping to test the behaviour.
However, when I ran ant build-service, i encountered the following exception:
BUILD FAILED
D:\Working\test\testCreateComplexSvc\myExamples\build-sample.xml:45: com.bea.util.jam.internal.javadoc.JavadocClassloadingException: An error has occurred while invoking javadoc to
inspect your source
files. This may be due to the fact that $JAVA_HOME/lib/tools.jar does
not seem to be in your system classloader. One common case in which
this happens is when using the 'ant' tool, which uses a special
context classloader to load classes from tools.jar.
I tried to make amendments to the ant task, as per recommended, and I added tools.jar, from JDK1.5.0_14, to the local lib folder.
My ant build.xml is as follow:
<project name="webservices-complex" default="all">
<!-- set global properties for this build -->
<property name="wls.username" value="weblogic" />
<property name="wls.password" value="weblogic" />
<property name="wls.hostname" value="localhost" />
<property name="wls.port" value="7001" />
<property name="wls.server.name" value="AdminServer" />
<property name="ear.deployed.name" value="complexServiceEAR" />
<property name="example-output" value="output" />
<property name="example-lib" value="lib" />
<property name="ear-dir" value="${example-output}/complexServiceEar" />
<property name="clientclass-dir" value="${example-output}/clientclass" />
<property environment="env."/>
<taskdef resource="net/jtools/classloadertask/antlib.xml"
classpath="${env.ANT_CLTASK_HOME}/ant-classloadertask.jar"/>
<path id="client.class.path">
<pathelement path="${clientclass-dir}"/>
<pathelement path="${java.class.path}"/>
</path>
<path id="project.classpath">
<pathelement location="${clientclass-dir}"/>
<pathelement location="${java.class.path}"/>
<pathelement location="{example-lib}/tools.jar"/>
</path>
<taskdef name="jwsc"
classname="weblogic.wsee.tools.anttasks.JwscTask" classpath="project.classpath"/>
<taskdef name="clientgen"
classname="weblogic.wsee.tools.anttasks.ClientGenTask" />
<taskdef name="wldeploy"
classname="weblogic.ant.taskdefs.management.WLDeploy"/>
<target name="all" depends="clean,build-service,deploy,client"/>
<target name="clean" depends="undeploy">
<delete dir="${example-output}"/>
</target>
<target name="build-service">
<jwsc
srcdir="src"
destdir="${ear-dir}"
keepGenerated="true"
classpath="{example-lib}/tools.jar"
>
<jws file="examples/webservices/complex/ComplexImpl.java" />
<classpath refid="project.classpath"/>
</jwsc>
</target>
<target name="deploy">
<wldeploy action="deploy"
name="${ear.deployed.name}"
source="${ear-dir}" user="${wls.username}"
password="${wls.password}" verbose="true"
adminurl="t3://${wls.hostname}:${wls.port}"
targets="${wls.server.name}"/>
</target>
<target name="undeploy">
<wldeploy action="undeploy" failonerror="false"
name="${ear.deployed.name}"
user="${wls.username}" password="${wls.password}" verbose="true"
adminurl="t3://${wls.hostname}:${wls.port}"
targets="${wls.server.name}"/>
</target>
<target name="client">
<clientgen
wsdl="http://${wls.hostname}:${wls.port}/complex/ComplexService?WSDL"
destDir="${clientclass-dir}"
packageName="examples.webservices.complex.client"/>
<javac
srcdir="${clientclass-dir}" destdir="${clientclass-dir}"
includes="**/*.java"/>
<javac
srcdir="src" destdir="${clientclass-dir}"
includes="examples/webservices/complex/client/**/*.java"/>
</target>
<target name="run" >
<java fork="true"
classname="examples.webservices.complex.client.Main"
failonerror="true" >
<classpath refid="client.class.path"/>
<arg line="http://${wls.hostname}:${wls.port}/complex/ComplexService"
/>
</java>
</target>
</project>
I've applied to "patch" to ant 1.6.5, because I understand after I run setDomainEnv.bat, the ANT_Home directory beomes the default that comes with BEA installation - D:\bea\modules\org.apache.ant_1.6.5.
However, I still encounter the same error.
Is my build.xml wrong?
Or is there something I did wrong?
Please advise.
Many thanks in advance.

source2wsdd failing

I get
[source2wsdd] source2wsdd: Cannot find doclet class weblogic.webservice.tools.ddgen.ServiceGen while running source2wsdd. I have in my ant classpath all the jars
My target in simplicity looks like below. Haev seen many people having this question but not resolved..
can someone help??
thanks
<path id="serverClasspath">
<fileset dir="C:/bea813/weblogic81/server/lib">
     <include name="**/*.jar"/>
     </fileset>
     <fileset dir="C:/bea813/weblogic81/common/lib">
          <include name="**/*.jar"/>
     </fileset>
     <fileset dir="C:/bea813/weblogic81/integration/lib">
          <include name="**/*.jar"/>
     </fileset>
     <fileset dir="./ejb">
          <include name="po.jar"/>
     </fileset>
     <pathelement location="${output_ear}"/>
     <pathelement location="${output_ear}/APP-INF/classes"/>
<pathelement location="${service_ejb_project}.jar"/>
<pathelement location="${service_ejb_project}"/>
</path>
<target name="webservice" depends="jarPo">
<!-- put the EJB JAR in the exploded EAR -->
<copy file="./ejb/${service_name}.jar" todir="${output_ear}" />
     
<!-- generate XML types from the Java value types in the service -->
<autotype javaComponents="po.PurchasingManagerLocal"
typeMappingFile="${output_ear}/APP-INF/classes/types.xml"
destDir="${output_ear}/APP-INF/classes"
packageName="${service_package}"
classpathref="serverClasspath"/>
<!-- build the service from the EJB and autotyper types -->
<source2wsdd
javaSource="PurchaseOrderService/service/PurchaseOrderServiceBean.java"
ddFile="${output_dir}/${service_name}-war/WEB-INF/web-services.xml"
typesInfo="${output_ear}/APP-INF/classes/types.xml"
serviceURI="/${service_name}"
wsdlFile="${output_dir}/${service_name}-war/${service_name}.wsdl"
classpathref="serverClasspath"/>
</target> 
adding to PATH the server/bin directory of weblogic solves this problem. ITs wierd but true
-Uday 
did you add server/bin to the path in ant or in your environment?

Generate a WS from a EJB

Hi....
I got a lot of probs.
in my Build.xml I have this code...
<servicegen
destEar="c:\myWebService.ear"
warName="myWAR.war"
contextURI="web_services" >
<service
javaClassComponents="ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoDB"
targetNamespace="http://localhost:7011/SIOPDV/"
serviceURI="/test"
serviceName="test">
</service>
</servicegen>
but I get an exception.. --> [copy] Copying 1 file to C:\SIOPDV20\conf
[servicegen] Generating service "test" ...
[servicegen] Could not load ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoDB. Is it in your classpath?
heeeeeellllllp :o( 
How about setting classpath in servicegen task:
i.e:
<target name="ear">
<servicegen keepGenerated="True" destEar="${source}/${ear_file}" warName="${war_file}">
<service javaClassComponents="examples.webservices.basic.javaclass.HelloWorld" targetNamespace="${namespace}" serviceName="HelloWorld" serviceURI="/HelloWorld" generateTypes="True" expandMethods="True">
<client packageName="examples.webservices.basic.javaclass" clientJarName="${client_jar_file}" />
</service>
<classpath>
<pathelement path="${build}" />
<pathelement path="${java.class.path}" />
<pathelement path="${source}/extra" />
</classpath>
</servicegen>
</target>
for more info, see the section of "Setting the Classpath for the WebLogic Ant Tasks" in http://edocs.bea.com/wls/docs81/webserv/anttasks.html#1063540
Jong 
I have this for the classpath...
<path id="SIOPDV.classpath">
          <pathelement location="${WLS.lib}/weblogic.jar"/>
          <pathelement location="${SIOPDV.lib}/grnds.jar"/>
          <pathelement location="${ORACLE.zipfile}"/>
          <pathelement location="${WLS.lib}/webservices.jar"/>
          
     </path>
Do I have tu put this
<classpath>
<pathelement path="${build}" />
<pathelement path="${java.class.path}" />
<pathelement path="${source}/extra" />
</classpath>
inside the servicegen tag? 
you need to add the "build" directory to classpath, i.e:
<path id="SIOPDV.classpath">
...
<pathelement path="${build}"/>
</path>
<servicegen>
...
<classpath refid="SIOPDV.classpath" />
</servicegen>
Also your message title is "Generate a WS from a EJB", if this is true, you need to use "ejbJar" insteadof "javaClassComponents" in "service" attribute.
Jong 
Guess what..... doesn´t work, I get this...BUILD FAILED
file:C:/SIOPDV20/build/build.xml:86: Could not load ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoGestEJB. Is it i
n your classpath?
check this changes...
<servicegen
destEar="c:\myWebService.ear"
warName="myWAR.war"
contextURI="web_services" >
<service
javaClassComponents="ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoGestEJB, ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoDB, ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoException, ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoGest, ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoGestEJB, ejb.com.pemex.siopdv.logica.catalogos.productos.ProductoGestHome, ejb.com.pemex.siopdv.beans.Producto"
targetNamespace="http://localhost:7011/SIOPDV/"
serviceURI="/test"
serviceName="test">
</service>
<classpath>
<pathelement path="${SIOPDV.build}" />
</classpath>
</servicegen>
below de build folder I have the ejb folder wich contains all the bussines logic and now I got this exception..
BUILD FAILED
java.lang.NoClassDefFoundError: ejb/com/pemex/siopdv/logica/catalogos/productos/ProductoGestEJB (wrong name: com/pemex/siopd
v/logica/catalogos/productos/ProductoGestEJB)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:488)...
Want to see my build file? 
Did you try to use "ejbJar" insteadof "javaComponentClass"? 
Yes, but it tells me tha there is something wrong with the Collection....
buildEAR:
[copy] Copying 1 file to C:\SIOPDV20\conf
[servicegen] Generating service "TraderService" ...
[servicegen] Generating XML types and serializers from ejb-jar (C:\SIOPDV20\dist\ejb.jar) ...
[servicegen] weblogic.xml.schema.binding.BindingException: Invalid class received: interface java.util.Collection loaded fro
m file:/C:/jdk1.3.1_03/jre/lib/rt.jar!/java/util/Collection.class. All classes that will be serialized or deserialized must
be non-interface, non-abstract classes that provide a public default constructor 
I tried with a very simple ejb in 8.1sp3:
public class HelloWorldBean implements SessionBean {
...
public Collection testCollection() {
return new ArrayList();
}
}
in my build.xml, I am doing the following, first run ejbc then feed the jar to servicegen.
<target name="ejb">
<delete dir="${build}" />
<mkdir dir="${build}"/>
<mkdir dir="${build}/META-INF"/>
<copy todir="${build}/META-INF">
<fileset dir="${source}">
<include name="ejb-jar.xml"/>
</fileset>
</copy>
<javac srcdir="${source}" includes="HelloWorld*.java" destdir="${build}" />
<jar jarfile="${ejb_jar_file}" basedir="${build}" />
<java classname="weblogic.ejbc" fork="no">
<arg line="-noexit ${ejb_jar_file}" />
</java>
</target>
<target name="ear" depends="ejb">
<servicegen
destEar="${build}/${ear_file}"
warName="${war_file}">
<service
ejbJar="${ejb_jar_file}"
targetNamespace="${namespace}"
serviceName="HelloWorldEJB"
serviceURI="/HelloWorldEJB"
     generateTypes="True"
expandMethods="True">
<client packageName="examples.webservices.basic.statelessSession"
clientJarName="${client_jar_file}"
/>
</service>
</servicegen>
</target>

Include jar in the war generated by jwsc

Hello,
How can i add jar's in the war archive generated by jwsc ?
Regards,
Fabrice 
The sub-element zipfileset in jwsc task can pack the file into target war.
Here is a snippet:
<jwsc ...>
<jws ...>
<zipfileset dir="." prefix="WEB-INF/lib">
<include name="your.jar"/>
</zipfileset>
</jws>
</jwsc>
HTH,
-kevin 
HI,
Code given by the Kaven is absolutely correctly you can try that particular script it will work.
Regards,
Kal. 
Weblogic 9.2 does not support zip need to add sepate task like below
<project name="webservices-complex" default="build-service">
     
<path id="dependencyfinder">
<pathelement location="C:/bea/weblogic92/server/lib/weblogic.jar"/>
</path>
     <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask">
          <classpath refid="dependencyfinder"/>
     </taskdef>
     <target name="build-service">
          <jwsc srcdir="src"
               destdir="." keepGenerated="true" verbose="on" debug="true"
               debuglevel="lines,vars,source"
               listfiles="true" classpathref="dependencyfinder">
               <classpath>
               <pathelement path="${java.class.path}" />
               <pathelement path="c:/CustInfo.jar" />
               </classpath>               
               <jws file="ServiceConsumer.java" >
     
               </jws>
          </jwsc>
          <zip destfile="ServiceConsumer.war" update="true">
               <zipfileset dir="src" prefix="docs/user-guide"/>
               <zipfileset dir="build" prefix="build"/>
               <zipfileset dir="Webcontent/WEB-INF/lib" includes="CustInfo.jar" fullpath="WEB-INF/lib/CustInfo.jar"/>
          </zip>
          
     </target>
</project>

Categories

Resources