Calling an EJB from another ear

<[email protected]> Tue, 26 Apr 2011 17:48:51 +0200 (CEST)
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
Hi,
Here is my problem.

I have an application "A" which is deployed on a remote server. This
application have an EJB in it (ejbA).

In need to implement an EJB (ejbB) on another application B, on another server,
and these EJBB need to call the EJBA contains in A.

For that i use this code :

Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.ow2.carol.jndi.spi.MultiOrbInitialContextFactory");
properties.put("java.naming.provider.url", "rmi://myremoteserverA");
properties.put("java.naming.factory.url.pkgs", "org.objectweb.jonas.naming");
Context jndiContext = new InitialContext(properties);
Object manager	= 
jndiContext.lookup("myapplicationABean_myApplicationABeanRemote@Remote");
home = (myApplicationABeanRemote) 
javax.rmi.PortableRemoteObject.narrow(manager, myApplicationABeanRemote.class);


I've made an ear containing my ejbB.jar and in the ejbB.jar's MANIFEST.MF i've
put the ejbA.jar

When i try to access my EJBB i have this error :

2011-04-26 17:40:31,961 : LogUtils.log : Application has thrown exception,
unwinding now: javax.naming.NamingException: Cannot unwrap object
UnicastJNDIReferenceWrapper_Stub[UnicastRef [liveRef:
[endpoint:[10.10.3.112:4737](remote),objID:[76431a4b:12f9269293a:-7f38,
-3843398687578285101]]]] with name
com.xxx.xxx.ejb.BeanA_com.xxx.xxx.ejb.BeanARemote@Remote :Cannot find the class
com.xxx.xxx.ejb.BeanARemote in Classloader 46.0.
2011-04-26 17:40:31,961 : FaultOutInterceptor.handleMessage : Exception
occurred while writing fault.
org.apache.cxf.interceptor.Fault: Marshalling Error: null
	at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshallException(JAXBEncoderDecoder.java:311)
	at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:59)
	at
org.apache.cxf.interceptor.FaultOutInterceptor.handleMessage(FaultOutInterceptor.java:78)
	at
org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor.handleMessage(WebFaultOutInterceptor.java:126)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
	at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:96)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:273)
	at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:88)
	at
org.ow2.jonas.ws.cxf.http.JOnASDestination.invoke(JOnASDestination.java:111)
	at
org.ow2.jonas.ws.cxf.jaxws.CXFWSEndpoint.invoke(CXFWSEndpoint.java:151)
	at
org.ow2.jonas.ws.jaxws.http.servlet.JAXWSServlet.invokeDestination(JAXWSServlet.java:113)
	at
org.ow2.jonas.ws.jaxws.http.servlet.JAXWSServlet.doPost(JAXWSServlet.java:75)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[javax.xml.bind.JAXBException: class
org.ow2.easybeans.api.EZBContainerException nor any of its super class is known
to this context.]
	at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
	at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:172)
	at
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:395)
	at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshallException(JAXBEncoderDecoder.java:304)
	... 25 more
Caused by: javax.xml.bind.JAXBException: class
org.ow2.easybeans.api.EZBContainerException nor any of its super class is known
to this context.
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:152)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:189)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:315)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:322)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:72)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
	at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
	... 28 more
Caused by: javax.xml.bind.JAXBException: class
org.ow2.easybeans.api.EZBContainerException nor any of its super class is known
to this context.
	at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:590)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
	... 35 more




And the weird part, is, when I put the ejbA.jar in the jonas directory lib/ext,
the application works.

But I don't want to put it in lib/ext, so what can I do ?