Only 49 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Packaging Business Delegate  RSS feed

 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I was wondering in what thread I had to post my question.
I choose the EJB/J2EE one. Just let me know if the Patterns thread is a better place.
My question is.
Where do you package the BusinessDelegate(BD) class of an EJB ?
I can see a lot of sample on the Web where the BD is in the EJB jar file.
But my feeling is that it is better to have it on the client side (in the war)
Could you let me know and explain what you think about that
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither -- in an accessory JAR file that both can get to -- that way both other EJB-JAR's that need it (other EJB's that will interact with that EJB) and Servlets can use the business delegate.
Kyle
P.S. Interesting issues in this vein are raised here
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kyle,
I assume the BusinessDelegate will be responsible for the lookup to the SessionFacade.
Thus it will use a JNDI name I don't want to *hard code*.
If I put the BusinessDelegate in the WAR file, I can use an EJB reference within my class, so I can change it dynamically (java:comp/env).
But if the class is within a simple Jar file, how can I do this ?
Kyle, are you using a kind of JNDINames.class packaged with the business delegate to store the JNDI names ?
[ December 02, 2002: Message edited by: Bill Bailey ]
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle apart, is there any thout on that subject ?
Bartenders, should I post it elsewhere ?
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use java:comp/env REGARDLESS of which it is placed in, WAR, EJB-JAR or standard JAR file. The key is that the thread must run INSIDE a standard container (as it would in either case; where the business delegate is called by a Servlet or another EJB) -- thus any lookup to InitialContext can obtain an environment reference.
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very interesting Kyle.
I didn't know it was possible to use java:comp/env from a non-ejb jar file.
So my understanding is that you if the Business Delegate is called from a web app, then the EJB ref will be resolved by the web container, so the ref has to be specified in the web.xml
Is that correct ?
BTW Kyle, all these questions are still about an old classloader problem I'm working on (remember this thread ?)
I didn't give up and I'll keep you posted if I find something
[ December 05, 2002: Message edited by: Bill Bailey ]
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, your assumption is correct. If the class runs in the context of the servlet engine, then the information is taken from web.xml. If it runs in the EJB container, it gets it from ejb-jar.xml.
Now, as to your classloader problem -- it turns out this is a known bug in WebSphere. However, there's no fix for 4.0 yet (although 5.0 does fix it). I'm still looking for an acceptable workaround...
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the classloader problem, the Tech support asks me to test my applications with :
com.ibm.ws.classloader.classSharing=false
it does not help.
even the com.ibm.ws.classloader.J2EEApplicationMode=true is not a solution, although the J2EE 1.3 classloader mode should allow to deploy 2 EARs onto the same app server, each one with its own classloader hierarchy....

Do you have any PMR or PQ number for me, because the tech support I deal with does not seem to be aware of such a bug
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!