Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to deploy 2 EJB's in separate jars  RSS feed

 
le taylom
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have successfully deployed 2 session ejb's in the same jar file, i.e. with one ejb-jar.xml and one weblog-ejb-jar.xml. And get get the ejb's to communicate with each other.
Now I want to be able to compile and deploy the 2 ejb's in separate jar files as part of an ear file.
My method so far is this:
I have split the ejb-jar.xml file into two, for each ejb, and also the weblogic-ejb-jar.xml file into two for each ejb.
I then compiled the ejb source files and packaged each ejb up with its respective deployment descriptors into two separate .jar files.
I then want to run weblogics ejbc on each .jar file in turn so that the resultant .jar files (with newly created stubs/skels) can be packaged into an .ear to be easily deployed into weblogic.
I try and run the ejbc command on the first of the .jar files and i get the error:
ERROR: Error from ejbc:
In ejb-jar.xml, the EJB 'SessClient' contains an invalid ejb-link in ejb
-ref 'ejb/SessLogHome'. No EJB with ejb-name 'IntellectStateless.jar#SessLog' co
uld be found.
ERROR: ejbc found errors
My ejb-jar.xml file for this ejb is:

and both of my .jar files are in the same directory when I run the ejbc command.
I'm sure this can be done but I just think i'm not doing it in the right order maybe??
Anyway pointers will be gr8ly appreciated.
Cheers
T
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
take out the ejb-ref tag, you�re not required to provide it.
 
le taylom
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay here is the solution to how to achieve the problem I encountered above:
I am compiling my ejb.jar files using the weblogic.ejbc compiler, obviously I am deploying on weblogic here.
This section:

must have JUST the <ejb-link/> tag removed from the ejb-jar.xml file. And then the weblogic-ejb-jar.xml file MUST look like this:

Note the <refererence-descriptor> tag as the important part.
After these changes, the 2 ejb.jar files can be compiled using the weblogic.ejbc tool, thus supplying the stubs/skels, and then the resultant two ejb.jar files can be added to the EAR file and deployed to weblogic.
Result: 2 ejb's in separate jars, in one EAR file, talking to each other.
T
 
Karl Laird
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason for this is because the specification specifies <ejb-link> as only being able to be used when the EJB's are part of the same Jar. Otherwise you must use the <ejb-ref> if you want this explicit linking between ejbs to be performed
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!