users@glassfish.java.net

Re: EJB Lookup Issue

From: <glassfish_at_javadesktop.org>
Date: Sun, 16 Dec 2007 15:57:52 PST

I guess here's a more defined explanation of the problem (btw, my deadline got moved to Monday so I still have a bit of time...)

I have a stateless EJB with remote and local intefaces. I can see the EJB in my JNDI but everytime I try to lookup, I get:

"IOP01211405: (BAD_OPERATION) Exception in loadStub"
org.omg.CORBA.BAD_OPERATION: vmcid: SUN minor code: 1405 completed: No
        at com.sun.corba.ee.impl.logging.UtilSystemException.exceptionInLoadStub(UtilSystemException.java:179)
        at com.sun.corba.ee.impl.logging.UtilSystemException.exceptionInLoadStub(UtilSystemException.java:197)
        at com.sun.corba.ee.impl.util.Utility.loadStub(Utility.java:856)
        at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:248)
        at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:343)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:344)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at edu.sjsu.supportnet.CommunitiesResource.lookupSupportNetBean(CommunitiesResource.java:51)
        at edu.sjsu.supportnet.CommunitiesResource.getCommunities(CommunitiesResource.java:68)
        at edu.sjsu.supportnet.CommunitiesResource.getCommunitiesAsJsonArray(CommunitiesResource.java:113)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.ws.rest.impl.model.method.dispatch.EntityParamDispatchProvider$TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:110)
        at com.sun.ws.rest.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:65)
        at com.sun.ws.rest.impl.model.method.ResourceMethodMapDispatcher.dispatch(ResourceMethodMapDispatcher.java:93)
        at com.sun.ws.rest.impl.model.BaseResourceClass.dispatch(BaseResourceClass.java:69)
        at com.sun.ws.rest.impl.application.WebApplicationContext.dispatchTo(WebApplicationContext.java:105)
        at com.sun.ws.rest.impl.model.ClassDispatcher.dispatch(ClassDispatcher.java:43)
        at com.sun.ws.rest.impl.model.BaseResourceClass.dispatch(BaseResourceClass.java:69)
        at com.sun.ws.rest.impl.model.RootResourceClass.dispatch(RootResourceClass.java:118)
        at com.sun.ws.rest.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:175)
        at com.sun.ws.rest.spi.container.servlet.ServletContainer.service(ServletContainer.java:116)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: org.omg.CORBA.BAD_OPERATION: vmcid: SUN minor code: 235 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.classNotFound3(ORBUtilSystemException.java:787)
        at com.sun.corba.ee.impl.presentation.rmi.StubFactoryFactoryDynamicBase.createStubFactory(StubFactoryFactoryDynamicBase.java:74)
        at com.sun.corba.ee.impl.util.Utility.loadStub(Utility.java:849)
        ... 57 more
Caused by: java.lang.ClassNotFoundException: com.sun.ejb.codegen.GenericEJBHome_Generated
        at com.sun.appserv.server.util.ASURLClassLoader.loadClass(ASURLClassLoader.java:129)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at com.sun.corba.ee.impl.util.JDKBridge.loadClass(JDKBridge.java:104)
        at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.loadClass(Util.java:683)
        at com.sun.corba.ee.impl.presentation.rmi.StubFactoryFactoryDynamicBase.createStubFactory(StubFactoryFactoryDynamicBase.java:72)
        ... 58 more
StandardWrapperValve[ServletAdaptor]: PWC1406: Servlet.service() for servlet ServletAdaptor threw exception
java.lang.RuntimeException: javax.naming.NamingException: ejb ref resolution error for remote business interfaceedu.sjsu.ejb.SupportNetRemote [Root exception is java.lang.NullPointerException]
        at edu.sjsu.supportnet.CommunitiesResource.lookupSupportNetBean(CommunitiesResource.java:60)
        at edu.sjsu.supportnet.CommunitiesResource.getCommunities(CommunitiesResource.java:68)
        at edu.sjsu.supportnet.CommunitiesResource.getCommunitiesAsJsonArray(CommunitiesResource.java:113)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.ws.rest.impl.model.method.dispatch.EntityParamDispatchProvider$TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:110)
        at com.sun.ws.rest.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:65)
        at com.sun.ws.rest.impl.model.method.ResourceMethodMapDispatcher.dispatch(ResourceMethodMapDispatcher.java:93)
        at com.sun.ws.rest.impl.model.BaseResourceClass.dispatch(BaseResourceClass.java:69)
        at com.sun.ws.rest.impl.application.WebApplicationContext.dispatchTo(WebApplicationContext.java:105)
        at com.sun.ws.rest.impl.model.ClassDispatcher.dispatch(ClassDispatcher.java:43)
        at com.sun.ws.rest.impl.model.BaseResourceClass.dispatch(BaseResourceClass.java:69)
        at com.sun.ws.rest.impl.model.RootResourceClass.dispatch(RootResourceClass.java:118)
        at com.sun.ws.rest.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:175)
        at com.sun.ws.rest.spi.container.servlet.ServletContainer.service(ServletContainer.java:116)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
        at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfaceedu.sjsu.ejb.SupportNetRemote [Root exception is java.lang.NullPointerException]
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:367)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:344)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at edu.sjsu.supportnet.CommunitiesResource.lookupSupportNetBean(CommunitiesResource.java:51)
        ... 49 more
Caused by: java.lang.NullPointerException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:359)
        ... 54 more

The server prints out the following lines as part of my deployment...

**RemoteBusinessJndiName: SupportNetRemote; remoteBusIntf: edu.sjsu.ejb.SupportNetRemote
LDR5010: All ejb(s) of [SupportNet-ejb] loaded successfully!
deployed with moduleid = SupportNet-war

Right before looking up the EJB, I see:

sumOfAllWeights = 10
NAM1001: No Endpoints selected in com.sun.appserv.iiop.endpoints property. Using JNDI Provider URL iiop://localhost:3700 instead
list[i] ==> 127.0.0.1:3700
corbaloc url ==> iiop:1.2_at_127.0.0.1:3700

And when I printout the JNDI entries just before I lookup "SupportNetRemote" it prints out:

o - UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
o - jdbc: com.sun.enterprise.naming.TransientContext
o - SupportNetRemote#edu.sjsu.ejb.SupportNetRemote: javax.naming.Reference
o - ejb: com.sun.enterprise.naming.TransientContext
o - __SYSTEM: com.sun.enterprise.naming.TransientContext
o - SupportNetRemote__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
o - SupportNetRemote: javax.naming.Reference

This leads me to believe that my EJB is recorded. I tried to lookup (for testing) UserTransaction (not sure what bound this to the JNDI) and that is fine, it is only when I lookup "SupportNetRemote".

In the EJB I have:

@Stateless
public class SupportNetBean implements edu.sjsu.ejb.SupportNetRemote, edu.sjsu.ejb.SupportNetLocal {
...

My sun-ejb-jar.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
  <enterprise-beans>
    <ejb>
      <ejb-name>SupportNetBean</ejb-name>
      <jndi-name>SupportNetRemote</jndi-name>
    </ejb>
  </enterprise-beans>
</sun-ejb-jar>

My client lookup is:

 public static SupportNetRemote lookupSupportNetBean() {
        try {

            Context ic = new InitialContext();
            javax.naming.NamingEnumeration nume = ic.list(""); // list all EJBs
            while(nume.hasMore())
                System.out.println("o - "+nume.next());

            SupportNetRemote supportNet =
                    (SupportNetRemote) ic.lookup("SupportNetRemote");
            
            return supportNet;
            
        } catch (NamingException ne) {
            /*java.util.logging.Logger.getLogger(getClass().getName())
                    .log(java.util.logging.Level.SEVERE,
                    "exception caught", ne);*/
            throw new RuntimeException(ne);
        }

I think I followed all the recommendations in https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB and yet I am still stuck. Can someone make some sense of what is going on and what I may be doing wrong? :(
[Message sent by forum member 'vyche1' (vyche1)]

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