if i understand what you're asking, you're saying that you have two ears (using seperate class loaders through a loader repository) and you wish for EAR1 to communicate w/ an ejb in EAR2.
if this is correct, then you want to read this:
if this isn't what you were looing for, could you pls give a clearer explination of what you would like to accomplish.
I have a EJB in EAR A and the same EJB in EAR B but I have removed initialisation information from EAR B so that it does not construct the EJB also. I initialise and access the EJB in EAR A with a client within EAR A. However, I cannot access this EJB in EAR A with a client inside EAR B even though I have the class files.
Is this clearer?
are the ears scoped? you mentioned in your first post that they are using seperate class loaders.
what do you mean by scoped?
did you specify a loader-repository inside the jboss.xml file that is packaged inside the ear? that's the only way you could have both ears using seperate class loaders.
i'd still recommend reading the wiki page and adjusting your packaging as described, you'll be better off in the long run.
I understand what you are saying, but this is not convenient to have my EJB classes in the JBoss lib because of the redeployment issue.
I would like to find a way without having to resort to this.
you don't have to deploy the classes into the 'lib' directory. everything can be deployed into the 'deploy' directory.
the only time you can't hot-deploy in this situation is if the ejb interface changes. if all you do is change business logic inside the ejb, then you can hot deploy the ear w/o issue. if you change the interfaces, then you need to restart the server in order for the changes to be picked up.
what you should end up having is the following:
- a jar w/ all the ejb interfaces in addition to any additional classes that interface needs to operate (ie, if one of your methods returns an object of class type Foo, then Foo.class needs to be packaged in the same jar as the ejb interfaces).
- EAR1 w/ all necessary classes it needs to operate minus those contained in the jar
- EAR2 w/ all the necessary classes minus those included in the jar.
provided the ejb interface does not change (or any of the other classes contained inside the jar) you can hot deploy EAR1 and/or EAR2 w/o problem. if the classes inside the jar do change, then you need the server restart.
i highly recommend spending the 10 bux (if you haven't done so already) and getting the jboss admin book. chapter 2 talks all about this (see the classloader section).