ant<ejbjar> et <borland> FAQ

  1. The environnement
  2. Check binary Files
  3. Check your build.xml file !
  4. Unable to load dependency analyzer: org.apache.tools.ant.util.depend.bcel.AncestorAnalyzer ?
  5. Could not resolve (publicId: -//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN, systemId: http://java.sun.com/dtd/ejb-jar_2_0.dtd) to a local entity?
  6. Persistence: _PM file for EntityBean is not generated ?
  7. problem running <borland> task on multiple ejb jars
  8. problem with <borland> java2iiopParams attribute
Thank to Martha Ruzkowski to have translated this faq in Belorussian language

Introduction

I am the creator and the maintenor of the ejbjar sub task for ANT tool. This task allows to build an ejb jar file by analyzing the Deployement Descriptor. Each sub task targetting a specific application server (JBoss, WebSphere, Bes, WebLogic,..) adds all the necessary vendor files to have a jar file ready to be deployed on the application server.
Check the official documentation first on the ANT Site.

You can find here an article about security in borland enterprise server written by Krishnan Subramanian that i have formated

  • Securing an EJB Application in BES 5.2 [HTML] gif
  • Securing an EJB Application in BES 5.2 [PDF] pdf
More Java articles ? Check my website !

The environnement

The task uses directly or indirectly these parameters:
  • JAVA_HOME env variable on the JDK
  • BES_HOME env variable on the installation of Borland Enterprise Server.
  • %JAVA_HOME%\bin put in the PATH env variable
  • %BES%\bin put in the PATH env variable

Check binary Files

Several binary files are launched by the task. Verify the correct execution of
  • java2iiop must display all the options availables. Verify also the binary file is taken from the %BES%/bin folder. Be carefull, a very famous Database (oracle) still installs a very old version of visibroker (3.2), a weird version of java2iiop and put the Oracle/bin folder in path !
  • vbj must display all the options availables
  • vbjc, the wrapper around the java compiler, must display all the options availables.

Check your build.xml file !

Since the version 1.4.x, the task supports 2 major versions of the borland application server: BAS 4.5.x and BES 5.x. But by supporting the two versions, the verify option sub task does not work, so please, put the xml attribute xml to false:
<ejbjar .... verify="false">

Unable to load dependency analyzer: org.apache.tools.ant.util.depend.bcel.AncestorAnalyzer ?

It is not an error but an optional feature used by ANT to find dependencies ! To find what are the depencies for an EJB it uses either the BCEL library (jakarta.apache.org/bcel) or it uses a class loader. Your message tells it could not find the BCEL jar file. If you want to useit, put it in %ANT_HOME%\lib.

Could not resolve (publicId: -//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN, systemId: http://java.sun.com/dtd/ejb-jar_2_0.dtd) to a local entity

This error is not specific to the borland sub task. This message tells the DD xml file cannot be analyzed because the XML parser cannot load the DTD. This error may appear when you are behind a firewall/proxy.

It is very easy to solve this:

The best is to put the DTDs on a local web site (on a LAN) and to add dtd node that redirect the DTD.
With a sample it is better: the two <dtd>s tells where to find official DTD for ejbjar.xml and the vendor dtd.

<ejbjar srcdir="${build.dir}"  basejarname="${ant.project.name}"       descriptordir="${rsc.dir}/${ant.project.name}/J2EE">
     <borland destdir="lib" verify="off" generateclient="on" debug="on" version="5">
       <classpath refid="classpath" />
     </borland>
     <dtd publicid="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
         location= "http://mylocalserver/dtds/ejb-jar_2_0.dtd" />

     <dtd       publicid="-//Borland Software Corporation//DTD Enterprise JavaBeans 2.0//EN"
      location= "http://mylocalserver/dtds/ejb-jar_2_0-borland.dtd" />

     <include name="ejb-jar.xml"/>
     <support dir="${build.dir}">
       <include name="com\mycompangny\a\b\c\MyClass.class"/>
     </support>
</ejbjar>

Persistence : _PM file for EntityBean is not generated ?

Someone tells me this file is not generated by the tasks. First this files is used ony for EntityBeans. Second it is not generated by java2iiop command but by com.borland.ejb.pm.EntityBeanCodeGen following this syntax:

vbj com.borland.ejb.pm.EntityBeanCodeGen

Arguments:
-Directory with compiled bean code
-Abstract bean class name
-Name(s) of home interface(s)

Output:
-Concrete bean class source code (e.g. RoomBean_PM)

Typically this command is launched by JBuilder(X). If you need them add a <java> task in your build.xml

New ! 5 March 2004 David Leroy, a cool guy, has written two new classes to handle the _PM generation. He has created two new classes to accommodate my needs: EjbCMPJar.java, which extends EjbJar and BorlandCMPDeploymentTool, which extends your BorlandDeploymentTool. The new task is called "ejbcmpjar" and the new subtask is called "borlandcmp". Here is a snippet of the buildfile:

<taskdef name="ejbcmpjar"
classname="org.apache.tools.ant.taskdefs.optional.ejb.EjbCMPJar" />

<target name="generate Borland" depends = "compile Borland, package"
description="Generate EJBs for Borland Enterprise Server">

<mkdir dir="${dir.ejbs}" />
<mkdir dir="${dir.ejbs}/cmp" />
<ejbcmpjar descriptordir="${dir.edd}"
srcdir="${dir.classes}"
naming="directory"
dependency="none"
manifest="${manifest}">
<classpath>
<path refid="classpath.deploy" />
</classpath>
<include name="**/ejb-jar.xml" />

( ... omitted <dtd> elemements ...)

<borlandcmp destdir="${dir.ejbs}"
cmpdir="${dir.ejbs}/cmp"
version="5"
suffix=".jar"
verify="false"
</borlandcmp>

</ejbcmpjar>

</target>

problem running <borland> task on multiple ejb jars

David Leroy,still him, has found a problem when generating multiple ejb jar. He has opened a bug in Buzilla #26921

problem with <borland> java2iiopParams attribute

David Leroy,still him again, has found a problem when using space in java2iiop parameters transmitted to ejbjar task. He has opened a bug in Buzilla #27444

If you need help or have a question

Send me an email with an extract of your build.xml file and the output of the ant command with -debug flag.
ex: ant -debug package > myoutput.txt file. I will try to solve your problems !

Back to moussaud.org


Modified 6 March 2004