Believe it or not, you DO want to exclude the file...
There are really two things happening: 1) EJBJAR is packing up the
*generic* jar file and 2) A sub-task is doing all the Weblogic specific
stuff. The exclude file is telling EJBJAR not to mistake the weblogic xml
file for an ejb-jar.xml file and try to make a separate bean out of it.
I've spent the last few days banging my head on the rock of EJBJAR and have
FINALLY gotten it working after much code reading and debugging (go open
source!).
Two notes:
1) Download the latest CVS code and compile it (using ant, naturally). I
could never get the released code to work.
2) If you have any container managed persistence entity beans, you will
want to flatten your directories before you start EJBJAR.
What I do is copy all my xml files to the same directory using the copy
task with flatten="yes". This of course assumes that you are using the
naming convention for your XML files and letting EJBJAR scan through them
(see the /ant/docs/ejb.html file for more info). If you don't flatten the
directories, then EJBJAR can't find the *-weblogic-cmp-rdbms-ejb-jar.xml
file (or whatever you call it in your *-weblogic-ejb-jar.xml file's
<type-storage> element).
Hope this helps,
jeffa
At 11:20 AM 12/13/00 -0800, you wrote:
>Geno,
> Two things I noticed here.
>1. The error seems to be that you're missing weblogic-ejb-jar.xml in your
>jar file.
>2. One of the lines of your build is the following:
> <exclude name="**/weblogic*.xml"/>
>3. The string "weblogic-ejb-jar.xml" matches your exclude pattern.
>
>I bet if you remove that line, and change
><include name="**/ejb-jar.xml"/>
>
>to
>
><include name="**/*ejb-jar.xml"/>
>
>it will probably work.
>
>Matt
>
>
>
>
>-----Original Message-----
>From: Gero Vermaas [mailto:Gero.Vermaas@sun.com]
>Sent: Wednesday, December 13, 2000 2:09 AM
>To: ant-user@jakarta.apache.org
>Subject: Ant EjbJar task problem
>
>
>Hi All,
>
>I'm using Ant in a project for quite a while and we had developed our own
>EJBJAR task. I recently discovered that the Ant1.2 distribution contains an
>EJB task that does exactly what we need: thanks for the good work!
>
>Unfortunately I can't get it to work for our situation and I think i'm
>making a simple mistake somewhere. Could you take a look at the following?
>
>The target I use in the Ant build xml file is as follows:
>
> <target name="ejbc" depends="compile">
> <mkdir dir="${ejblib.dir}"/>
> <ejbjar srcdir="${classes.dir}" descriptordir="${src.dir}" >
> <weblogic destdir="${ejblib.dir}" classpath="${java.class.path}" />
> <include name="**/ejb-jar.xml"/>
> <exclude name="**/weblogic*.xml"/>
> </ejbjar>
> </target>
>
>The classfiles of the ejbs are in the ejblib.dir subdirectories and the
>describtors in the src.dir subdirectories. When I run ant I get the
>following output:
>==========
> [ejbjar] deleting generic jar
>D:\usr\DemoDevEnv\build\ejblib\com\cgeyc\bankin
>g\bfl\icp\ems\accountgroup\ejb-generic.jar
> [ejbjar] descriptorFileName:
>com\cgeyc\banking\bfl\icp\ems\corporation\ejb-ja
>r.xml
> [ejbjar] File.separator: \
> [ejbjar] baseNameTerminator: -
> [ejbjar] usingBaseJarName(): false
> [ejbjar] baseName: com\cgeyc\banking\bfl\icp\ems\corporation\ejb
> [ejbjar] getBaseNameTerminator(): -
> [ejbjar] ddPrefix: com\cgeyc\banking\bfl\icp\ems\corporation\ejb-
> [ejbjar] WL_DD: weblogic-ejb-jar.xml
> [ejbjar] Checking for file:
>D:\usr\DemoDevEnv\src\com\cgeyc\banking\bfl\icp\e
>ms\corporation\ejb-weblogic-ejb-jar.xml
> [ejbjar] building ejb.jar with 4 files
> [ejbjar] adding file
>'com\cgeyc\banking\bfl\icp\ems\corporation\CorporationBe
>an.class'
> [ejbjar] adding file 'META-INF/ejb-jar.xml'
> [ejbjar] adding file
>'com\cgeyc\banking\bfl\icp\ems\corporation\CorporationHo
>me.class'
> [ejbjar] adding file
>'com\cgeyc\banking\bfl\icp\ems\corporation\Corporation.c
>lass'
> [ejbjar] Calling weblogic.ejbc for
>D:\usr\DemoDevEnv\build\ejblib\com\cgeyc\b
>anking\bfl\icp\ems\corporation\ejb-generic.jar
> [java] Forking java -classpath
>D:\weblogic\lib\weblogic510sp5boot.jar;D:\we
>blogic\lib\weblogic510sp5.jar;D:\weblogic\license;D:\weblogic\lib\weblogicau
>x.ja
>r;D:\weblogic\classes;D:\usr\DemoDevEnv\build\classes;D:\java\jdk1.2.2\lib\t
>ools
>.jar;D:\java\jakart~1\lib\ant.jar;D:\java\jakart~1\lib\parser.jar;D:\java\ja
>kart
>~1\lib\jaxp.jar;D:\java\junit\junit3.2\junit.jar weblogic.ejbc -noexit
>D:\usr\De
>moDevEnv\build\ejblib\com\cgeyc\banking\bfl\icp\ems\corporation\ejb-generic.
>jar
>D:\usr\DemoDevEnv\build\ejblib\com\cgeyc\banking\bfl\icp\ems\corporation\ejb
>.jar
>
> [java] weblogic.utils.compiler.ToolFailureException: ERROR:
>weblogic-ejb-ja
>r.xml was not found in the jar file.
> [java] at weblogic.ejbc.runBody(ejbc.java, Compiled Code)
> [java] at weblogic.utils.compiler.Tool.run(Tool.java:80)
> [java] at weblogic.ejbc.main(ejbc.java:365)
> [java] Java Result: 1
>================
>
>Note: I added some extra log messages to the WebLogicDeploymentTools class.
>
>It reports that the weblogic-ejb-jar.xml file is not included in the generic
>jar file. I checked the generic jar file, and it is not included.
>
>The directory containing the descriptor files looks like this (all other ejb
>directories are similar):
>
> Directory of
>D:\Usr\DemoDevEnv\src\com\cgeyc\banking\bfl\icp\ems\corporation
>
>09/29/2000 15:03 <DIR> .
>09/29/2000 15:03 <DIR> ..
>09/29/2000 13:50 672 Corporation.java
>09/29/2000 11:55 1,712 CorporationBean.java
>09/29/2000 11:55 606 CorporationHome.java
>09/29/2000 15:10 1,169 ejb-jar.xml
>12/08/2000 10:19 612 weblogic-ejb-jar.xml
> 5 File(s) 4,771 bytes
> 2 Dir(s) 973,287,424 bytes free
>
>However, I can't get the EjbJar task to include weblogic-ejb-jar.xml. I
>tried several combinations of in/exclude tags bu nothing seems to work.
>
>Do you have any idea what I'm doing wrong? Any help is greatly appreciated.
>
>Regards,
>
>Gero Vermaas
|