users@glassfish.java.net

Re: _at_Remote EJB + JNDI supported in hybrid (JavaEE+OSGi) JAR?

From: <glassfish_at_javadesktop.org>
Date: Tue, 01 Jun 2010 05:51:54 PDT

Hello Sahoo,

thanks a lot! It indeed helped!!! When I deploy my EJB-OSGI-bundle, quite a few things happen in the log and my EJB pops up in JNDI! Great!

However, I'm still not lucky obtaining the EJB from JNDI:

[#|2010-06-01T14:01:55.438+0200|WARNING|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=69;_ThreadName=Thread-1;|StandardWrapperValve[TestServlet]: PWC1406: Servlet.service() for servlet TestServlet threw exception
java.lang.RuntimeException: Could not invoke defineClass!
        at com.sun.corba.ee.impl.orbutil.codegen.CodeGeneratorUtil.makeClass(CodeGeneratorUtil.java:98)
        at com.sun.corba.ee.spi.orbutil.codegen.Wrapper._generate(Wrapper.java:1102)
        at com.sun.corba.ee.spi.orbutil.codegen.Wrapper._generate(Wrapper.java:1086)
        at com.sun.ejb.EJBUtils.generateAndLoad(EJBUtils.java:586)
        at com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:503)
        at com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:462)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:410)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:71)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:486)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:451)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.nightlabs.test.osgi.web.TestServlet.processRequest(TestServlet.java:64)
        at org.nightlabs.test.osgi.web.TestServlet.doGet(TestServlet.java:29)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1518)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:171)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:651)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:87)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:321)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:222)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
        at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:803)
        at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:706)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:987)
        at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:178)
        at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
        at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
        at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
        at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
        at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:526)
        at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:507)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor55.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:95)
        ... 41 more
Caused by: java.lang.NoClassDefFoundError: com/sun/ejb/containers/RemoteBusinessObject
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        ... 45 more
Caused by: java.lang.ClassNotFoundException: com.sun.ejb.containers.RemoteBusinessObject
        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:744)
        at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61)
        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1656)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 48 more

I've checked the file ${glassfish}/glassfish/modules/ejb-container.jar which provides the required class and I saw that its MANIFEST.MF constrains the export of the package com.sun.ejb.containers - thus even if I import it it does not work (I tried and it really didn't).

Am I doing anything wrong? Should I download another GlassFish version? Or do I have to import anything else? I'm currently importing (in my web project) these packages:

Import-Package: javax.ejb,
 javax.servlet,
 javax.servlet.annotation,
 javax.servlet.http,
 org.nightlabs.test.osgi.ejb

And the exception happens when doing: initialContext.lookup(TestRemote.class.getName());

Best regards, Marco :-)
[Message sent by forum member 'nlmarco']

http://forums.java.net/jive/thread.jspa?messageID=472261