You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Todd Chambery <tc...@hotmail.com> on 2001/12/31 19:12:09 UTC

Websphere ejbjar task

Sorry if this is a repost.  I think when I first posted, it did not have
permission.


Hey all,

I've gotten a Websphere deploy task written and running (borrowing very
heavily
from the WeblogicDeploymentTool class), with one major hurdle remaining:  I
can't figure out how to
    a) put my own manifest into the generic ejb jar created by the
GenericDeploymentTool, or
    b) overwrite the default manifest added by the GDT.

To solve a), I tried overriding the GDT method writeJar (this is where the
default
manifest is added) but the GDT instance var addedFiles is used by another
GDT method, addFileToJar, and is not accessible to the subclass, so this
comes up as :

java.lang.NullPointerException
        at
org.apache.tools.ant.taskdefs.optional.ejb.GenericDeploymentTool.addFileToJa
r(GenericDeploymentTool.java:245)
        at
org.apache.tools.ant.taskdefs.optional.ejb.WebsphereDeploymentTool.writeJar(
WebsphereDeploymentTool.java:471)

The problem with overwriting as in b), is this:

   [ejbjar] adding file 'META-INF/MANIFEST.MF'
   [ejbjar] WARNING: IOException while adding entry META-INF/MANIFEST.MF to
jarfile from
D:\projects\D2V1\ant_descriptors\data_access_Action\Meta-inf\data_access_Act
ion-MANIFEST.MF java.util.zip.ZipException-duplicate entry:
META-INF/MANIFEST.MF

If I may be so bold, I think there's a flaw in the design of the
GeneralDeploymentTool.  You're only allowed to specify a single absolute
path to the manifest file for _all_ descriptors, when, at least in my
current project, each of the ejbjars has its own manifest containing the
classpath for that jar.

Also, what is involved in submitting my WebsphereDeploymentTool class for
inclusion in the ant distro?  I can't really use it on my work projects if
it's not "supported" by the Ant people (which is about the only place anyone
would use WAS).


thanks,

Todd





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Websphere ejbjar task

Posted by Todd Chambery <tc...@hotmail.com>.
----- Original Message -----
From: "Holger Engels" <he...@mercatis.de>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Friday, January 04, 2002 3:14 AM
Subject: Re: Websphere ejbjar task


> On Thu, 3 Jan 2002, Todd Chambery wrote:
>
> >

<snip>

> > to get it to pick up my manifest.  Is this looking for the manifest in
the
> > descriptor root directory intentional?
>
> Yes. I thought, it was a good idea, to fetch all kinds of meta data from a
> single location.
>

Is there any chance this will be changed in the official code?  What's the
process for lobbying for a change (even as small as this)?

>
> BTW: Are you willing to contribute some documentation?
>

I'd totally be down with cooking up some documentation, or amending the
current document, or doing what needs doing.

Todd


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Websphere ejbjar task

Posted by Holger Engels <he...@mercatis.de>.
On Thu, 3 Jan 2002, Todd Chambery wrote:

> 
> > > apart from the manifest problem, it looks like it works great.
> >
> > At least on linux and windows 2k .. I did not test it on other platforms.
> > The automatical 'ejbdeploy' did only work for me, if I used the ibm-jdk.
> > otherwise ibm's rmic throws a ClassFormatError, that complains about a
> > bad UTF8-String constant in the class' constant pool.
> >
> 
> I've found this too (after much pain).  It seems WebSphere's very picky
> about using the IBM jdk.
> 
> The GDT's manifest naming convention works, but it checks for the manifest
> in the
> 
>       getConfig().descriptorDir, baseName + "-manifest.mf"
> 
> which in my case is the root of the descriptors, or
> 
>     [ejbjar] building foo.jar with 18 files
> 
> --->    [ejbjar]   looking for manifest name of
> B:\projectRoot\ant_descriptors\foo-manifest.mf
> 
>     [ejbjar] adding file 'com\bar\common\ABFoo1.class'
>     [ejbjar] adding file 'com\bar\common\ABFoo2.class'
>     [ejbjar] adding file 'com\bar\session\ba\FooSessionHome.class'
> 
> My directory structure may not fit the convention, but it is in the form of:
>     projectRoot
>         ant_descriptors
>             foo
>                 Meta-inf
>                     foo-manifest.mf
>                     foo-ejbjar.xml
>                     ...
> all the descriptors get picked up but I had to modify the GDT.writeJar(...)
> 
>     log("\n\n\nlooking for manifest name of " + getConfig().descriptorDir+
> baseName + "\\Meta-inf" + baseName + "-manifest.mf" + "\n\n",
> Project.MSG_VERBOSE);
>     File manifestFile = new File(getConfig().descriptorDir, baseName +
> "\\Meta-inf" + baseName + "-manifest.mf");
> 
> to get it to pick up my manifest.  Is this looking for the manifest in the
> descriptor root directory intentional?

Yes. I thought, it was a good idea, to fetch all kinds of meta data from a 
single location.


> 
> Apart from that, I think I only have one more concern:  rmic is not being
> invoked.  Running the CVS version of WDT gives me this:
> 
>     [ejbdeploy]   Validation of ABFoo.jar by EJB Validator is complete. All
> known problems have been reported.
>     [ejbdeploy] Generating deployment code
>     [ejbdeploy]   Processing session bean: Foo
>     [ejbdeploy]   Committing working copy...
>     [ejbdeploy]   Updating.
>     ...
>     [ejbdeploy] Shutting down workbench.
>     [ejbdeploy] EJBDeploy complete.
> 
> Am I missing an attribute that fires off rmic?

May be, your classpath's getting too long? Invoke ant with the "-verbose" 
option and see what happens. Make sure to unset the CLASSPATH variable in 
your DOS box. IMHO it's a bad habit anyway, to have a system wide 
CLASSPATH variable!

The WDT does nothing different than ejbdeploy(.bat/.sh). It requires two 
classpaths. One as the systemclasspath and one for the "-cp" option of
"com.ibm.etools.ejbdeploy.EJBDeploy". Following is my code, that invokes 
the WDT:

    <ejbjar srcdir="${build.class}"
	    descriptordir="etc/ejb">
      <include name="*-ejb-jar.xml"/>
      <websphere dbvendor="${dbvendor}"
                 ejbdeploy="${ejbdeploy}"
                 oldCMP="false"
		 quiet="false"
		 keepgeneric="true"
		 tempdir="/tmp"
                 destdir="${dist.server}">
        <wasclasspath>
          <path refid="was4.ejbdeploy.classpath"/>
        </wasclasspath>
      <classpath>
        <path refid="was4.classpath"/>
      </classpath>
      </websphere>
      <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 
1.1//EN"
           location="${lib}/dtd/ejb-jar_1_1.dtd"/>
    </ejbjar>


BTW: Are you willing to contribute some documentation?


Cheers,

Holger


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Websphere ejbjar task

Posted by Todd Chambery <tc...@hotmail.com>.
> > apart from the manifest problem, it looks like it works great.
>
> At least on linux and windows 2k .. I did not test it on other platforms.
> The automatical 'ejbdeploy' did only work for me, if I used the ibm-jdk.
> otherwise ibm's rmic throws a ClassFormatError, that complains about a
> bad UTF8-String constant in the class' constant pool.
>

I've found this too (after much pain).  It seems WebSphere's very picky
about using the IBM jdk.

The GDT's manifest naming convention works, but it checks for the manifest
in the

      getConfig().descriptorDir, baseName + "-manifest.mf"

which in my case is the root of the descriptors, or

    [ejbjar] building foo.jar with 18 files

--->    [ejbjar]   looking for manifest name of
B:\projectRoot\ant_descriptors\foo-manifest.mf

    [ejbjar] adding file 'com\bar\common\ABFoo1.class'
    [ejbjar] adding file 'com\bar\common\ABFoo2.class'
    [ejbjar] adding file 'com\bar\session\ba\FooSessionHome.class'

My directory structure may not fit the convention, but it is in the form of:
    projectRoot
        ant_descriptors
            foo
                Meta-inf
                    foo-manifest.mf
                    foo-ejbjar.xml
                    ...
all the descriptors get picked up but I had to modify the GDT.writeJar(...)

    log("\n\n\nlooking for manifest name of " + getConfig().descriptorDir+
baseName + "\\Meta-inf" + baseName + "-manifest.mf" + "\n\n",
Project.MSG_VERBOSE);
    File manifestFile = new File(getConfig().descriptorDir, baseName +
"\\Meta-inf" + baseName + "-manifest.mf");

to get it to pick up my manifest.  Is this looking for the manifest in the
descriptor root directory intentional?

Apart from that, I think I only have one more concern:  rmic is not being
invoked.  Running the CVS version of WDT gives me this:

    [ejbdeploy]   Validation of ABFoo.jar by EJB Validator is complete. All
known problems have been reported.
    [ejbdeploy] Generating deployment code
    [ejbdeploy]   Processing session bean: Foo
    [ejbdeploy]   Committing working copy...
    [ejbdeploy]   Updating.
    ...
    [ejbdeploy] Shutting down workbench.
    [ejbdeploy] EJBDeploy complete.

Am I missing an attribute that fires off rmic?


Thanks for your help,

Todd

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Websphere ejbjar task

Posted by Holger Engels <he...@mercatis.de>.
On Wed, 2 Jan 2002, Todd Chambery wrote:

> Conor,
> 
> I'm looking through the code, and it looks similar to what I hacked up (much
> cleaner and complete though).  I have 2 (two) questions:
> 
> 1) the "alwaysRebuild" attribute to the websphere task isn't exposed.  Is
> this an oversight, or intentional?

oversight!

> 2) can you elaborate on the manifest issue?  I only see one reference to the
> manifest, and that is in the isRebuildRequired method.

I added this feature to the GenericDeploymentTool some time ago. One issue 
remained: if you chose to use the naming convention, a changed 
manifest-files would not be detected by the dependency checks. There would 
be no rebuild, if only manifest files changed.

> apart from the manifest problem, it looks like it works great.

At least on linux and windows 2k .. I did not test it on other platforms.
The automatical 'ejbdeploy' did only work for me, if I used the ibm-jdk. 
otherwise ibm's rmic throws a ClassFormatError, that complains about a 
bad UTF8-String constant in the class' constant pool.



Holger


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Websphere ejbjar task

Posted by Todd Chambery <tc...@hotmail.com>.
Conor,

I'm looking through the code, and it looks similar to what I hacked up (much
cleaner and complete though).  I have 2 (two) questions:

1) the "alwaysRebuild" attribute to the websphere task isn't exposed.  Is
this an oversight, or intentional?
2) can you elaborate on the manifest issue?  I only see one reference to the
manifest, and that is in the isRebuildRequired method.

apart from the manifest problem, it looks like it works great.


Todd


----- Original Message -----
From: "Conor MacNeill" <co...@cortexebusiness.com.au>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Wednesday, January 02, 2002 8:38 AM
Subject: Re: Websphere ejbjar task


> Todd Chambery wrote:
>
> > Sorry if this is a repost.  I think when I first posted, it did not have
> > permission.
>
> Todd, I committed a websphere deployment tool a little while ago. Can
> you check it out and see if it does what you need it to do. I can't test
> it easily. There was also come code to add manifests by naming convention.
>
> Conor
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Websphere ejbjar task

Posted by Todd Chambery <tc...@hotmail.com>.
Thanks!  I knew someone had to have done one, but I only found one, on MARC,
and when I went back I couldn't find it.  I'll definitely check it out.  I'm
suprised that given Websphere's share of the market (I won't comment on its
popularity), it didn't make it into the distribution sooner.

Todd


----- Original Message -----
From: "Conor MacNeill" <co...@cortexebusiness.com.au>
To: "Ant Developers List" <an...@jakarta.apache.org>
Sent: Wednesday, January 02, 2002 8:38 AM
Subject: Re: Websphere ejbjar task


> Todd Chambery wrote:
>
> > Sorry if this is a repost.  I think when I first posted, it did not have
> > permission.
> >
> >
>
>
> Todd, I committed a websphere deployment tool a little while ago. Can
> you check it out and see if it does what you need it to do. I can't test
> it easily. There was also come code to add manifests by naming convention.
>
> Conor
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Websphere ejbjar task

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Todd Chambery wrote:

> Sorry if this is a repost.  I think when I first posted, it did not have
> permission.
> 
> 


Todd, I committed a websphere deployment tool a little while ago. Can 
you check it out and see if it does what you need it to do. I can't test 
it easily. There was also come code to add manifests by naming convention.

Conor


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>