You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Daniel CAUNE <da...@in-fusio.com> on 2001/08/20 12:07:21 UTC

HELP: ejbjar tag and EJB exception.

Dear all,

I have a little problem with my EJB JAR file creation, using the ejbjar
tag. Some of my EJB have their own exception (derived obviously from
EJBException), but the corresponding exception class is not included
automatically in the EJB JAR file :

 <!-- Create the EJB JAR files -->
 <target name="ejbjar" depends="compile">
   <ejbjar descriptordir="${res}"
	   destdir="${lib}"
           srcdir="${classes}">
     <classpath refid="project.class.path"/>
     <include name="**/*-ejb-jar.xml"/>
     <exclude name="**/*jboss*.xml"/>
     <jboss destdir="${lib}"/>
     <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
1.1//EN"
          location="http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd"/>
     <dtd publicId="-//JBoss//DTD JBOSS//EN"
          location="http://www.jboss.org/j2ee/dtd/jboss.dtd"/>
   </ejbjar>
 </target>

Then the deployment failed, until I provide to JBoss an auxiliary JAR
file containing these exception classes in $JBOSS/lib/ext; but I have to
stop and start JBoss... I feel that to put EJB exception classes in an
auxiliary JAR file, else than the EJB JAR file, is an ugly method, no ?

Do you have a magic tip to ask ejbjar tag for adding EJB exception class
in the EJB JAR file (something generic of course) ? Is there an inner
variable corresponding to the name of the current EJB ejbjar tag
proceeds (so we can add <include name="**/${EJBName}Exception.class"/>)
?

Thanks,


Daniel


RE: HELP: ejbjar tag and EJB exception.

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Daniel,

> Dear all,
>
> I have a little problem with my EJB JAR file creation, using the ejbjar
> tag. Some of my EJB have their own exception (derived obviously from
> EJBException), but the corresponding exception class is not included
> automatically in the EJB JAR file :
>
>  <!-- Create the EJB JAR files -->
>  <target name="ejbjar" depends="compile">
>    <ejbjar descriptordir="${res}"
> 	   destdir="${lib}"
>            srcdir="${classes}">
>      <classpath refid="project.class.path"/>
>      <include name="**/*-ejb-jar.xml"/>
>      <exclude name="**/*jboss*.xml"/>
>      <jboss destdir="${lib}"/>
>      <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
> 1.1//EN"
>           location="http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd"/>
>      <dtd publicId="-//JBoss//DTD JBOSS//EN"
>           location="http://www.jboss.org/j2ee/dtd/jboss.dtd"/>
>    </ejbjar>
>  </target>
>
> Then the deployment failed, until I provide to JBoss an auxiliary JAR
> file containing these exception classes in $JBOSS/lib/ext; but I have to
> stop and start JBoss... I feel that to put EJB exception classes in an
> auxiliary JAR file, else than the EJB JAR file, is an ugly method, no ?
>

For Ant 1.3/Ant 1.4 you can use the <support> element to add *files* to your
ejbjar. That isn't a great solution, though, IMHO. Once Ant 1.4 is released,
I will be adding code to slurp in all classes that your ejbjar depends on. A
patch has been submitted for this already.

> Do you have a magic tip to ask ejbjar tag for adding EJB exception class
> in the EJB JAR file (something generic of course) ? Is there an inner
> variable corresponding to the name of the current EJB ejbjar tag
> proceeds (so we can add <include name="**/${EJBName}Exception.class"/>)
> ?

No.

Conor