Prav Ford [
http://community.jboss.org/people/lordpraveen] created the discussion
"JBoss-classloading.xml in EAR /EJB"
To view the discussion, visit:
http://community.jboss.org/message/562595#562595
--------------------------------------------------------------
Hi ,
I have an EAR which I deploy in jboss-5.1.0.
A.EAR
|----lib/x.jar
|----EJB1.jar
|----EJB2.jar
I wanted to just expose the interfaces from the EJB's, hence I have
jboss-classloading.xml in both EJB1.jar and EJB2.jar.
What I was hoping to achieve is that just have the interfaces exposed in my EJB's to
other EJB's in the same EAR and also to other EAR's in AS.
EJB1.jar
|-----------com.ejb1.interface.EJB1Intf / EJB1IntfLocal extends EJB1Intf /
EJB1IntfRemote extends EJB1Intf
|-----------com.ejb1.implementation.EJB1Bean implements EJB1IntfLocal,EJB1IntfRemote.
|-----------META-INF/jboss-classloading.xml
<classloading xmlns="urn:jboss:classloading:1.0"
domain="A.EAR-0.0.1-SNAPSHOT-exploded.ear"
parent-domain="DefaultDomain"
export-all="NON_EMPTY" import-all="true"
excluded="META-INF">
<capabilities>
<package name="com.ejb1.interface" />
</capabilities>
</classloading>
Similarly for EJB2.jar.
This is how my jmx-console looks like:
h2. jboss.classloader
*
http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&nam...
domain="A.EAR-0.0.1-SNAPSHOT-exploded.ear",system=557851707
*
http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&nam...
id="vfsfile:/jboss-5.1.0.GA/server/default/deploy/AEAR-0.0.1-SNAPSHOT-exploded.ear/"
*
http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&nam...
id="vfszip:/jboss-5.1.0.GA/server/default/deploy/AEAR-0.0.1-SNAPSHOT-exploded.ear/EJB1.jar/"
EJB1 calls EJB2 via JNDI.
EJB1Bean:
public boolean callTheOtheEJB() {
EJB2Intf myStateless = lookup(EJB2Intf.class, "service/EJB2IntfBean");
logger.info("Called myStateless sayHello = "+ myStateless.sayHello());
return true;
}
EJB2Bean:
public String sayHello(){
return "Hello"
}
My Client:
Properties props = new Properties();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");
try {
InitialContext jndiContext = new InitialContext(props);
Object obj =
jndiContext.lookup("AEAR-0.0.1-SNAPSHOT-exploded/EJB1Bean/remote");
System.out.println(obj.getClass());
EJB1Intf callingEJBIntf = (EJB1Intf)obj;
callingEJBIntf.callTheOtheEJB();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Problem: EJB1 cant see EJB2Intf.
Caused by: java.lang.ClassNotFoundException: com.ejb2.interface.EJB2Intf from
BaseClassLoader@1f9c621d{VFSClassLoaderPolicy@53ed6e21{name=vfszip:/jboss-5.1.0.GA/server/default/deploy/AEAR-0.0.1-SNAPSHOT-exploded.ear/EJB1.jar/
domain=ClassLoaderDomain(a)b901239{name=AEAR-0.0.1-SNAPSHOT-exploded.ear parentPolicy=BEFORE
parent=ClassLoaderDomain@7a0aae8a{DefaultDomain}}
roots=[DelegatingHandler(a)148464531[path=AEAR-0.0.1-SNAPSHOT-exploded.ear/EJB1.jar
context=file:/jboss-5.1.0.GA/server/default/deploy/
real=file:/jboss-5.1.0.GA/server/default/deploy/AEAR-0.0.1-SNAPSHOT-exploded.ear/EJB1.jar]]
delegates=null exported=[com.ejb1.interface]NON_EMPTY}}
They are part of the same ClassLoaderDomain.
When I do listExportingClassloader() for AEAR domain,
{com.ejb1.interface=[jboss.classloader:id="vfszip:/jboss-5.1.0.GA/server/default/deploy/
AEAR-0.0.1-SNAPSHOT-exploded.ear/EJB1-SNAPSHOT.jar/"],
com.ejb2.interface=[jboss.classloader:id="vfszip:/jboss-5.1.0.GA/server/default/deploy/
AEAR-0.0.1-SNAPSHOT-exploded.ear/EJB2-SNAPSHOT.jar/"]}
Can anyone help? I am not sure where I am going wrong.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/562595#562595]
Start a new discussion in JBoss Microcontainer at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]