File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Mastering EJB - not quite! newby Q Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Mastering EJB - not quite! newby Q" Watch "Mastering EJB - not quite! newby Q" New topic
Author

Mastering EJB - not quite! newby Q

Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
I'm teaching myself EJB with Roman's Mastering EJB and I've hit a snag just trying to do the 'hello world' EJB.
All my files are ok, exactly the same as what I downloaded from the author's website. The problem comes with the JNDI naming that apparently should be taken care of by a weblogic-ejb-jar.xml, or somehow through the descriptor files.
I'm using ant to compile the ejb jar but it ignores the weblogic-ejb-jar.xml, which is in the same directory right next to the plain ejb-jar.xml
This is my ejb-jar.xml:

This is my weblogic-ejb-jar.xml:

and this is the ant task:


I think I'm missing something fundamental here, but I can't work out whether it's ant, weblogic, Mastering EJB or me that's at fault.
Massively grateful for any tips
Adam


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Hi Adam,
What is the error message raised ?
What is the code used to perform the lookup ?
Note: Depending on the causes of your problem, it could be better to post the question to the weblogic forum.
[ December 12, 2002: Message edited by: Bill Bailey ]

/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
Basically ant wasn't putting the weblogic-ejb-jar.xml descriptor in the jar. I played with it and have managed to get it to do that. However I'm not sure it's going to be OK. It generated all sorts of weblogic stuff as well.
Where should the JNDI info normally go? Currently I've got it in the weblogic-ejb-jar.xml
I could do this the weblogic way, but the weblogic console will deploy generic jars as well, so there's no point in restricting myself.
So if I delete this weblogic-ejb-jar.xml, where would I put the JNDI info?
Thanks
Adam
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
You need the weblogic-ejb-jar.xml file if you want WebLogic to deploy your ejb. It is optional to run ejbc on the ejb jar before deploying. WebLogic will automatically run ejbc if you do not. All that extra stuff is being generated by ejbc in your ant task, it is perfectly normal.
In no way is the weblogic-ejb-jar.xml optional.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
Oh. Then my ant task is messing up. For some reason it won't include the weblogic-ejb-jar.xml, unless I use the weblogic ant-task within the ejb-jar ant-task. If I do that I get allsorts of weblogic stuff generated too.
I don't want to use the weblogic ant-task - I just want a generic jar, containing all the descriptor files I decide to use. I mean, I will probably end up with a websphere and a jboss descriptor file as well.
Any ideas?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Your ant task is working how it is supposed to work. It is meant to be ignorant of vendor implementation details, hence it does not include the additional vendor files.
You have a few choices:
1) Use the vendor extensions to create the jars. In this case you would create separate ejb jars for each application server you are building for.
2) Use the support tag to tell ant what additional files to include. This may be a maintenance nightmare if you have alot of ejbs, since you would need to specify the files for each ejb separately.
3) Modify ant to work how you would like it to work, afterall it is open-source. This is really only valuable if you can get it submitted back to the project.
Personally, I would recommend number 1 or 3.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
Ok. I can live with no. 1
At the moment, I've got it to make a jar with everything in it.
Say though I had 4 descriptor files, one standard and the others for specific appservers:
hello-ejb-jar.xml
hello-weblogic-ejb-jar.xml
hello-jboss-ejb-jar.xml
hello-websphere-ejb-jar.xml
If they all get put in the same jar, with no appserver specific generated stuff, would it still work? Or would the websphere-ejb-jar.xml disturb weblogic & vice versa?
 
GeeCON Prague 2014
 
subject: Mastering EJB - not quite! newby Q