EJB JNDI access from app1 to app2 in same oc4j (standalone) 9.0.4

I have two applications CatalogosWeb and WSCatalogosWeb both in the same instance of a 9.0.4 standalone OC4J. The first one implements a set of EJB's (both entity and session). In the second i have the EJB classes included int the "classes" directory.
When I try to acces de EJB from the second application I get a ClassCastException.
The source code is approximately:
ic = new InitialContext(env);
where env is>
{java.naming.provider.url=ormi://localhost:23791/CatalogosWeb, java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory, java.naming.security.principal=admin, java.naming.security.credentials=welcome}
later I try to access the EJB>
Object objref = ic.lookup(jndiHomeName);
Object obj = PortableRemoteObject.narrow(objref, className);
When the PortableRemoteObject tries to "narrow" the class I get the ClassCastException.

user496903 ,
When you need to perform lookups within the same OC4J container, you don't use RMIInitialContextFactory. Instead, you should use the new InitialContext() constructor, that defaults the initial context factory property to (if my memory doesn't fail) ApplicationInitialContextFactory...
Look for more info in the Oracle App Server EJB developer Guide,
hope it helps
RB

Similar Messages

  • Naming Problems with EJB when accessing from WebApplication

    Hi all,
    I'm trying to deploy an application consisting of several stateless session beans, one message driven bean and a web application. Everything works fine, until I try to log in (webapp). Then I get the following error:
    com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at ik, the whole lookup name is ik/sec/IKAuthenticationEJB.
    So the lookup name ik/sec/IKAuthenticationEJB is used in the code, whereas the JNDI Name of the requested bean is
    sap.com/Integrationkernel/IKAuthenticationEJB (As showed in the Admin Tool). I'm wondering why there is this "sap.com" as I choosed a different name for the provider (But the error remains even if I change it to "sap.com").
    As I cannot find any information about the "NameNotFoundException" I just tried the following:
    - add a "ejb-ref" section to web.xml
      <ejb-ref>
         <ejb-ref-name>ik/sec/IKAuthenticationEJB</ejb-ref-name>
         <ejb-ref-type>Session</ejb-ref-type>
         <home>com.tsystems.ik.security.authentication.IKAuthenticationEJBHome</home>
         <remote>com.tsystems.ik.security.authentication.IKAuthenticationEJBRemote</remote>
         <ejb-link>sap.com/Integrationkernel/IKAuthenticationEJB</ejb-link>
      </ejb-ref>
    - add a web-j2ee-engine.xml to the Web Application:
         <web-j2ee-engine>
             <ejb-ref>
                <ejb-ref-name>ik/sec/IKAuthenticationEJB</ejb-ref-name>
                <jndi-name>sap.com/Integrationkernel/IKAuthenticationEJB</jndi-name>
            </ejb-ref>
         </web-j2ee-engine>
    Does anybody know what to do? Did I declare the references in a wrong way?
    Is there a complete API Javadoc available? I just found the very small one on SDN...
    Thanks a lot,
    Nadine

    Hi Nadine,
    in order to lookup ab EJB from a web component you have to declare an ejb reference (ejb-ref section) in the web.xml. The jndi name in the web-j2ee-engine.xml  can be omitted if you are sure that the information provided by the "ejb-ref" section is sufficient to identify the EJB component.
    From the example you wrote I see that the ejb-link element is not correct. According to the EJB 2.0 FR specification (Appendix B, page 518) "ejb-link element must be the ejb-name of an enterprise bean". Probably this inconsistent information misleads the EJB Container in resolving the right reference.
    My advice is simply to omit this and leave the "home" and "remote" elements. They should be enough.
    A hint: you can use the "lsn" shell command from the "naming" group to observe the JNDI tree on a particular server node.
    I hope this will help you.
    Best regards,
    Svetoslav

  • Ejb remotly accessed from different ejb without parent tag

    Hi,
    is there any way, how to access EJB A deployed in a.aer from another EJB B deployed in b.ear? a.ear and b.ear are deployed at the same IAS 9.0.4.2 and neither of these EAR's is parent EAR ( don't want to use parent tag)?
    Thank you very much for any advice.
    Eugen

    Hi,
    is there any way, how to access EJB A deployed in a.aer from another EJB B deployed in b.ear? a.ear and b.ear are deployed at the same IAS 9.0.4.2 and neither of these EAR's is parent EAR ( don't want to use parent tag)?
    Thank you very much for any advice.
    Eugen

  • EJB deployment/access from the Client Machine

    I want to deploy/access the EJB on the Oracle 8i server from the
    Client Machine. From the Oracle 8i server machine i am able to
    deploy and access the EJB
    When i am trying to deploy/access the EJB i am getting the
    following message
    javax.naming.CommunicationException: Unknown service : sess_iopp
    url
    Please tell me what to do ?
    Thanks in advance
    null

    Are you using JDeveloper? If yes then go to File|New->Snippets
    and select 'Example JServer EJB Client' to create an EJB client.
    : javax.naming.CommunicationException: Unknown service :
    sess_iopp
    It's sess_iiop not iopp ;-)
    Regards,
    Arun
    Manish Patel (guest) wrote:
    : I want to deploy/access the EJB on the Oracle 8i server from
    the
    : Client Machine. From the Oracle 8i server machine i am able to
    : deploy and access the EJB
    : When i am trying to deploy/access the EJB i am getting the
    : following message
    : javax.naming.CommunicationException: Unknown service :
    sess_iopp
    : url
    : Please tell me what to do ?
    : Thanks in advance
    null

  • EJB Client Access From JDeveloper9iR2

    I seem to be running into a lot of problems when trying to get a simple EJB client to talk to an EJB on our 9IAS platform. I have developed a simple session bean (just to test) which simply returns a string. When I create the default client code this works fine using the embedded OC4J server in Jdeveloper but I can't run a similar client against 9IAS when I deploy the code. When I go through the client wizard it seems to produce the same code as the standalone EJB OC4J client. I simply changed the name of the server (Context.PROVIDER_URL, "ormi://pe2500/). This is the parameter code I use:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    env.put(Context.PROVIDER_URL, "ormi://pe2500:23891/MyEJBs");
    This is the output I receive:
    D:\jdeveloper9ir2\jdk\bin\javaw.exe -ojvm -classpath D:\javadev\ejbservlet\ejbservlet\WEB-INF\classes;D:\jdeveloper9ir2\jdev\lib\jdev-rt.jar;D:\jdeveloper9ir2\j2ee\home\lib\ojsp.jar;D:\jdeveloper9ir2\j2ee\home\jsp\lib\taglib\ojsputil.jar;D:\jdeveloper9ir2\j2ee\home\oc4j.jar;D:\jdeveloper9ir2\j2ee\home\lib\servlet.jar;D:\jdeveloper9ir2\jdev\lib\ojc.jar;D:\jdeveloper9ir2\j2ee\home\lib\activation.jar;D:\jdeveloper9ir2\j2ee\home\lib\ejb.jar;D:\jdeveloper9ir2\j2ee\home\lib\jaas.jar;D:\jdeveloper9ir2\j2ee\home\lib\jaxp.jar;D:\jdeveloper9ir2\j2ee\home\lib\jcert.jar;D:\jdeveloper9ir2\j2ee\home\lib\jdbc.jar;D:\jdeveloper9ir2\j2ee\home\lib\jms.jar;D:\jdeveloper9ir2\j2ee\home\lib\jndi.jar;D:\jdeveloper9ir2\j2ee\home\lib\jnet.jar;D:\jdeveloper9ir2\j2ee\home\lib\jsse.jar;D:\jdeveloper9ir2\j2ee\home\lib\jta.jar;D:\jdeveloper9ir2\j2ee\home\lib\mail.jar;D:\jdeveloper9ir2\j2ee\home\oc4j.jar;D:\jdeveloper9ir2\lib\xmlparserv2.jar;D:\jdeveloper9ir2\lib\xmlcomp.jar;D:\jdeveloper9ir2\j2ee\home\oc4j.jar;D:\jdeveloper9ir2\j2ee\home\lib\servlet.jar Samplemypackage6.ctejb1Client3
    javax.naming.NamingException: Lookup error: java.net.ConnectException: Connection refused: connect; nested exception is:
         java.net.ConnectException: Connection refused: connect
         java.lang.Object com.evermind.server.rmi.RMIContext.lookup(java.lang.String)
              RMIContext.java:134
         java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)
              InitialContext.java:350
         void Samplemypackage6.ctejb1Client3.main(java.lang.String[])
              ctejb1Client3.java:18
    Process exited with exit code 0.
    Can anyone tell me if this is the correct communication method for client EJB's talking to the 9IAS server?
    Any help really appreciated.
    Chris Taylor

    hi Chris Taylor, did you find the solution for this error. i too get this error and i am looking for the answer. if you find any answer please share with me too. if i get any answer for this i will reply you too.

  • EJB access from applet on Linux

    Hi,
    I've been trying for 2 days now to access an EJB in JServer from a Java Applet running in the Java Plugin 1.2.2 in Netscape on Linux.
    After loading the applet web page the plugin fires up and downloads a whole bunch of needed classes. Then I get this exception:
    java.lang.ExceptionInInitializerError: org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation
    com.visigenic.vbroker.orb.ORB minor code: 0 completed: No
    at org.omg.CORBA.ORB.create_impl(ORB.java, Compiled Code)
    at org.omg.CORBA.ORB.<clinit>(ORB.java:202)
    at oracle.aurora.jndi.orb_dep.Orb.init(Orb.java, Compiled Code)
    at oracle.aurora.jndi.orb_dep.IRFinder.getObject(IRFinder.java, Compiled Code)
    at oracle.aurora.jndi.orb_dep.IRFinder.initialReferences(IRFinder.java, Compiled Code)
    at oracle.aurora.jndi.sess_iiop.SessionCtx.initialContext(SessionCtx.java, Compiled Code)
    at oracle.aurora.jndi.sess_iiop.SessionCtx.<init>(SessionCtx.java, Compiled Code)
    at oracle.aurora.jndi.sess_iiop.ServiceCtx.createSession(ServiceCtx.java, Compiled Code)
    at oracle.aurora.jndi.sess_iiop.ServiceCtx.login(ServiceCtx.java, Compiled Code)
    at oracle.aurora.jndi.sess_iiop.ServiceCtx.defaultSession(ServiceCtx.java, Compiled Code)
    at oracle.aurora.jndi.sess_iiop.ServiceCtx.lookup(ServiceCtx.java, Compiled Code)
    at oracle.aurora.jndi.sess_iiop.sess_iiopURLContext.lookup(sess_iiopURLContext.java, Compiled Code)
    at oracle.aurora.jndi.sess_iiop.sess_iiopURLContext.lookup(sess_iiopURLContext.java, Compiled Code)
    at javax.naming.InitialContext.lookup(InitialContext.java, Compiled Code)
    at vtsi.location.NearSelectionApplet.start(NearSelectionApplet.java, Compiled Code)
    at sun.applet.AppletPanel.run(AppletPanel.java, Compiled Code)
    at sun.plugin.navig.motif.MotifAppletViewer.maf_run(MotifAppletViewer.java, Compiled Code)
    at sun.plugin.navig.motif.MotifAppletViewer.run(MotifAppletViewer.java, Compiled Code)
    at java.lang.Thread.run(Thread.java, Compiled Code)
    The frustrating part is that the same applet works just fine when called in a Win NT broswer (IE and Netscape) or appletviewer. A java test application accessing the EJB also runs fine on Linux.
    The only obivious difference is that my Windows machine has the Java Plugin 1.3 installed and Linux only 1.2.2. But since the applet has been compiled with the 1.2.2 compiler that shouldn't really make a difference, should it?
    I'd appreciate any help on this subject.
    Thx,
    Thomas J.

    i could answer this
    but my colleagues are working on a client which uses client(applet) to access stateless session beans
    but mine's giving a little problem
    visit my problem for some of the overview which i think will be fixed or
    the same could run on your machine
    http://forum.java.sun.com/thread.jsp?forum=13&thread=538583&tstart=0&trange=15

  • Accessing Sun App Server JNDI context from j2se client

    The following client's code snippet is raising javax.naming.NameNotFoundException.
    public static void main(String[] args)
         try
              Context jndiContex = getInitialContext();
              Object ref = jndiContex.lookup("java:comp/env/ejb/ru.srpu.jtest.service.UserRemote");
              UserRemote user = (UserRemote)PortableRemoteObject.narrow(ref,UserRemote.class);
              //logic goes here...
         catch (NamingException e)
              e.printStackTrace();
    public static Context getInitialContext( ) throws javax.naming.NamingException
         Properties p = new Properties( );
         p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
         p.put(Context.PROVIDER_URL, "iiop://localhost:3700/");
         return new javax.naming.InitialContext(p);
    }Beans are packed into the ejb-jar module of the EAR and deployed successfully. EJB's jndi-name is correct as well.
    Help to find a bug, please!

    We have a number of FAQ entries that cover client JNDI access here :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    -ken

  • NamingException on EJB jndi lookup

    I have two applications - deployed under the "default instance".
    When I start up OC4J and deloy app1 and app2, then app1 can do a JNDI lookup on a session bean that resides in App2. It uses the RMIInitialContextFactory.
    Provider is "ormi://localhost/app2"
    My problem is that if I undeploy and redeploy app2, then app1 suddenly can't do a lookup to any sessionBean found in app2 anymore, even though the jndi name still shows up in the browser, and if I try to look it up from an external application running outside of oc4j (with exactly the same code as I'm using in app1), it also works.
    So why is app1 not able to find app2 via jndi after a redeployment?
    D

    Avi - thank you for your response.
    First of all, I run on Suse Linux 10.1. Dunno if that's any help, but hey, more info can't help :)
    Let's answer your questions:
    1.) OCJ4 Version: 10.1.3.0.0 (build 060119.1546.05277)
    2.) JDK Version: 1.5.0_07-b03
    As for your suggestions:
    1.) app1 = parent of app2.
    I'm rather new to Oracle, so maybe I made a mistake during my investigations. Still, I'd like to give a breakdown: I built a framework-type application, and thought about deploying "child modules" (plug-in applications) underneath it, as you proposed.
    This worked fine, but there comes a problem whenever you try to use something like Hibernate in any application that's not deployed in the root (ie any app that's deployed as a child of another). The problem came in 2 flavours:
    A) If you use a jar in the parent and try to do resource loading from the child, the context of the parent is used the whole time. Since the search-policy of the class-loader is loaded->parent->shared->local, and if Hibernate is already used in the parent, it never gets to the child and thus trying to load a resource in the child is futile since parent can't see child context.
    B) Lets say you're not using Hibernate at all in the parent application. When doing resource loading (eg the hibernate.cfg.xml file), Hibernate tries to locate the resource via Thread.currentThread().getContextClassLoader(). OC4J returns the parent-app's thread as the currentThread, NOT that of the child-application that you're actually running the code from, thus it will never be able to pick up resources from within a jar part of the child application. The only way that I managed to get it to work, was to include the Hibernate3.jar as part of the EAR deployment (ie listed it as <library path...> in the orion-application.xml. Putting it in shared-libs or app-libs didn't work...ever. Also, if I happened to use Hibernate in the parent-application, it doesn't matter if I put hibernate3.jar in the EAR of the child - the parent-version gets picked up and used due to the search-policy... NOTE: This is in a JAR - I'm not using WAR's so cannot force local loading as is possible with web-apps...
    I then opted to deploy applications seperately under the root, and using RMI to communicate from the framework-application to its "modules", and vice-versa. The master doesn't know the exact type of the remote interface of whatever child-module it needs to call, so it uses reflection to call the "create" on the EJBHome of whatever child-module it needs to invoke as well as the method on the actual remote-interface.
    Please note, if I deploy both applications (master and child), and perform JNDI lookups from master to child, it works perfectly. As soon as I do a redeploy (or explicity undeploy, deploy), JNDI fails. External clients, though, works all the time. Also, if I redeploy the child before ever calling it from the parent-application, it also works after I did redeployment. It's as if, when you do a JNDI lookup the first time, it caches something and from there on it breaks if you do a redeploy and perform a consequent app-to-app JNDI lookup...
    2.) dedicated.rmicontext=true
    I tried this by setting it as a JNDI property before getting the InitialContext - makes no difference, unfortunately.
    //========CODE============================
    // This is in a SessionBean inside the Master Application. For the time being I've hard-coded the provider-url of the client-application.
    // NOTE: This EXACT same code is used in the external java client - there it works perfect every time, whether I redeploy or not.
    //========================================
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.PROVIDER_URL, "ormi://localhost/client-application");
    env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
    env.put(Context.SECURITY_CREDENTIALS, "MyPassword");
    env.put("dedicated.rmicontext","true");
    InitialContext ctx = null;
    try {
         ctx = new InitialContext(env);
         // WHEN I REDEPLOY, CODE CRASHES ON THE NEXT LINE
         Object home = ctx.lookup("ejb/TestWorkerAProxyBean");
         EJBHome obHome = (EJBHome) PortableRemoteObject.narrow(home, EJBHome.class);
         System.out.println("EJBHOME Is [" + obHome + "]");
         final Object invocationTarget = MethodUtils.invokeExactMethod(obHome,"create",new Object[0]);
         System.out.println("invocation target = [" + invocationTarget + "]");
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
         IWorkerProxy proxy = (IWorkerProxy)Proxy.newProxyInstance(classLoader, new Class[]{IWorkerProxy.class}, new InvocationHandler() {
              public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                   try {
                        Method remoteEjbMethod = invocationTarget.getClass().getMethod(method.getName(),method.getParameterTypes());
                        return remoteEjbMethod.invoke(invocationTarget, args);
                   } catch (Exception e) {
                        ExceptionHandler.handle(e);
                   return null;
    } catch (NamingException ne) {
         System.out.println("NamingException");
         ne.printStackTrace();
    } catch (NoSuchMethodException e) {
         System.out.println("NoSuchMethodException");
         e.printStackTrace();
    } catch (Exception e) {
         System.out.println("Other Exception");
         e.printStackTrace();
    ==========================
    ===========EXCEPTION (ONLY IF I REDEPLOY - IT WORKS PERFECT IF I RUN IT FIRST TIME)=================
    ==========================
    06/09/25 17:15:51 NamingException
    06/09/25 17:15:51 javax.naming.NameNotFoundException: ejb/TestWorkerAProxyBean not found
    06/09/25 17:15:51 at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
    06/09/25 17:15:51 at javax.naming.InitialContext.lookup(InitialContext.java:351)
    06/09/25 17:15:51 at com.myapp.master.RequestProcessorBean.processRequest(RequestProcessorBean.java:140)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.TxSupportsInterceptor.invoke(TxSupportsInterceptor.java:37)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
    06/09/25 17:15:51 at RequestProcessorLocal_StatelessSessionBeanWrapper4.processRequest(RequestProcessorLocal_StatelessSessionBeanWrapper4.java:37)
    06/09/25 17:15:51 at com.myapp.master.gateway.FrameworkGatewayBean.processObjectRequest(FrameworkGatewayBean.java:172)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.TxSupportsInterceptor.invoke(TxSupportsInterceptor.java:37)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    06/09/25 17:15:51 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
    06/09/25 17:15:51 at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
    06/09/25 17:15:51 at FrameworkGatewayRemote_StatelessSessionBeanWrapper10.processObjectRequest(FrameworkGatewayRemote_StatelessSessionBeanWrapper10.java:94)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/09/25 17:15:51 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/09/25 17:15:51 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/09/25 17:15:51 at java.lang.reflect.Method.invoke(Method.java:585)
    06/09/25 17:15:51 at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
    06/09/25 17:15:51 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    06/09/25 17:15:51 at java.lang.Thread.run(Thread.java:595)

  • Error acceessing remote EJB 2.0 from OSB

    Hi All,
    I am trying to access a remote EJB(2.0) from OSB. When i am trying to connect to the EJB i am getting this error.
    "java.net.ConnectException: Connection refused: connect; No available router to destination"
    I have built the WSDl based on the client jar that is provided and then configured the JNDI Provider. Then I provided the endpoint EJB URL in the following format.
    ejb:JNDIProviderName:ConnectionfactoryName:JNDIName.
    Let me know if i have missed out any configuration in order to access EJB. Your help is appreciated as we are struck in SIT.
    Thanks,
    B
    .

    Strange question. If you know EJB 2 and you know EJB 3, you should be able to answer this question yourself. If you don't know one of the two, you shouldn't be asking this question but hitting the books.
    As for the errors you are getting, the error couldn't be more clear:
    java.lang.NoClassDefFoundError: com/fammllc/exceptions/LubeNominationExceptionIt doesn't even have something to do with EJBs, its a simple case of class not found. The warning is more odd as the EJB 3 spec defines that transactions should default to REQUIRED, not "NOT_SUPPORTED". If EJB 3 would really be in play here, you wouldn't be getting this warning. Its probably a case of "read the manual" - the manual of whatever container you are using (I'm guessing Weblogic, which has its own forum here: https://forums.oracle.com/forums/category.jspa?categoryID=193).
    Edited by: gimbal2 on May 10, 2012 4:56 AM

  • How can one invoke a WebLogic EJB from a BPEL Server hosted on OC4J?

    How can one invoke a WebLogic EJB from a BPEL Server hosted on OC4J?
    Reason I ask is I keep getting this error:
    javax.naming.NoInitialContextException: Cannot instantiate cla
    ss: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotF
    oundException: weblogic.jndi.WLInitialContextFactory]
    Note: I am using <bpelx:exec> as a way to execute some java program.
    Essentially my java client (essentially an EJB client hosted on Oc4J) needs access to wlclient.jar since it needs access to weblogic.jndi.WLInitialContextFactory. I have a EJB client running on BPEL server hosted on Oc4J that needs to access some EJBs hosted on weblogic.
    Where do I place this wlclient.jar so that BPEL PM can start peacefully and at runtime discover the InitialContextFactory classes?
    Placing it in the j2ee/home/applib doesn't solve the problem. The server fails to start up if I do this
    I tried placing it in BPEL-INF\lib directory ...
    I still get the same exception...see below for exception dump
    I verified the BPEL suitcase, and it in fact does contain the jar file wlclient.jar
    integration\orabpel\domains\default\deploy contains the bpel_BPELProcess2_1.0.jar file and snapshot of that is as follows:
    <PRE>
    &#9474; bpel.xml
    &#9474; BPELProcess2.bpel
    &#9474; BPELProcess2.jpr
    &#9474; BPELProcess2.wsdl
    &#9474; bpel_BPELProcess2_1.0.jar
    &#9474; build.xml
    &#9474; buildxml.copy
    &#9474; graphics.xml
    &#9474;
    &#9500;&#9472;&#9472;&#9472;BPEL-INF
    &#9474; &#9492;&#9472;&#9472;&#9472;lib
    &#9474; myEJB.jar
    &#9474; wlclient.jar
    &#9474;
    &#9500;&#9472;&#9472;&#9472;META-INF
    &#9474; MANIFEST.MF
    &#9474;
    &#9492;&#9472;&#9472;&#9472;output
    bpel_BPELProcess2_1.0.jar
    </PRE>
    I tried using the BPEL-INF\jar directory...Is this something the obant automatically detects? or do I have to modify the build.xml? I created this directory and let Jdev deploy to local BPEL server->default domain handle it
    #####################3
    I even tried copying the wlclient.jar to
    integration\orabpel\system\classes but this doesn't help since the BPEL PM fails to start if I explode this jar into this directory.
    In short,where do I place the wlclient.jar so that this exception can be contained.
    I edited the build.xml to point to the jar, that too didn't work, unless I made some mistake in the file
    <bpelc classpath="${basedir}/BPEL-INF/classes;${home}/system/classes;${home}/lib/j2ee_1.3.01.jar;${basedir}/BPEL-INF/jar/wlclient.jar" input="${basedir}/bpel.xml" rev="${rev}" deploy="${deploy}" />
    </target>
    </project>
    DETAILS on ERROR
    I get the following error
    Process "BPELProcess2" (revision "1.0") successfully compiled.
    <2005-12-14 09:17:55,770> <INFO> <default.collaxa.cube.engine.deployment> Proces
    s "BPELProcess2" (revision "1.0") successfully loaded.
    05/12/14 09:18:36 weblogic.jndi.WLInitialContextFactory
    javax.naming.NoInitialContextException: Cannot instantiate cla
    ss: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotF
    oundException: weblogic.jndi.WLInitialContextFactory]
    05/12/14 09:18:36 at javax.naming.spi.NamingManager.getInitialContext(Nami
    ngManager.java:652)
    05/12/14 09:18:36 at javax.naming.InitialContext.getDefaultInitCtx(Initial
    Context.java:243)
    05/12/14 09:18:36 at javax.naming.InitialContext.init(InitialContext.java:
    219)
    05/12/14 09:18:36 at javax.naming.InitialContext.<init>(InitialContext.jav
    a:195)
    05/12/14 09:18:36 at com.ejb.test.MapFinder.getDefaultMapName(Map
    Finder.java:37)
    ##################3
    with the bpelx all I have is two lines of code that creates a java object and calls a method on it.
    The method does this:
        private String initialContextFactory = "weblogic.jndi.WLInitialContextFactory";
        private String providerUrl = "t3://localhost:7001";
        private String urlPkgPrefixes = "";
        private String mapEjbJndiName = "ejb/mycompany/Redlands";
        public String getDefaultMapName() {
          try {
              Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY, getInitialContextFactory());
              env.put(Context.PROVIDER_URL, getProviderUrl());
              if (getUrlPkgPrefixes() != null && !getUrlPkgPrefixes().equals(""))
                  env.put(Context.URL_PKG_PREFIXES, getUrlPkgPrefixes());
              System.out.println("    " + getInitialContextFactory());
              System.out.println("    " + getProviderUrl());
              System.out.println("    " + getUrlPkgPrefixes());
              System.out.println("    " + getEjbName());
              // Get a naming context
              context = new InitialContext(env);
               Object ms  = context.lookup(getEjbName());
              MyEJBHome home = (MyEJBHome ) PortableRemoteObject.narrow(ms, MyEJBHome.class);
              myEjb = home.create();
              return myEjb.getDefaultName();
          } catch (RemoteException re){
              System.out.println(re.getCause().getMessage());
          catch (Exception ex) {
              ex.printStackTrace();
          return null; //if unable to resolve the context factory etc...
        }

    I did exactly as you suggested. I edited the application.xml and added this
    <library path="C:\ArcGIS\test\bea\wlclient.jar"/>
    I didn't add weblogic because the needed classes were all in wlclient.jar
    I also edited the BASE_OB_CLASSPATH to include this jar.
    Here is the result when I just start BPEL PM Server. Somehow BPEL PM doesn't like to have wlclient.jar in its classpath during startup.
    Failed to create "worker" bean; exception reported is: "javax.naming.NameNotFoun
    dException: remaining name: env
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:49)
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:57)
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:62)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at com.collaxa.cube.engine.ejb.impl.WorkerBean.ejbCreate(WorkerBean.java
    :49)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.evermind.server.ejb.MessageDrivenHome.getInstance(MessageDrivenHo
    me.java:1235)
    at com.evermind.server.ejb.MessageDrivenHome$2.run(MessageDrivenHome.jav
    a:1150)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
    sableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:534)
    <2005-12-29 13:39:05,281> <ERROR> <collaxa> <ServerManager::loadAllDomains>
    ORABPEL START-UP ERROR!!!!!!!!
    OraBPEL run-time system failed to start due to exception:
    Could not initialize jms connection pool.
    Could not initialize connection pool for connection factory "java:comp/env/jms/
    ollaxa/BPELInvokerQueueFactory"; the reason is remaining name: env/jms/collaxa/
    PELInvokerQueueFactory.
    Note: So what I did was to removed the entry from application.xml and tried with just obsetenv.bat having the wlclient.jar added to it. This too failed!!
    Here is a snapshot of the error I got.
    Process "BPELProcess2" (revision "1.0") successfully compiled.
    <2005-12-29 13:53:11,207> <INFO> <default.collaxa.cube.engine.deployment> Proces
    s "BPELProcess2" (revision "1.0") successfully loaded.
    05/12/29 13:53:32 Cannot instantiate class: weblogic.jndi.WLInitialContextFactor
    y
    05/12/29 13:53:32 javax.naming.NoInitialContextException: Cannot instantiate cla
    ss: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotF
    oundException: weblogic.jndi.WLInitialContextFactory]
    05/12/29 13:53:32 at javax.naming.spi.NamingManager.getInitialContext(Nami
    ngManager.java:652)
    05/12/29 13:53:32 at javax.naming.InitialContext.getDefaultInitCtx(Initial
    Context.java:243)
    05/12/29 13:53:32 at javax.naming.InitialContext.init(InitialContext.java:
    219)
    05/12/29 13:53:32 at javax.naming.InitialContext.<init>(InitialContext.jav
    a:195)
    05/12/29 13:53:32 at com.esri.adf.ejb.test.MapFinder.getDefaultMapName(Map
    Finder.java:57)
    05/12/29 13:53:32 at bpel.p0.ExecLetBxExe1.execute(ExecLetBxExe1.java:62)
    05/12/29 13:53:32 at com.collaxa.cube.engine.ext.wmp.BPELXExecWMP.__execut
    eStatements(BPELXExecWMP.java:49)
    05/12/29 13:53:32 at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perfo
    rm(BPELActivityWMP.java:185)
    05/12/29 13:53:32 at com.collaxa.cube.engine.CubeEngine.performActivity(Cu
    beEngine.java:3398)
    05/12/29 13:53:32 at com.collaxa.cube.engine.CubeEngine.handleWorkItem(Cub
    eEngine.java:1905)
    05/12/29 13:53:32 at com.collaxa.cube.engine.dispatch.message.instance.Per
    formMessageHandler.handleLocal(PerformMessageHandler.java:75)
    05/12/29 13:53:32 at com.collaxa.cube.engine.dispatch.DispatchHelper.handl
    eLocalMessage(DispatchHelper.java:100)
    05/12/29 13:53:32 at com.collaxa.cube.engine.dispatch.DispatchHelper.sendM

  • EJB/ JNDI Naming reference Help

    Hi,
    The following part has been one of my dark side of J2EE.
    I've an ejb whose jndi-name in weblogic-ejb-jar is "sample".
    Lately i can see the standard way of accesing any ejb is
    java:comp\env\ejb\sample.
    How to access my "Sample" jndi-named ejb using J2EE naming
    convention.
    All help appreciated.
    BTW we are moving from older pre J2EE 1.3 application to
    J2EE 1.3 and wanted to be up with latest standard.
    Thanks,
    Venk

    ejb-link in WLS 6.1 will work only within the same jar file. In WLS 7.0
    (available in BETA) ejb-links can work across jars in the same
    application.
    Anand Byrappagari wrote:
    Use ejb-ref/ejb-link in the deployment descriptor.
    -- Anand
    "Venki" <[email protected]> wrote in message
    news:3c90e6e7$[email protected]..
    Hi,
    The following part has been one of my dark side of J2EE.
    I've an ejb whose jndi-name in weblogic-ejb-jar is "sample".
    Lately i can see the standard way of accesing any ejb is
    java:comp\env\ejb\sample.
    How to access my "Sample" jndi-named ejb using J2EE naming
    convention.
    All help appreciated.
    BTW we are moving from older pre J2EE 1.3 application to
    J2EE 1.3 and wanted to be up with latest standard.
    Thanks,
    Venk
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • Can't access ejb with more than 1 person at the same time?

    I am using the ejb to access the database using DBConnection Pool that I find in book. The code is as follow:
    The problem is when more than one user access almost at the same time, the one who enter frst can access, but the other one can't and return context lookup error in creating EJB.
    What's the problem of it, is it the ejb concurrent access problem or database concurrent access problem?
    package login.database;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.util.Date;
    public class DBConnectionManager {
    static private DBConnectionManager instance;
    static private int clients;
    private Vector drivers = new Vector();
    private PrintWriter log;
    private Hashtable pools = new Hashtable();
    static synchronized public DBConnectionManager getInstance() {
    if (instance == null) {
    instance = new DBConnectionManager();
    clients++;
    return instance;
    private DBConnectionManager() {
    init();
    public void freeConnection(String name, Connection con) {
    DBConnectionPool pool = (DBConnectionPool) pools.get(name);
    if (pool != null){
    pool.freeConnection(con);
    public Connection getConnection(String name) {
    DBConnectionPool pool = (DBConnectionPool) pools.get(name);
    if (pool != null) {
    return pool.getConnection();
    return null;
    public Connection getConnection(String name, long time) {
    DBConnectionPool pool = (DBConnectionPool) pools.get(name);
    if (pool != null) {
    return pool.getConnection(time);
    return null;
    public synchronized void release() {
    if (--clients != 0) {
    return;
    Enumeration allPools = pools.elements();
    while (allPools.hasMoreElements()) {
    DBConnectionPool pool = (DBConnectionPool) allPools.nextElement();
    pool.release();
    Enumeration allDrivers = drivers.elements();
    while (allDrivers.hasMoreElements()) {
    Driver driver = (Driver) allDrivers.nextElement();
    try {
    DriverManager.deregisterDriver(driver);
    log("Deregistered JDBC driver " + driver.getClass().getName());
    } catch (SQLException e) {
    log(e, "Can't deregister JDBC driver: " + driver.getClass().getName());
    private void createPools(Properties props) {
    Enumeration propNames = props.propertyNames();
    while (propNames.hasMoreElements()) {
    String name = (String) propNames.nextElement();
    if (name.endsWith(".url")) {
    String poolName = name.substring(0, name.lastIndexOf("."));
    String url = props.getProperty(poolName + ".url");
    if (url == null) {
    log("No URL specified for " + poolName);
    continue;
    String user = props.getProperty(poolName + ".user");
    String password = props.getProperty(poolName + ".password");
    String maxconn = props.getProperty(poolName + ".maxconn", "0");
    int max;
    try {
    max = Integer.valueOf(maxconn).intValue();
    } catch (NumberFormatException e) {
    log("Invalid maxconn value " + maxconn + "for " + poolName);
    max = 0;
    DBConnectionPool pool = new DBConnectionPool(poolName, url, user, password, max);
    pools.put(poolName, pool);
    log("Initialized pool " + poolName);
    private void init(){
    InputStream is = getClass().getResourceAsStream("db.properties");
    Properties dbProps = new Properties();
    try {
    dbProps.load(is);
    } catch (Exception e) {
    System.err.println("Can't read the properties file. " +
    "Make sure db.properties is in the CLASSPATH");
    return;
    String logFile = dbProps.getProperty("logfile","DBConnectionManager.log");
    try {
    log = new PrintWriter(new FileWriter(logFile, true), true);
    } catch (IOException e) {
    System.err.println("Can't open the log file: " + logFile);
    log = new PrintWriter(System.err);
    loadDrivers(dbProps);
    createPools(dbProps);
    private void loadDrivers(Properties props) {
    String driverClasses = props.getProperty("drivers");
    StringTokenizer st = new StringTokenizer(driverClasses);
    while (st.hasMoreElements()) {
    String driverClassName = st.nextToken().trim();
    try {
    Driver driver = (Driver) Class.forName(driverClassName).newInstance();
    DriverManager.registerDriver(driver);
    drivers.addElement(driver);
    log("Registered JDBC driver " + driverClassName);
    } catch (Exception e) {
    log("Can't register JDBC driver: " + driverClassName + ", Exception: " + e);
    private void log(String msg) {
    log.println(new Date() + ": " + msg);
    private void log(Throwable e, String msg) {
    log.println(new Date() + ": " + msg);
    e.printStackTrace(log);
    class DBConnectionPool {
    private int checkedOut;
    private Vector freeConnections = new Vector();
    private int maxConn;
    private String name;
    private String password;
    private String URL;
    private String user;
    public DBConnectionPool(String name, String URL, String user, String password, int maxConn) {
    this.name = name;
    this.URL = URL;
    this.user = user;
    this.password = password;
    this.maxConn = maxConn;
    public synchronized void freeConnection(Connection con) {
    freeConnections.addElement(con);
    checkedOut--;
    notifyAll();
    public synchronized Connection getConnection() {
    Connection con = null;
    if (freeConnections.size() > 0) {
    con = (Connection) freeConnections.firstElement();
    freeConnections.removeElementAt(0);
    try {
    if (con.isClosed()) {
    log("Removed bad connection from " + name);
    con = getConnection();
    } catch (SQLException e) {
    log("Removed bad connection from " + name);
    con = getConnection();
    else if (maxConn == 0 || checkedOut < maxConn) {
    con = newConnection();
    if (con != null) {
    checkedOut++;
    return con;
    public synchronized Connection getConnection(long timeout) {
    long startTime = new Date().getTime();
    Connection con;
    while ((con = getConnection()) == null) {
    try {
    wait(timeout);
    } catch (InterruptedException e) {}
    if ((new Date().getTime() - startTime) >= timeout) {
    return null;
    return con;
    public synchronized void release() {
    Enumeration allConnections = freeConnections.elements();
    while (allConnections.hasMoreElements()) {
    Connection con = (Connection) allConnections.nextElement();
    try {
    con.close();
    log("Closed connection for pool " + name);
    } catch (SQLException e) {
    log(e, "Can't close connection for pool " + name);
    freeConnections.removeAllElements();
    private Connection newConnection() {
    Connection con = null;
    try {
    if (user == null) {
    con = DriverManager.getConnection(URL);
    else {
    con = DriverManager.getConnection(URL, user, password);
    log("Created a new connection in pool " + name);
    } catch (SQLException e) {
    log(e, "Can't create a new connection for " + URL);
    return null;
    return con;

    Hi,
    static synchronized public DBConnectionManager getInstance() {
    The word "synchronized" will allow only one user at a time to access the getInstance() method which returns DBConnectionManager. Suggest u read some stuff on the same
    As I am not sure which App server ur using, u cld do the following
    1. Create a Conection Pool in ur App Server itself (Weblogic/Websphere/Jboss way)
    2. Create a DataSource which maps to this Connection Pool.
    3. Use the DataSource object which handles poolong of Connections to access the database
    4. As mentioned above, Read notes/documents on "Synchronized" and "Vector" before you use this word in any code of EJB. This will solve ur problem. Read topic called "Collection Framework".
    Seetesh

  • A prefix can be included in the EJB JNDI name dynamically?

    In the Stateless annotation, we can specify the mappedName attribute to the EJB JNDI name bind.
    Can we specify a prefix to the mappedName separately?
    For example: We have this:
    @Stateless(mappedName="myEJB")And don't want to do this:
    @Stateless(mappedName="prefix/myEJB")We want to include the prefix in another place in the code dynamically.
    Can we do that??

    jtahlborn wrote:
    eudesf wrote:
    Hello! Thanks for reply!
    As I can't configure programatically, there is any way to configure in an application descriptor, or in another place of the application server?
    The idea is to publish two applications that use the same EJB classes, but in different JNDI namespaces, because we don't want to share the resources. Otherwise, it will result in JNDI name conflicts. The applications works in different contexts and we want to reuse the existing EJB definitions.
    Any suggestion?yes you can do this. ejb 3.0 keeps the features from 2.1, namely all the xml based configuration (although it is now optional). and, the annotations are always overriden by the xml configuration. thus, you can create different deployments with different the same compiled class files. you just need to override the annotation configuration with xml configuration (via ejb-jar.xml or whatever).Yes, we can do that. I've tested here, and it works. But, can we do better?
    The configuration via XML implies maintenance, and it's not good, because we have so many EJBs to maintain.
    And there is another problem... The EJB classes are in JARs, and these JARs are shared across the applications.
    Pretend that you have to maintain two versions of each EJB JAR. One with XML configured and other without. If we change one, the another must be changed too. How can it be productive?
    I have seen some EJB implementations that are more flexible with JNDI naming.
    See:
    - [http://openejb.apache.org/jndi-names.html|http://openejb.apache.org/jndi-names.html]
    - [http://fixunix.com/weblogic/221782-dynamic-jndi-name-weblogic-ejb-jar-xml.html|http://fixunix.com/weblogic/221782-dynamic-jndi-name-weblogic-ejb-jar-xml.html]
    Does it have a better solution in Glassfish?

  • Error in EJB JNDI Binding for EMP Bean

    Hi friends,
    I need to call a ejb from second ejb ( entity bean from a sission bean). I have defined all xml mapping in ejb.xml.jar and server specific jar file (jboss.xml.jar). I am using boss-4.0.5.GA. But when I am calling that session bean from simple desk top client. It show me this error
    23:48:59,578 ERROR [STDERR] javax.naming.NameNotFoundException: UserLocalHome not bound
    23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
    23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
    23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
    23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    23:48:59,578 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.Transport$1.run(Transport.java:153)
    23:48:59,578 ERROR [STDERR]      at java.security.AccessController.doPrivileged(Native Method)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    23:48:59,578 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:595)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
    23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
    23:48:59,578 ERROR [STDERR]      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
    23:48:59,578 ERROR [STDERR]      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
    23:48:59,578 ERROR [STDERR]      at javax.naming.InitialContext.lookup(InitialContext.java:351)
    23:48:59,578 ERROR [STDERR]      at com.ejb.service.UserFacadeBean.getHome(UserFacadeBean.java:51)
    23:48:59,578 ERROR [STDERR]      at com.ejb.service.UserFacadeBean.getAll(UserFacadeBean.java:74)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    23:48:59,578 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
    23:48:59,578 ERROR [STDERR]      at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
    23:48:59,578 ERROR [STDERR]      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
    23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.Container.invoke(Container.java:954)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    23:48:59,578 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
    23:48:59,578 ERROR [STDERR]      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    23:48:59,578 ERROR [STDERR]      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    23:48:59,578 ERROR [STDERR]      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    23:48:59,578 ERROR [STDERR]      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    23:48:59,578 ERROR [STDERR]      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    23:48:59,578 ERROR [STDERR]      at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
    23:48:59,578 ERROR [STDERR]      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    23:48:59,578 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    23:48:59,578 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
    23:48:59,578 ERROR [STDERR]      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.Transport$1.run(Transport.java:153)
    23:48:59,593 ERROR [STDERR]      at java.security.AccessController.doPrivileged(Native Method)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    23:48:59,593 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:595)
    23:48:59,593 ERROR [STDERR] java.lang.NullPointerException
    23:48:59,593 ERROR [STDERR]      at com.ejb.service.UserFacadeBean.getAll(UserFacadeBean.java:75)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    23:48:59,593 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
    23:48:59,593 ERROR [STDERR]      at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
    23:48:59,593 ERROR [STDERR]      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
    23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.Container.invoke(Container.java:954)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    23:48:59,593 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
    23:48:59,593 ERROR [STDERR]      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    23:48:59,593 ERROR [STDERR]      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    23:48:59,593 ERROR [STDERR]      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    23:48:59,593 ERROR [STDERR]      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    23:48:59,593 ERROR [STDERR]      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    23:48:59,593 ERROR [STDERR]      at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
    23:48:59,593 ERROR [STDERR]      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    23:48:59,593 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    23:48:59,593 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.Transport$1.run(Transport.java:153)
    23:48:59,593 ERROR [STDERR]      at java.security.AccessController.doPrivileged(Native Method)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    23:48:59,593 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:595)
    23:48:59,593 INFO [STDOUT] exit from getAll() method.....
    Can any one help me. how can I resolve it. When I see server log. when I found then one of bean is not perperly bind with jndi name. it showing message like this.
    23:48:21,187 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'FtacostManagerBean' to jndi 'local/FtacostManagerBean@27432016'
    It seems like , it unable to bind Manager Bean with local home. but I am not sure. Please help me. how can I resulve it.
    Here I am sending my ejb config files.
    JBoss.xml.jar
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
    <jboss>
    <enterprise-beans>
    <!--
    To add beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called jboss-beans.xml that contains
    the <session></session>, <entity></entity> and <message-driven></message-driven>
    markup for those beans.
    -->
    <entity>
    <ejb-name>UserBean</ejb-name>
    <local-jndi-name>UserLocalHome</local-jndi-name>
    </entity>
         <session>
    <ejb-name>UserFacadeBean</ejb-name>
    <jndi-name>UserFacadeHome</jndi-name>
    <ejb-local-ref>
    <ejb-ref-name>User</ejb-ref-name>
    <local-jndi-name>UserLocalHome</local-jndi-name>
    </ejb-local-ref>
    </session>
    <!--
    write a merge file jboss-webservices.ent for webservice-description
    -->
    </enterprise-beans>
    <!--
    To specify your own assembly descriptor info here, add a file to your
    XDoclet merge directory called jboss-assembly-descriptor.xml that contains
    the <assembly-descriptor></assembly-descriptor> markup.
    -->
    <assembly-descriptor>
    <!-- message destinations -->
    <!--
    To specify additional message-destination elements, add a file in the merge
    directory called jboss-message-destinations.ent that contains them.
    -->
    </assembly-descriptor>
    <resource-managers>
    </resource-managers>
    <!--
    | for container settings, you can merge in jboss-container.xml
    | this can contain <invoker-proxy-bindings/> and <container-configurations/>
    -->
    </jboss>
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <description>Umashankar beans</description>
    <display-name>Programmed by umashnakar</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <session>
    <display-name>UserFacade</display-name>
    <ejb-name>UserFacadeBean</ejb-name>
    <home>com.ejb.service.UserFacadeHome</home>
    <remote>com.ejb.service.UserFacadeRemote</remote>
    <ejb-class>com.ejb.service.UserFacadeBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <!-- Entity Beans -->
    <entity>
         <description>User Bean Made by Uma</description>     
         <display-name>This is local user Entity</display-name>
         <ejb-name>UserBean</ejb-name>
         <local-home>com.ejb.persistence.UserLocalHome</local-home>
         <local>com.ejb.persistence.UserLocal</local>
         <ejb-class>com.ejb.persistence.UserLocalBean</ejb-class>
         <persistence-type>Container</persistence-type>
         <prim-key-class>java.lang.Integer</prim-key-class>
         <reentrant>false</reentrant>
         <abstract-schema-name>user</abstract-schema-name>
              <cmp-field>
              <field-name>cuId</field-name>
              </cmp-field>
              <cmp-field>
              <field-name>accessCode</field-name>
              </cmp-field>
              <cmp-field>
              <field-name>password</field-name>
              </cmp-field>
              <cmp-field>
              <field-name>creationDate</field-name>
              </cmp-field>
              <cmp-field>
              <field-name>siteId</field-name>
              </cmp-field>
              <primkey-field>cuId</primkey-field>
              <query>
                        <description>Query by accessCode</description>
                        <query-method>
                             <method-name>findByAccessCode</method-name>
                             <method-params>
                                  <method-param>java.lang.String</method-param>
                             </method-params>
                        </query-method>                    
                        <ejb-ql>SELECT OBJECT(u) FROM user AS u WHERE u.accessCode = ?1</ejb-ql>
              </query>
              <query>
                        <description>Query by accessCode</description>
                        <query-method>
                             <method-name>findByPassword</method-name>
                             <method-params>
                                  <method-param>java.lang.String</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT OBJECT(u) FROM user AS u WHERE u.password = ?1</ejb-ql>
              </query>
              <query>
                        <description>Query by accessCode</description>
                        <query-method>
                             <method-name>findByCreationDate</method-name>
                             <method-params>
                                  <method-param>java.sql.Timestamp</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT OBJECT(u) FROM user AS u WHERE u.creationDate = ?1</ejb-ql>
              </query>
              <query>
                        <description>Query by accessCode</description>
                        <query-method>
                             <method-name>findBySiteId</method-name>
                             <method-params>
                                  <method-param>java.lang.Integer</method-param>
                             </method-params>
                        </query-method>
                        <ejb-ql>SELECT OBJECT(u) FROM user AS u WHERE u.siteId = ?1</ejb-ql>
              </query>
              <query>
                        <description>Query by accessCode</description>
                        <query-method>
                             <method-name>findAll</method-name>
                             <method-params/>
                        </query-method>
                             <ejb-ql>SELECT OBJECT(u) FROM user AS u </ejb-ql>
              </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor >
              <container-transaction>
    <method>
    <ejb-name>UserBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>UserFacadeBean</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    Please rep[y me on [email protected]. I appreciate it if you come on google talk.
    Thanks in Advance.
    UmaShankar(TumoDev)
    Software Engineer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    Hi,
    According to WAS 6 , every opened connection has to be commited (or rolledback) explicitly (didnt try autocommit) before closing. Even if all you have done with that connection is a SELECT Query.
    This has apparently solved the same problem I was getting. implement it and see whether it helps you.

  • Weblogic Global JNDI Access Error

    Attempting to access a global JNDI entry from a clustered Weblogic 12c environment. Any attempt to perform a lookup of an object listed under the global JNDI entry (java:global) causes a java.lang.AssertionError exception with a "Context may not be null" message. Lookup of other JNDI objects works as expected.
    The following is a copy of remote test code used to reproduce the problem. It iterates through the root NameClass pairs of the InitialContext retrieved. When it performs a lookup for the "java:global" entry it throws the mentioned exception & message. It has been tested with and without SECURITY_ details with no difference.
    Hashtable<String, Object> environmentValues = new Hashtable<String, Object>();
    environmentValues.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    environmentValues.put(Context.PROVIDER_URL, "t3://ServerName:port");
    environmentValues.put(Context.SECURITY_PRINCIPAL, "userId");
    environmentValues.put(Context.SECURITY_CREDENTIALS, "password");
    try {
         InitialContext jndi = new InitialContext(environmentValues);
         NamingEnumeration<NameClassPair> namingEnumerations = jndi.list("");
         while(namingEnumerations.hasMore()) {
              NameClassPair ncp = namingEnumerations.next();
              System.out.println(ncp.getName() + " - " + ncp.getClassName());
              Object obj = jndi.lookup(ncp.getName());
              System.out.println("Object '" + ncp.getName() + "' lookup successful.");
    } catch(Exception e) {
         e.printStackTrace();
    }

    Attempting to access a global JNDI entry from a clustered Weblogic 12c environment. Any attempt to perform a lookup of an object listed under the global JNDI entry (java:global) causes a java.lang.AssertionError exception with a "Context may not be null" message. Lookup of other JNDI objects works as expected.
    The following is a copy of remote test code used to reproduce the problem. It iterates through the root NameClass pairs of the InitialContext retrieved. When it performs a lookup for the "java:global" entry it throws the mentioned exception & message. It has been tested with and without SECURITY_ details with no difference.
    Hashtable<String, Object> environmentValues = new Hashtable<String, Object>();
    environmentValues.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    environmentValues.put(Context.PROVIDER_URL, "t3://ServerName:port");
    environmentValues.put(Context.SECURITY_PRINCIPAL, "userId");
    environmentValues.put(Context.SECURITY_CREDENTIALS, "password");
    try {
         InitialContext jndi = new InitialContext(environmentValues);
         NamingEnumeration<NameClassPair> namingEnumerations = jndi.list("");
         while(namingEnumerations.hasMore()) {
              NameClassPair ncp = namingEnumerations.next();
              System.out.println(ncp.getName() + " - " + ncp.getClassName());
              Object obj = jndi.lookup(ncp.getName());
              System.out.println("Object '" + ncp.getName() + "' lookup successful.");
    } catch(Exception e) {
         e.printStackTrace();
    }

Maybe you are looking for