[jboss-user] [JBoss Microcontainer] - JBoss-classloading.xml in EAR /EJB
Prav Ford
do-not-reply at jboss.com
Sun Sep 19 16:03:44 EDT 2010
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&name=jboss.classloader%3Asystem%3D557851707%2Cdomain%3D%22ExamplesEAR-0.0.1-SNAPSHOT-exploded.ear%22 domain="A.EAR-0.0.1-SNAPSHOT-exploded.ear",system=557851707
* http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.classloader%3Aid%3D%22vfsfile%3A%2FVolumes%2FMustang%2Fbranch%2FJBoss_CELMI_20091103%2Fjboss-5.1.0.GA%2Fserver%2Fcelmi%2Fdeploy%2FExamplesEAR-0.0.1-SNAPSHOT-exploded.ear%2F%22 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&name=jboss.classloader%3Aid%3D%22vfszip%3A%2FVolumes%2FMustang%2Fbranch%2FJBoss_CELMI_20091103%2Fjboss-5.1.0.GA%2Fserver%2Fcelmi%2Fdeploy%2FExamplesEAR-0.0.1-SNAPSHOT-exploded.ear%2FProducerEJB-0.0.1-SNAPSHOT.jar%2F%22 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 at 1f9c621d{VFSClassLoaderPolicy at 53ed6e21{name=vfszip:/jboss-5.1.0.GA/server/default/deploy/AEAR-0.0.1-SNAPSHOT-exploded.ear/EJB1.jar/ domain=ClassLoaderDomain at b901239{name=AEAR-0.0.1-SNAPSHOT-exploded.ear parentPolicy=BEFORE parent=ClassLoaderDomain at 7a0aae8a{DefaultDomain}} roots=[DelegatingHandler at 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&containerType=14&container=2114]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100919/c3c8993b/attachment.html
More information about the jboss-user
mailing list