• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple EJB deployment

 
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,
Is there something that prevent me from deploying the same EJB twice (or more) onto the same Application Server (let's say , *Default Server*)
Imagine I want to have the same EJB in all my applications, so include it in all EAR files.
Can I do that with WebSphere ?
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to add that if I posted this question, that's because I have a example where it does not work properly.
Sounds like because the same EJB is deployed twice in 2 separate ear files onto the same APP server, it throws a ClassCastException somewhere.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should be able to deploy the same bean twice SO LONG AS you give it two different global JNDI names. Otherwise the second deploy overwrites the first...
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm glad to have your expertise here Kyle.
Someone at IBM tech support argue it is not possible as the AppServer use 1 and only one Classloader. So it prevent from deploying the same ejb twice.
That's why I posted a thread about class loaders here
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could possibly see a problem like yours occurring if you did deploy the two versions to the same JNDI name -- were you using the same name or a different one? If you did use a different name and it bombed, then you have uncovered a MAJOR bug that will affect hundreds of customers. If you used the same name -- then try using a different one and making sure you bind your local names within each EAR to the correct global name.
Let me know ASAP what you're doing...
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
kyle,
Fortnately, I'm quite sure I am not facing with a WAS bug. I thing the bug is in our code.
I have to check whether JNDI names are really different in each application.
I'll let you know asap.
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have deployed with 2 JNDI names completly different.
But the problem still occurs : ClassCastException
To be Continued.......
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not good. Can you give me all of the information (WAS version, etc....) and let me follow up with this?
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Websphere 4.03 + PQ 62684 + PQ 63116
As I said before, we have 2 applications (EAR_1 and EAR_2) deployed on the same application server.
The visibility of this serveur is : "Application Visibility"
Each application contains the same EJB : EJB_Common
Thus EJB_Common is deployed twice with 2 different JNDI names
- ejb/EAR_1/com/...
- ejb/EAR_2/com/...

When EAR_1 uses EJB_Common, the stubs and classes are loaded from EAR_1 classloader (CL1).
And then (we don't know exactly when, how and why), one class (actually a Value Object) is loaded both by CL1
and by EAR_2 classloader (CL2).
When websphere works with this class, as the same version comes from 2 different class loaders, it sounds like it triggers a ClassCastException
If you need further information, just let me know
[ October 25, 2002: Message edited by: Bill Bailey ]
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So does the error happen randomly, or every time you try to access the EJB?
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everytime.
The EJB (BMP) uses a DAO, which populates a VO.
The VO is the one which causes the ClassCastException, as it is loaded by 2 different class loaders, CL1 et CL2.
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Final question (I hope). Where's the VO located? Is it in a utility JAR file referred to by the EJB-JAR or inside the EJB-Jar itself? (I'm going to try to get as much information as I can before I try to reproduce this or talk to Level 3 support...)
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The VO is in the ejb-jar file itself.
Kyle, I really appreciate your help on this problem.
Just for information, I have an open PMR on this issue. But I'm not sure whether it has been escalated to level 3 yet.
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bill, I think you posted this information in another thread, but I can't find it now...
Does the problem occur when the VO is created or when it's passed outside the EJB container?
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kyle,
My understanding is that the VO creation is ok.
But then, when websphere tries to work with it, it is mixed up with 2 VO versions. One from classloader_1, the other from classloader_2
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally, we solved it.
The problem was due to a WAS 4.x bug.
To workaround this bug, we have to :
  • use com.ibm.ws.classloader.classSharing=false (JVM property)
  • make sure each EJB uses a different JNDI name (a duplicate name caused some problems)

  • According to IBM tech support, this is a bug with the 4.0 ORB, solved with the new v5 ORB.
    I can give further information upon request.
    I would like to thank every rancher for the tips and thoughts on this issue, and specially Kyle for his precious advices.
    [ December 23, 2002: Message edited by: Bill Bailey ]
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic