Adding all the classes and external jars in webservice WAR using servicegen - weblogic.developer.interest.webservices.general(Archived)

Can someone please tell me how do I include all the classes and my external jar files to the ear/war file that is created using servicegen. I don't see any option in servicegen tag where I can include my classes and jar files to the ear/war file. The war it creates only contains the web service implementation class but I want to all the classes in the service code and jars in the same war. Any ideas on how to do that instead of putting in the classpath.
here is the snippet of my build file
        <pathelement path="${classes}"/>
        <pathelement path="${lib}/*.jar"/>
     <pathelement path="C:/bea/weblogic92/server/lib/webserviceclient.jar"/>

Any ideas thanks 

Hi, Iìve got the same problem..I'd like to know if you found a solution. Thanks 

The work around I am using to overcome this problem is Unzipping th ear/war file created by servicegen task and including all the classes. Then creating the ear file again by creating a new ant target.
I know this is not a neater way, but this works for me. 

Have you resolved the issue?
If not, I have a complex solution.
The basic idea is using an EJB jar, instead of simple java class, in your servicegen. Then you will be able to add your classes and external jar files to your ear file and execute them.


servicegen ant task....

I am trying to run servicegen and keep on getting a NoClassDefFoundError on a class which is contained in a jar file which is referenced in the javaClassComponent (web service class).
here is my build.xml...this is absolutely driving me nuts!! I even print out my classpath before hand and sure enough, the jar file I need is in the path. Here is the kicker...if I extract the one class file that it's not finding and have just the class file in my dir structure, it works's as if the classpath tag is completely being ignored!! please help...thanks!
<taskdef name="servicegen" classpathref="class.path"
<target name="whatever">
<servicegen desEar="somewhere.ear" warName=somewhere.war"
<classpath redif="class.path"/>
<service javaClassComponents="myclass"
did you ever find the solution to this one?
I am also getting the same error. But when I use ant after setting the environment using setEnv.cmd from examples it works fine.
why would it not take the classpathref attribute?
<path id="weblogic.class.path">
<pathelement location="${zip.development.lib.root}/webservices.jar"/>          </path>
<taskdef name="servicegen" classpathref="weblogic.class.path"     classname="weblogic.ant.taskdefs.webservices.servidegen.ServiceGenTask"/> 
It's because of how BEA WebLogic deals with class paths. It gives preference to its configured pathing which is set by the setEnv.cmd rather than any environment variables that you may or may not have set up in the operating system.
There are ways to influence the search paths of the application server but the thing to keep in mind is that it gives preference to its own paths.
Message was edited by:

wsdlc in maven2

I've been trying to execute the wsdlc ant task in Weblogic 9.1 inside Maven2, but I just get ClassNotFoundException (
Strangely, this class is not to be found in any of the weblogic-jars???
If I use ant directly, the result will be the same, but if I set weblogic.jar in the CLASSPATH environment-variable there's no problem.
Since Maven has its own classloading-system and doesn't use the CLASSPATH environment, this work-around doesn't work.
I've tried sett classpathref and bootclasspathref both in the taskdef and the wsdlc task, but nothing works.
Is there somebody who has stumbled on the same problem? 
Had a simular problem using jwsc from maven2.
Solved it by using the ANT bundled with Weblogic Server and keeping the weblogic and webservices.jar in their place (WL_HOME/lib).
In your pom.xml you should assign a system-scope dependency to weblogic.jar, webservices.jar and WL_HOME/lib/ant/ant.jar.
In yor build.xml create two targets:
<target name="default">
<java fork="true" classname="" failonerror="true">
<fileset dir="${java.home}/..">
<include name="**/tools.jar"/>
<!-- maven.classpathref is assigned to maven.compile.classpath in pom.xml -->
<path refid="${maven.classpathref}"/>
<arg line="$-f ${basedir}/build.xml run-bea-ant-task"/>
<target name="run-bea-ant-task">
<!-- call wsdlc -->
Well, I solved it in simular way. Instead of using the java-task i used the exec-task. But still, it's not the way it should be done.
Maybe the problem is solved in the next version of the Weblogic Server. 
Hi Helgeaa,
Can you please send us how did u wrote jwsc command in maven pom.xml i have declared dependency for weblogic.jar,webservice.jar,tools.jar and ant.jar in the pom.xml
i didn't understood where shall we write the jwsc task in pom.xml
Can you please help me out from this problem.
Thanks in advance

ServiceGen fails to package necessary classes

Hi, guys,
When I tried to generate ears with ServiceGen, I found some classes were lost in the war package.
Class demo.Hello implements an Interface demo.HelloI. However, HelloI.class is not in the ear package. Only Hello.class is there.
Anybody knows about it? Thank you in advanced!
Here's my build script:
<target name="ear">
<servicegen destEar="build/HelloWS.ear" contextURI="WSDemo" warName="HelloWS.war">
<service javaClassComponents="demo.Hello"                     targetNamespace="http://demo"                     serviceName="Hello" serviceURI="/HelloWS"
          generateTypes="True" expandMethods="True"
          style="documentwrapped" >
<pathelement path="bin" />
I try this solution for your problem in
javaClassComponents try giving both your interface and implementation class seperated by commas or just create jar file of those and try to pass it as input instead of javaClassComponenets.

Putting web service in an ear file

I am using the jwsc ANT to to create a web service. The docs say by default it creates an exploded directory. I don't want an exploded directory, I would rather have an ear file. I see that the jwsc task has an explode attribute, but setting that to false has no affect (actually I see no difference in behavior whether I set that to true or false).
So how can I get it into an ear file?
I would rather have the ear file because I am having no luck deploying an exploded directory with the wldeploy ant task. It claims it can't find any application files:
[Deployer:149003]Unable to access application source information in '/java_projects/vacd-webservices/dist/RealtimeStatsEar' for application 'RealtimeStats'. The specific error is: No application files exist.
<target name="build-realtimestats-service" depends="clean">
<taskdef name="jwsc" classname=""/>
<jwsc srcdir="src/java" destdir="${distdir}/RealtimeStatsEar">
<jws file="com/wic/vacd/wsimpl/realtimeStats/"/>
<target name="deploy-realtimestats-service-devel">
<taskdef name="wldeploy" classname=""/>
<wldeploy action="deploy"
adminurl="removed for security">
targets="7001" />
Under the dist directory exists a directory named RealtimeStatsEar that contains a war file (under the appropriate package path), a META-INF directory and a APP-INF directory. Both those directories contain the appropriate descriptor files so I really don't know why it claims it can't find the files.
I have followed the docs exactly and am having no luck deploying this thing.
This is with Weblogic 9.0. 
Just want to mention that I do see a difference when I use the explode attribute on the jws task (its not on the jwsc task like I mentioned before).
The war file containing the service is expanded.

Interrogating modules in ear file

Is there a way I can find information about an (undeployed) .ear files modules, perhaps by interrogating the application.xml file within it???
Yes, the easiest way would be to just open the application.xml and read the module elements from it.
-- Rob
WLS Blog 
You can automate the process as an ANT script checklist, using the wlconfig task provided by weblogic Ant along with "query" subtask.
A simple example is:
<wlconfig url="${WLS_URL}" username="${WLS_USER}" password="${WLS_PWD}">
<query domain="${WLS_DOMAIN}" type="Application" name="your_application_name_as_given_on_console_while_deploying" property="any_name_to_store_result" />
<isset property="any_name_to_store_result"/>
               <echo message="The application $MYAPP is deployed."/>
<echo message="WARNING: The application $MYAPP is NOT deployed." />
Hope this helps.
Rommel Sharma