ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <david.k...@wamu.net>
Subject RE: running Weblogic ejbgen and ejbc: dependency on preshipped Ant version
Date Mon, 12 Jul 2004 14:59:10 GMT
There's one problem with this that you can solve, and one that you
likely cannot.

In order to use an "external" Ant distribution (not the one inside
WebLogic), your build scripts have to include the "taskdef" lines that
specify the task class for each class, and you have to put
"weblogic.jar" (and possibly "webservices.jar") into your $ANT_HOME/lib
directory.  One trick with writing the "taskdef" lines is that it's not
very obvious what class the task is supposed to be using.  You'll have
to browse through "weblogic.jar" looking for classes named "*Task" to
narrow this down.  Some of them are obvious once you do this, some of
them are not.

However, this only gives you the ability to use an external Ant 1.5.3
distribution.  Some (all?) of the Weblogic Ant tasks simply will not
work with Ant 1.6.1.  I haven't dug deep enough to find out why.  They
just will not work.

> -----Original Message-----
> From: KULKARNI, VIKRAM [mailto:vikram.kulkarni@hp.com] 
> Sent: Monday, July 12, 2004 5:43 AM
> To: user@ant.apache.org
> Subject: running Weblogic ejbgen and ejbc: dependency on 
> preshipped Ant version
> 
> 
> Hi ant-users,
>   I'm using Apache Ant version 1.5.3 compiled on August 13 
> 2003 which comes preshipped with Weblogic 8.1 I have the 
> following task to perform ejbgen which is a weblogic specific 
> task to generate EJB sources. I then use the ejbc task to 
> compile and create EJB jar file out of the sources.
> 
> Unfortunately, these task only works with Ant version 1.5.3 
> which comes preshipped with Weblogic 
> (bea\weblogic81\server\bin) I'm unable to make the same tasks 
> to work using ant 1.6.1(independent ant installation). ant is 
> unable load the classes and complains as shown below:
> 
> ejbgen:
>      [echo] Building to temporary directory 
> D:\BeaProjects\smartER\build/wlw_sma
> rtEREJB_build...
>      [echo] Running EJBGen...
>      [echo] Using EJBC CLASSPATH      = 
> D:\bea\weblogic81\common\lib\log4j.jar;D
> :\bea\weblogic81\server\lib\weblogic.jar;D:\bea\weblogic81\wor
> kshop\extensions\w
> ls.jar
>    [ejbGen] weblogic.home not defined, compilation may not 
> find weblogic classes
> 
> 
> BUILD FAILED
> java.lang.NoClassDefFoundError: weblogic/utils/FileUtils
> 
> Here's my build.xml snippet:
> 
> 	<property name="project.name"  	value="smartEREJB"/>
> 	<property name="ejb.outputJar" 	value="${project.name}.jar"/>
> 
> 	<!-- Create the EJBC class path -->
> 	<path id="ejbc.classpath">
> 		<fileset dir="${WL_HOME}">
> 			<include name="workshop/extensions/wls.jar"/>
> 			<include name="server/lib/weblogic.jar"/>
> 			<include name="common/lib/log4j.jar"/>
> 		</fileset>
> 	</path>
>  	<property name="ejbc.classpathString" refid="ejbc.classpath"/>
> 
>  	<taskdef name="ejbc" classname="weblogic.ant.taskdefs.j2ee.Ejbc"
>    		classpathref="ejbc.classpath"/>
>    		
>  	<taskdef name="ejbGen" classname="com.bea.wls.build.Ejbgen"
>    		classpathref="ejbc.classpath"/>
>    		
> 	<target name="ejbgen" depends="check-env, clean-ejb, common-jar"
> 		description="Build EJB Jar" >
>    		<echo message="Building to temporary directory 
> ${ejb.build.path}..."/>
> 
>    		<echo message="Running EJBGen..."/>
>    		<echo message="Using EJBC CLASSPATH      = 
> ${ejbc.classpathString} "/>
>    		<ejbGen keepgenerated="false" 
>    				tmpdir="${ejb.build.path}"	/>
>    		
>    		<!-- don't continue with build if no EJBs, but 
> don't fail either -->
>    		<antcall target="post-ejbgen"/>
>  	</target>
>  
>  	<target name="post-ejbgen" >
>    		<echo message="EJBGen ok.  Compiling..."/>
>    		<echo message="Using PROJECT CLASSPATH         
> = ${classpathString} "/>
>    		<javac srcdir="${ejb.src.dir};${ejb.build.path}" 
>    			destdir="${ejb.build.path}"
>    		 	includes="**/*.java" 
>    		 	compiler="${java.compiler}" 
>    		 	debug="${ejb.debug}"
>         	deprecation="${deprecation}" >
>    		 	<classpath>
> 				<path refid="project.classpath"/>
> 			   	<pathelement 
> location="${ejb.build.path}"/>
> 			</classpath>
>     	</javac>
> 
>     	<echo message="All files compiled.   Running ejbc..."/>
>    		<echo message="Using PROJECT CLASSPATH         
> = ${classpathString} "/>
>     	<ejbc source="${ejb.build.path}" 
>     		target="${ejb.build.path}"
>      		compiler="javac" 
>      		keepgenerated="true" 
>      		debug="${ejb.debug}"
>      		disableHotCodeGen="${ejb.debug}" >
> 	 		<classpath>
> 				<path refid="project.classpath"/>
> 		   		<pathelement 
> location="${build.dir}/common.jar"/>
> 			</classpath>
> 		</ejbc>
> 
> Although the class weblogic/utils/FileUtils is present inside 
> weblogic.jar as displayed by my echo message "Using EJBC 
> CLASSPATH ......", ant still doesn't load it.
> 
> Resolution: I was able to solve this problem by copying 
> wls.jar and weblogic.jar into lib directory of my ant 
> installation. In addition, I also had to copy 
> bea\weblogic81\server\lib\persistence directory which the 
> ejbc task expects.
> 
> I thought that this(copying jars to Ant's lib directory) is a 
> wrong way and would like to avoid doing so. Also, I was 
> curious to know why Weblogic Workshop looks for this 
> persistence.install file. 
> 
> Ideally, I would like the ejbc task to run using an 
> independent ant installation (and not the one preshipped with 
> weblogic) Any hints to resolve this problem?
> 
> Thanks & regards,
> Vikram
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message