This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes merging ears Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "merging ears" Watch "merging ears" New topic
Author

merging ears

Lisa Cook
Greenhorn

Joined: Oct 17, 2003
Posts: 6
Hi,

I am new to J2EE, and encountering a problem...

I am using Jboss 4.2.2, and currently have 3 ears. EarA and EarB both make remote EJB calls to EarC. The problem is I had to turn on isolated classloading for each ear, so this setup is now throwing ClassCastException on the narrow() method during runtime.

So what I had tried was, placing the jar and war files of EarC in EarA, and modifying the application.xml for EarA to include the EarC modules. This worked.. until I did the same thing for EarB. Since the ejb in EarC is bound to JNDI already, it doesnt work.

Now I guess I could rename EarC to EarCa and EarCb, and that should solve the problem, but it doesnt seem right to me...

Is there something else I could do?

Thanks very much!

Edit: forgot to mention, it's ejb 2
[ July 07, 2008: Message edited by: Jessica ]
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

You could change the order of the classloader from parent-first (default) to child-first so that the isolated classloader setting is not necessary. In this way the class loader will go up the tree from the most local version of the class available to each ear and only share class loaders as required. I know there's a setting for this in WebSphere admin console, but off hand don't remember where this is in JBoss.


My Blog: Down Home Country Coding with Scott Selikoff
Lisa Cook
Greenhorn

Joined: Oct 17, 2003
Posts: 6
Unfortunately, the isolated class loading is not set up by me, so I cant modify the jboss settings.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

"Jessica", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

Originally posted by Jessica:
Unfortunately, the isolated class loading is not set up by me, so I cant modify the jboss settings.


It should be manageable on the EAR level, not the JBoss level. I just meant the command to do it is JBoss-specific, such as in a jboss.xml file in the EAR.
Lisa Cook
Greenhorn

Joined: Oct 17, 2003
Posts: 6
Thanks for your help Scott, but I did something else instead.

One of my coworkers suggested to place the stubs in the share folder, but it initially didnt work because I kept deploying the ejb in the ear file! Once I tried it outside of the ear packaging, it worked like a charm.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

But if I understand your solution correctly, you've broken the easily-portable nature of an EAR. In other words, other EAR's can now access the same JAR (might be a security issue or even a usability issue if other users create EARs with similar class names/paths) and you now have to install the JAR/stubs separately as part of the installation process (as well as update/maintain them separately). I don't disagree that putting the Stubs on a higher server level will work, I'm just saying its not really a great idea in the long term. Once you get into environments with multiple EARs and/or high number of updates/rollouts, it becomes more cumbersome.
[ July 09, 2008: Message edited by: Scott Selikoff ]
 
jQuery in Action, 2nd edition
 
subject: merging ears