Vikram Chhibber wrote:
> Hello,
> I am using EJB task ejbjar's websphere optional task to deploy a bean on
> WebSphere 4.0 server. While running the script I am getting following error
> and the jar files it is creating has only ejb-jar.xml file.
>    [ejbjar] Unable to load dependency analyzer:
> org.apache.tools.ant.util.depend.bcel.AncestorAnalyzer
> I have followed the standard example given in the documentaion.
> Please let me know where I am going wrong.
> Thanks,
> Vikram

You are doing nothing wrong as such. Let me expand on Diane's explanation.

Under Ant 1.4.1 ejbjar would attempt to add super classes and super 
interfaces. It achieved this by loading the classes into the VM and using 
reflection. This is not a great approach as we are loading (and resolving) 
classes which we do not intend to run. Making sure all the support classes 
are in the various classpaths to allow the classes to be loaded and 
introspected is quite tricky. Many people will have seen the warning "Unable 
to load class for superclass check".

Under Ant 1.5, the mechanism has been changed and it now uses the 
Jakarta-BCEL library for examining the class dependencies. There is no 
longer any need to resolve classes and ensure the classpaths have all 
therequired jars. To maintain backward compatability, the default is still 
to add the super classes. This is now achieved with a BCEL based 
AncestorAnalyzer class.

Now, the approach of Ant 1.4.1 is a bit of a halfway-house. Having just the 
super classes is not that useful. In general you either want to have just 
the bean classes in the jar and to use a support jar with your deployment or 
you want to have all dependencies in the jar. Ant 1.5 supports these modes 
with the dependency attribute. If you set it to "none", you get no 
additional classes added to the jar and the above warning will go away as 
this does not require BCEL. If you set it to "full" you get a much more 
comprehensive dependency check which will add all dependent classes to the 
jar. This option requires BCEL.

I recommend you check out the documentation for the dependency attribute. 
Decide what strategy suits you (it will depend on how you package and deploy 
your beans). If you want the default or the "full" mode, download BCEL and 
put in ANT_HOME/lib.

The WHATSNEW file does contains this info

* <ejbjar> now allows control over which additional classes and interfaces
   are added to the generated EJB jars. A new attribute "dependency" can be
   defines which classes are added. The addition of classes now uses
   the Jakarta-BCEL library rather than reflection, meaning bean classes are
   no longer loaded into Ant's JVM.

Conor


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to