users@jax-rpc.java.net

Re: problem with ANT

From: Arun Gupta <Arun.Gupta_at_Sun.COM>
Date: Mon, 15 Mar 2004 08:18:27 -0800

Hi Ratna,

There is no need to modify the wscompile.bat script, all the classpath
in the script is set correctly. You only need to specify the location of
your class files via -classpath as follows ...

java -classpath <your classes directory> <any other options you need>
config.xml

Few other points ...

- I see there is a typo in the classpath, missing "\" for the first
element in classpath.
- bin directory is not required to be in the classpath, unless you've
generated some classes in that directory (which is not recommended)
- rmid, rmi are not required to be in the classpath
- In generate-server target, compile.classpath is defined as a reference
classpath should be not be used as classpath="${compile.classpath}" .
Instead the correct usage is <classpath refid="compile.classpath" />. So
remove classpath="${compile.classpath} from generate-server target.

I'd recommend you to go through JWSDP 1.3 tutorial. The tutorial has
pretty extensive examples with build.xml clearly explained. Hopefully
that will help you answer your questions.

Thanks,
-Arun


ratna sudha wrote:

> hai
> i tried wscompile in the format
> wscompile -gen:client -classpath c:\jwsdp-1.3\jaxrpc\echo\classes
> config.xml
> i got the same error:RmiModeler error:java.lang.ClassNotFoundException
> :echo$EchoIF
> and regarding ANT tool i've included all the jaxrpc related jar files
> in the classpath.here is the classpath:
> set
> classpath=%classpath%;c:jwsdp-1.3\jaxrpc\bin;c:\jwsdp-1.3\jaxrpc\echo;c:\jwsdp-1.3\common\lib\servlet-api.jar;c:\jwsdp-1.3\jaxrpc\lib\jaxrpc-api.jar;c:\jwsdp-1.3\jaxrpc\lib\jaxrpc-impl.jar;c:\jwsdp-1.3\jaxrpc\jaxrpc-spi.jar;c:\jwsdp-1.3\saaj\lib\saaj-api.jar;c:\jwsdp-1.3\saaj\lib\saaj-impl.jar;c:\jwsdp-1.3\jaxp\lib\jaxp-api.jar;c:\jwsdp-1.3\jaxp\lin\endorsed\dom.jar;c:\jwsdp-1.3\jaxp\lin\endorsed\sax.jar;c:\jwsdp-1.3\jaxp\lin\endorsed\xalan.jar;c:\jwsdp-1.3\jaxp\lin\endorsed\xercesImpl.jar;c:\jwsdp-1.3\jwsdp-shared\lib\activation.jar;c:\jwsdp-1.3\jwsdp-shared\lib\mail.jar;c:\jwsdp-1.3\jwsdp-shared\lib\jax-qname.jar;c:\jwsdp-1.3\jwsdp-shared\lib\namespace.jar;c:\jwsdp-1.3\jwsdp-shared\lib\xsdlib.jar;c:\jwsdp-1.3\jwsdp-shared\lib\relaxngDatatpe.jar;c:\program
> files\j2sdk_nb\j2sdk1.4.2\bin\rmid;c:\program
> files\j2sdk_nb\j2sdk1.4.2\jre\lib\rmid;c:\program
> files\j2sdk_nb\j2sdk1.4.2\java\rmi;c:\jwsdp-1.3\apache-ant\bin;c:\jwsdp-1.3\apache-ant\lib\ant.jar;
> running this ant tool i got these errors:
> Build file:build.xml
> init:
> [echo]-------------Echo Sample-------
> prepare:
> generate-server:
> edit-config:
> BUILD FAILED
> java.lang.NoClassDefFoundError:com/sun/xml/rpc/spi/tools/CompileTool
> at java.lang.ClassLoader.defineClass0(native method)
> at java.lang.ClassLoader.defineClass(classLoader.java.537)
> at java.security.SecureClassLoader.defineClass(secureClassLoader.java:12)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
> at java.net.URLClassLoader.access$100(URLClassLoader.java.55)
> at java.net.URLClassLoader$1.run(URLClassLoader.java.194)
> at java.net.URLClassLoader.findClass(URLClassLoader.java.187)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
> at java.lang.ClassLoader.loadClassinternal(C;lassLoader.java:302)
> at com.sum.xml.rpc.tools.ant.Wscompile.execute(Wscompile.java:685)
> at org.apache.tools.ant.Task.perform(Task.java:341)
> at org.apache.tools.ant.Target.execute(Target.java:309)
> at org.apache.tools.ant.Target.performtask(Target.java:336)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
> at org.apache.tools.ant.Main.runBuild(Main.java:609)
> at org.apache.tools.ant.Main.start(Main.java:198)
> at org.apache.tools.ant.Main.main(Main.java:235)
> com/sun/xml/rpc/spi/tools/CompileTool
>
> here is build.xml
> <?xml version="1.0" ?>
> - <!--
> Copyright 2003 Sun Microsystems, Inc. All rights reserved.
> SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
>
> -->
> - <project name="HelloWorld" default="deploy-war" basedir=".">
> <property file="build.properties" />
> <property name="endpoint"
> value="http://localhost:8080/jaxrpc-HelloWorld/hello" />
> <property name="server.port.url"
> value="http://localhost:8080/jaxrpc-HelloWorld/hello" />
> <property name="appname" value="${ant.project.name}" />
> <property name="source.home" value="${samplesbuild}/${appname}/src" />
> <property name="compile.debug" value="true" />
> <property name="compile.optimize" value="false" />
> <property name="config.rpcenc.file" value="${basedir}/etc/config.xml" />
> <property name="model.rpcenc.file" value="model-wsdl-rpcenc.xml.gz" />
> <property name="webapp.webxml" value="${basedir}/etc/web.xml" />
> - <path id="compile.classpath">
> <pathelement location="${javamail.jar}" />
> <pathelement location="${jaf.jar}" />
> <pathelement location="${jaxp-api.jar}" />
> <pathelement location="${dom.jar}" />
> <pathelement location="${sax.jar}" />
> <pathelement location="${xalan.jar}" />
> <pathelement location="${xercesImpl.jar}" />
> <pathelement location="${jaxrpc-api.jar}" />
> <pathelement location="${jaxrpc-spi.jar}" />
> <pathelement location="${jaxrpc-impl.jar}" />
> <pathelement location="${saaj-api.jar}" />
> <pathelement location="${saaj-impl.jar}" />
> <pathelement location="${relaxngDatatype.jar}" />
> <pathelement location="${xsdlib.jar}" />
> <pathelement location="${jax-qname.jar}" />
> <pathelement location="${ant.jar}" />
> </path>
> - <taskdef name="wscompile"
> classname="com.sun.xml.rpc.tools.ant.Wscompile">
> <classpath refid="compile.classpath" />
> </taskdef>
> - <taskdef name="wsdeploy" classname="com.sun.xml.rpc.tools.ant.Wsdeploy">
> <classpath refid="compile.classpath" />
> </taskdef>
> - <target name="init">
> <echo message="-------- ${appname} Sample --------" />
> </target>
> - <target name="build" depends="build-war">
> <echo message="Building...." />
> </target>
> - <target name="prepare" depends="init">
> <mkdir dir="${buildhome}" />
> <mkdir dir="${samplesbuild}/${appname}/classes" />
> <mkdir dir="${samplesbuild}/${appname}/classes/server" />
> <mkdir dir="${samplesbuild}/${appname}/classes/client" />
> </target>
> - <target name="generate-client" depends="prepare">
> - <antcall target="edit-config">
> <param name="config.rpcenc.file" value="${config.rpcenc.file}" />
> </antcall>
> - <wscompile keep="true" client="true"
> base="${samplesbuild}/${appname}/classes/client"
> xPrintStackTrace="true" verbose="false"
> classpath="${compile.classpath}" config="${config.rpcenc.file}">
> - <classpath>
> <path refid="compile.classpath" />
> </classpath>
> </wscompile>
> - <antcall target="unedit-config">
> <param name="config.rpcenc.file" value="${config.rpcenc.file}" />
> </antcall>
> </target>
> - <target name="generate-server" depends="prepare">
> - <antcall target="edit-config">
> <param name="config.rpcenc.file" value="${config.rpcenc.file}" />
> </antcall>
> - <wscompile keep="true" import="true"
> base="${samplesbuild}/${appname}/classes/server"
> xPrintStackTrace="true" verbose! ="false"
> model="${samplesbuild}/${appname}/${model.rpcenc.file}"
> classpath="${compile.classpath}" config="${config.rpcenc.file}">
> - <classpath>
> <path refid="compile.classpath" />
> </classpath>
> </wscompile>
> - <antcall target="unedit-config">
> <param name="config.rpcenc.file" value="${config.rpcenc.file}" />
> </antcall>
> </target>
> - <target name="compile-server" depends="generate-server">
> - <javac srcdir="${samples.home}/${appname}/src/server"
> destdir="${samplesbuild}/${appname}/classes/server"
> debug="${compile.debug}">
> <classpath refid="compile.classpath" />
> </javac>
> </target>
> - <target name="create-war" depends="compile-server">
> - <war warfile="${samplesbuild}/${appname}/jaxrpc-${appname}-raw.war"
> webxml="${webapp.webxml}">
> <webinf dir="${basedir}/etc/" includes="*.wsdl,jaxrpc-ri.xml" />
> <webinf dir="${basedir}/etc/" includes="${webapp.jaxrpc.file}"
> defaultexcludes="no" />
> <webinf dir="${samplesbuild}/${appname}"
> includes="${model.rpcenc.file}" defaultexcludes="no" />
> <classes dir="${samplesbuild}/${appname}/classes/server"
> includes="**/*.class" defaultexcludes="no" />
> </war>
> <delete dir="${samplesbuild}/${appname}/classes/server" />
> </target>
> - <target name="build-war" depends="create-war">
> <echo message="-------- ${appname} --------" />
> - <wsdeploy keep="true"
> inWarFile="${samplesbuild}/${appname}/jaxrpc-${appname}-raw.war"
> outWarFile="${samplesbuild}/${appname}/jaxrpc-${appname}.war"
> verbose="true">
> <classpath refid="compile.classpath" />
> </wsdeploy>
> </target>
> - <target name="deploy-war" depends="build-war">
> <copy file="${samplesbuild}/${appname}/jaxrpc-${appname}.war"
> todir="${samples.home}/${appname}" />
> </target>
> - <target name="compile-client" depends="generate-client">
> - <javac srcdir="${samples.home}/${appname}/src/client"
> destdir="${samplesbuild}/${appname}/classes/client"
> debug="${compile.debug}" optimize="${compile.optimize}">
> <classpath refid="compile.classpath" />
> </javac>
> </target>
> - <path id="run.classpath">
> <path refid="compile.classpath" />
> <pathelement location="${samplesbuild}/${appname}/classes/client" />
> </path>
> - <target name="run-client" depends="compile-client">
> - <java classname="hello.HelloClient" classpathref="run.classpath"
> fork="true">
> <sysproperty key="endpoint" value="${endpoint}" />
> <arg value="${server.port.url}" />
> </java>
> </target>
> - <target name="clean">
> <delete dir="${buildhome}" />
> <delete dir="${samplesbuild}/${appname}" />
> </target>
> - <!-- @param: config.file - file to be edited
> -->
> - <target name="edit-config">
> <replace file="${config.rpcenc.file}" token="location=""
> value="location="${basedir}/" />
> </target>
> - <!-- @param: config.file - file to be edited
> -->
> - <target name="unedit-config">
> <replace file="${config.rpcenc.file}" token="location="${basedir}/"
> value="location="" />
> </target>
> </project>
>
>
> i am not able to find out the problem.plz help me.
> thanking u
> sudha.
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Yahoo! Search - Find what you’re looking for faster.
> <http://search.yahoo.com/?fr=ad-mailsig-home>


-- 
got Web Services ?
Download Java Web Services Developer Pack from
http://java.sun.com/webservices
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net