users@glassfish.java.net

GF 3.1.1 mixing OSGi and non-OSGi (EE) issues

From: <forums_at_java.net>
Date: Mon, 19 Sep 2011 00:56:01 -0500 (CDT)

Hi,

I've got a plain EJB deployed in an EAR file (it is a legacy EJB with no OSGi
metadata in the manifest). I am trying to access the EJB from an OSGi web
bundle using javax.naming.Context.lookup method. When the remote proxy is
returned, the code fails with the stack trace below. I had a look at
Gupta/Sahoo's presentation at javaone 2010 and other docs about mixing OSGi
and EE environments but actually they never really mixed OSGi and EE
environment. They were just deploying EJB's as OSGi bundles.

So my question is, it possible to call a non OSGi, EE EJB from an OSGi bundle
using Glassfish? If it is, can someone shed some light how it is done.

Thanks and Best Regards

SDJ

/////////////////////////////////////////////////////// STACK TRACE

[Root exception is javax.naming.NamingException: ejb ref resolution error for
remote business interfacegf.api.Servic
eRemote [Root exception is java.lang.RuntimeException: Could not invoke
defineClass!]]
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at
test.yieldbroker.imaadmin.wl.proxy.client.ProxyClientServlet.service(ProxyClientServlet.java:22)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
        at
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
        at
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
        at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
        at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
        at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
        at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
        at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
        at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NamingException: ejb ref resolution error for remote
business interfacegf.api.ServiceRemote [Roo
t exception is java.lang.RuntimeException: Could not invoke defineClass!]
        at
com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:434)
        at
com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
        at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at
com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
        at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
        ... 30 more
Caused by: java.lang.RuntimeException: Could not invoke defineClass!
        at
com.sun.corba.ee.impl.orbutil.codegen.CodeGeneratorUtil.makeClass(CodeGeneratorUtil.java:102)
        at
com.sun.corba.ee.spi.orbutil.codegen.Wrapper._generate(Wrapper.java:1106)
        at
com.sun.corba.ee.spi.orbutil.codegen.Wrapper._generate(Wrapper.java:1090)
        at com.sun.ejb.EJBUtils.generateAndLoad(EJBUtils.java:596)
        at
com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:508)
        at
com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:466)
        at
com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:414)
        ... 34 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown
Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
com.sun.corba.ee.impl.orbutil.codegen.CodeGeneratorUtil.makeClass(CodeGeneratorUtil.java:99)
        ... 40 more
Caused by: java.lang.NoClassDefFoundError:
com/sun/ejb/containers/RemoteBusinessObject
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        ... 44 more
Caused by: java.lang.ClassNotFoundException:
com.sun.ejb.containers.RemoteBusinessObject not found by ima-wl-client-web-
osgi [584]
        at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)
        at
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)
        at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
        ... 46 more
|#]

///////////////////////////////////////////////////////


--
[Message sent by forum member 'djordjevs']
View Post: http://forums.java.net/node/844474