You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "KULKARNI, VIKRAM" <vi...@hp.com> on 2004/07/12 14:43:12 UTC

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\workshop\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