Lookup EJB without JNDI

Hi,
Using WLS7.0 on HP-UX,
I have my client and the EJBs on the same WL server. Tilll WL6.0 I had
to do a JNDI lookup to get to my EJB on my local machine. I noticed that
it has a huge overhead attached to the lookup. In WL 7.0 is there any
other way to lookup EJBs other than JNDI if they all reside in the same
WLS container.
Thanks
Raj

Hi,
Using WLS7.0 on HP-UX,
I have my client and the EJBs on the same WL server. Tilll WL6.0 I had
to do a JNDI lookup to get to my EJB on my local machine. I noticed that
it has a huge overhead attached to the lookup. In WL 7.0 is there any
other way to lookup EJBs other than JNDI if they all reside in the same
WLS container.
Thanks
Raj

Similar Messages

  • Fail to lookup the local EJB by JNDI in Managed Server

    Hi all,
    I currently in a deep problem, and can't figure out the cause of it. It just annoying me for week.
    In my app, I have binded to the local ejb to JNDI (let's say "ejb/CustomerLocal"), then the client lookup the Local EJB by the following code.
    localIc = new InitialContext();
    home = (EJBLocalHome)localIc.lookup("ejb/CustomerLocal");
    It works well as I do development in the Domain Admin Server. However, when I do the System Integration Test and deploy my app to the managed server, the app fail. It just can't do the Local EJB lookup. Following is the exception.
    javax.naming.NameNotFoundException: Unable to resolve 'ejb/CustomerLocal' Resolved ejb[Root exc
    eption is javax.naming.NameNotFoundException: Unable to resolve 'ejb.CustomerLocal' Resolved ejb
    ]; remaining name CustomerLocal'
    Does anybody know the cause of it and have solution?
    Thanks a lot

    Hi,
    Just now I replicated the same problem what you are facing. I created one managed server. When I deployed my ejb to admin server I did not get any problem. But when I deploy the same into my managed server I got Naming Exception. Because I did n/t specify Context.PROVIDER_URL. A provider URL contains bootstrap server information that the initial context factory can use to obtain an initial context. So when you deploy EJB on another server, you have to get the Naming service from that server. Hence provider URL must pointing to that server. So I included following statements before lookup my ejb in managed server.
    Properties p=new Properties ();
    p.put (Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    p.put (Context.PROVIDER_URL,"t3://localhost: 7003");
    Context ctx=new InitialContext (p);
    FacadeHome home=(FacadeHome) ctx.lookup ("ejb/CustomerLocal");
    In my case managed server port number is 7003. Now onwards managed server (Port number 7003) will provide ‘Naming Service’, not by admin server (port number 7001), which is default.
    Note: Context.PROVIDER_URL— specifies the URL of the WebLogic Server that provides the name service. The default is t3://localhost: 7001. When you are not specified it will assume that POVIDER_URL is t3://localhost: 7001 this is nothing but your admin server in your case. However, a JNDI client may need to access a name space other than the one identified in its environment. In this case, it is necessary to explicitly set the java.naming.provider.url (provider URL) property used by the InitialContext constructor.
    I hope it helps.
    Regards,
    Kuldeep Singh.

  • I can't lookup EJB (3.0) in WebLogic 12 using ENC

    I have a simple application divided in 2 modules:
    HolaMundo - Servlet component
    SimpleEJB - EJB Component
    The EJB Component use EJB 3.0. I created a local business interface with one method. A stateless EJB that implement that interface. And I use the ejb-jar.xml for declare it.
    And a Servlet that use the EJB.
    In Glassfish or Tomee this way for working with EJB works, but i don't understand why it doesn't work in WebLogic 12...
    When i try to access to the servlet, i get an error. this is the error:
    javax.naming.NameNotFoundException: While trying to look up /app/SimpleEJB/Example!com.edwin.ejb.ExampleLocal in /app/webapp/HolaMundo.war/1051995086.; remaining name '/app/SimpleEJB/Example!com/edwin/ejb/ExampleLocal'
      at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1180)
      at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:146)
    Servlet:
    package servlet;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import com.edwin.ejb.ExampleLocal;
    public class EJB extends HttpServlet {
       private static final long serialVersionUID = 1L;
       @Override
       protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1)
       throws ServletException, IOException {
       PrintWriter out = arg1.getWriter();
       ExampleLocal el2;
       try {
      el2 = (ExampleLocal) new InitialContext()
       .lookup("java:app/SimpleEJB/Example!com.edwin.ejb.ExampleLocal");
       out.println("EJBBBB: " + el2.nombre());
       } catch (NamingException e) {
      e.printStackTrace();
    Local business interface:
    package com.edwin.ejb;
    public interface ExampleLocal {
        public String nombre();
    EJB Stateless:
    package com.edwin.ejb;
    public class Example implements ExampleLocal{
        @Override
        public String nombre() {
            return "Edwin";
    ejb-jar.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
      <display-name>SimpleEJB </display-name>
      <enterprise-beans>
        <session>
            <ejb-name>Example</ejb-name>
            <business-local>com.edwin.ejb.ExampleLocal</business-local>
            <ejb-class>com.edwin.ejb.Example</ejb-class>
            <session-type>Stateless</session-type>
        </session>
      </enterprise-beans>
    </ejb-jar>

    Both answers did not work. I do not understand why it did not work because in other Java EE Servers it works.
    My JNDI Tree (Screenshot):
    http://oi58.tinypic.com/vs1jjd.jpg
    However, i could get the EJB when i use the Global ENC, but i got a Casting Exception...
    Eg:
    try {
      ej = (EjLocal) new InitialContext().lookup("java:global.EjemploEJB.Ej!stateless.EjLocal");
      out.print("EJ: "+ej.ej());
    } catch (NamingException e) {
      e.printStackTrace();
    Output:
    java.lang.ClassCastException: stateless.Ej_1aafe_EjLocalImpl cannot be cast to stateless.EjLocal
    at servlet.Ejemplo.doGet(Ejemplo.java:33)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731).....
    There is a strange value in the EJB's JNDI Tree:
    Header 1
    Header 2
    Binding Name:
    java:global.EjemploEJB.Ej!stateless.EjLocal
    Class:
    stateless.Ej_1aafe_EjLocalImpl
    Hash Code:
    2021087981
    toString Results:
    stateless.Ej_1aafe_EjLocalImpl@78775aed

  • Ejb-link jndi issue

    Hi,
    I am trying to hook up a web service that talks to one of my EJBs. I feel that
    I have followed the instructions to the letter, but no matter what I do I keep
    getting a ServletException when I try to deploy it.
    The EJB I am trying to invoke is deployed in an ejb module called SunstartEJBModule
    which is deployed within an application called SunstartApplication.
    This is the build file I am using:
    <project name="buildWebservice" default="generate-typeinfo">
    <target name="generate-typeinfo">
    <source2wsdd
         javaSource="sunstart/ejbs/webservices/StudentWS.java"
         ejbLink="SunstartEJBModule.jar#ejb/StudentWS"
         ddFile="ddfiles/web-services.xml"
         serviceURI="/StudentService"
    />
    </target>
    <target name="generate-webservice">
    <wspackage
    output="ears/SunstartApplication.ear"
    contextURI="web_services"
    webAppClasses="com.sun.ad.sunstart.ejbs.webservices.StudentWS"
    ddFile="ddfiles/web-services.xml"
    overwrite="false"
    />
    </target>
    </project>
    The SunstartWS ejb is definitely deployed as I can access it using my ServiceLocator
    using java:comp/env/ejb/StudentWS. I notice in the server error log it is trying
    to use a slightly different JNDI name to this - java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/home
    but I can't see how I can control this in the ant script because whenever I remove
    the "SunstartEJBModule.jar#ejb/StudentWS" part and change it to "ejb/StudentWS"
    it won't even deploy.
    The full exception trace I am seeing is:
    javax.servlet.ServletException: ERROR: The EJB component named: StudentWS specified
    an ejb-link to SunstartEJBModule.jar#ejb/StudentWS, but this ejb-link could not
    be found in JNDI. Please ensure that this ejb-link refers to a valid EJB, and
    this EJB has already deployed. The exception was: javax.naming.NamingException:
    Could not lookup EJB home, tried java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/home
    and java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/localhome
         at weblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebServiceServlet.java:132)
         at weblogic.webservice.server.servlet.WebServiceServlet.init(WebServiceServlet.java:86)
         at javax.servlet.GenericServlet.init(GenericServlet.java:258)
         at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:993)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:869)
         at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:848)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:787)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3252)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3197)
         at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3174)
         at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:5647)
         at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:869)
         at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2022)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2063)
         at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2592)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
         at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2317)
         at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2399)
         at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2311)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2479)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    >
    If anyone know what I Am doing wrong I would be grateful if they would let me
    know as this has been driving me nuts over the past few days!
    Cheers,
    Lucas.

    Here is am working example of how to use source2wsdd
    with an EJB.
    http://manojc.com/?sample10
    Please check if this works ok for you.
    Regards,
    -manoj
    http://manojc.com
    "Lucas King" <[email protected]> wrote in message
    news:40d9b346$1@mktnews1...
    >
    Hi,
    I am trying to hook up a web service that talks to one of my EJBs. I feelthat
    I have followed the instructions to the letter, but no matter what I do Ikeep
    getting a ServletException when I try to deploy it.
    The EJB I am trying to invoke is deployed in an ejb module calledSunstartEJBModule
    which is deployed within an application called SunstartApplication.
    This is the build file I am using:
    <project name="buildWebservice" default="generate-typeinfo">
    <target name="generate-typeinfo">
    <source2wsdd
    javaSource="sunstart/ejbs/webservices/StudentWS.java"
    ejbLink="SunstartEJBModule.jar#ejb/StudentWS"
    ddFile="ddfiles/web-services.xml"
    serviceURI="/StudentService"
    />
    </target>
    <target name="generate-webservice">
    <wspackage
    output="ears/SunstartApplication.ear"
    contextURI="web_services"
    webAppClasses="com.sun.ad.sunstart.ejbs.webservices.StudentWS"
    ddFile="ddfiles/web-services.xml"
    overwrite="false"
    />
    </target>
    </project>
    The SunstartWS ejb is definitely deployed as I can access it using myServiceLocator
    using java:comp/env/ejb/StudentWS. I notice in the server error log it istrying
    to use a slightly different JNDI name to this -java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/home
    but I can't see how I can control this in the ant script because wheneverI remove
    the "SunstartEJBModule.jar#ejb/StudentWS" part and change it to"ejb/StudentWS"
    it won't even deploy.
    The full exception trace I am seeing is:
    javax.servlet.ServletException: ERROR: The EJB component named: StudentWSspecified
    an ejb-link to SunstartEJBModule.jar#ejb/StudentWS, but this ejb-linkcould not
    be found in JNDI. Please ensure that this ejb-link refers to a valid EJB,and
    this EJB has already deployed. The exception was:javax.naming.NamingException:
    Could not lookup EJB home, triedjava:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/home
    and java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/localhome
    atweblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebServiceSer
    vlet.java:132)
    atweblogic.webservice.server.servlet.WebServiceServlet.init(WebServiceServlet.
    java:86)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    atweblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubI
    mpl.java:993)
    atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:317)
    atweblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    atweblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java
    :869)
    atweblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.ja
    va:848)
    atweblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
    a:787)
    atweblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletC
    ontext.java:3252)
    atweblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServlet
    Context.java:3197)
    atweblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServle
    tContext.java:3174)
    atweblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletConte
    xt.java:5647)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:869)
    atweblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2
    022)
    atweblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.jav
    a:2063)
    atweblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activat
    eContainer(SlaveDeployer.java:2592)
    at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
    atweblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.jav
    a:2317)
    atweblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDep
    loyer.java:2399)
    atweblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.ja
    va:2311)
    atweblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDep
    loyer.java:2479)
    atweblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeplo
    yer.java:798)
    atweblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.ja
    va:507)
    atweblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.j
    ava:465)
    atweblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.ja
    va:25)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    >
    If anyone know what I Am doing wrong I would be grateful if they would letme
    know as this has been driving me nuts over the past few days!
    Cheers,
    Lucas.

  • Unable to lookup ejb local home interface after moving to wls 7.0

    I'm getting an exception trying to lookup an ejb's local home interface
    which I believe was deployed correctly. On startup I get the message:
    EJB Deployed EJB with JNDI name
    com.logistics.basedata.ejb.shipperspecificfveb.ShipperSpecificFVDOLocalHome.
    However, when I try to do a lookup using this jndi name, I get the
    following exception:
    javax.naming.LinkException: . Root exception is
    javax.naming.NameNotFoundException: Unable to resolve
    'app/ejb/ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb/local-home'
    Resolved: 'app/ejb'
    Unresolved:'ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb'
    ; remaining name
    'ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb/local-home'
    The name it can't resolve is different than the name I was trying to
    look up. I can see
    com.logistics.basedata.ejb.shipperspecificfveb.ShipperSpecificFVDOLocalHome
    in the jndi tree through the admin console, but the attributes Object
    Class, Object Hash Code, and Object To String are blank.
    This worked with weblogic 6.1 sp3. Is there something I missed in the
    migration to 7.0?
    Any help would be appreciated. Thanks in advance,
    -Brad

    That explains it - in 7.0 (unlike 6.1 - then the only factor was
    classloaders arrangement) client has to be
    in the same application (ear) - note JNDI links used to be able to lookup
    local homes.
    "Brad Geddes" <[email protected]> wrote in message
    news:[email protected]...
    I'm looking it up from a web application. I did notice a message on thistopic
    from last thursday (subject: "Pls Help! Failed to access local Sessionbean in
    7.0!"). In it, the individual said he had to add ejb-local-ref elementsin the
    web.xml. I tried this but can't seem to get it to work.
    javax.naming.NameNotFoundException: Unable to resolve ejb-link.
    ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb isnot in
    the context. The context includes the following link bindings: {} Makesure the
    link reference is relative to the URI of the referencing module.
    Also, I don't have a war or ear in the environment I'm working in; theejb's are
    all deployed separately in jar files, and the web app is in explodedformat.
    >
    -Brad
    "Dimitri I. Rakitine" wrote:
    Are you looking up the local home from outside of an application ?
    "Brad Geddes" <[email protected]> wrote in message
    news:[email protected]...
    I'm getting an exception trying to lookup an ejb's local home
    interface
    which I believe was deployed correctly. On startup I get the message:
    EJB Deployed EJB with JNDI name
    com.logistics.basedata.ejb.shipperspecificfveb.ShipperSpecificFVDOLocalHome.
    >>>
    However, when I try to do a lookup using this jndi name, I get the
    following exception:
    javax.naming.LinkException: . Root exception is
    javax.naming.NameNotFoundException: Unable to resolve
    'app/ejb/ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificf
    veb/local-home'
    Resolved: 'app/ejb'
    Unresolved:'ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecif
    icfveb'
    ; remaining name
    'ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb/loca
    l-home'
    The name it can't resolve is different than the name I was trying to
    look up. I can see
    com.logistics.basedata.ejb.shipperspecificfveb.ShipperSpecificFVDOLocalHome
    in the jndi tree through the admin console, but the attributes Object
    Class, Object Hash Code, and Object To String are blank.
    This worked with weblogic 6.1 sp3. Is there something I missed in the
    migration to 7.0?
    Any help would be appreciated. Thanks in advance,
    -Brad
    Dimitri--
    Dimitri

  • How to rename a EJB's jndi name?

    Using Sun Appserver, having deployed all EJBs, I want to rename a EJB's jndi name, for instance,
    to rename object "java:comp/env/ejb/User" to "java:comp/env/ejb/User1". By using InitialContext.rename(oldName,newName), a NamingException is thrown and its message is "java:comp namespace cannot be modified ". How to solve it?

    It is not possible.
    Prohibited by the EJB spec.

  • How to lookup EJBs deployed in OC4J from a standalone client application

    Hello all,
    I am trying to lookup an EJB deployed in OC4J 10.1.3 from a standalone client application using the following code:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.PROVIDER_URL, "ormi://localhost:23791");
    env.put(Context.SECURITY_PRINCIPAL, "jazn.com/test");
    env.put(Context.SECURITY_CREDENTIALS, "test");
    Context context = new InitialContext(env);
    Object ref = context.lookup("ejb/Dispatch");
    I get the following error:
    javax.naming.NameNotFoundException: ejb/Dispatch not found
         at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
    For the lookup string I've also tried:
    "java:comp/env/ejb/Dispatch" and "Dispatch"
    For the Context.PROVIDER_URL property I've also tried:
    opmn:ormi://localhost:6003:instance
    The result is always the same.
    I appreciate if someone could help me with this?
    Thanks,
    Georgi

    Georgi,
    Your question has been discussed many times on this forum. Search the forum archives for "RMIInitialContextFactory".
    The PROVIDER_URL needs to include the name of the deployed application that your EJB is part of, for example:
    env.put(Context.PROVIDER_URL, "ormi://localhost:23791/MyApp");The lookup name has to be the value of the "ejb-name" element in your "ejb-jar.xml" descriptor file.
    Your SECURITY_PRINCIPAL value looks strange to me. Personally, I use "principals" (and not JAZN), so I modified the "application.xml" file (in the "j2ee/home/config" subdirectory) to use "principals". Look for the following comment in that file:
    &lt;!-- Comment out the jazn element to use principals.
          When both jazn and principals are present jazn is used  --&gt;Good Luck,
    Avi.
    Message was edited by:
    Avi Abrami

  • Call weblogic EJB without using weblogic.jndi.T3InitialContextFactory

    I am trying to call an ejb on a weblogic server without using weblogic.jndi.T3InitialContextFactory.
    The context retrieval is as follows:
    Properties table = new Properties();
    table.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
    table.put(Context.PROVIDER_URL, "iiop://localhost:7001");
    Context context = new InitialContext(table);
    return context;
    but when I run the client I am getting the follwing error:
    javax.naming.CommunicationException: Cannot connect to ORB [Root exception is org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No]
    at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:362)
    at com.sun.jndi.cosnaming.CNCtx.initUsingIiopUrl(CNCtx.java:289)
    at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:245)
    at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:209)
    at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:69)
    at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.java:32)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    at com.test.TestDirectDocumentLoad.getContext(TestDirectDocumentLoad.java:59)
    at com.test.TestDirectDocumentLoad.loadDocs(TestDirectDocumentLoad.java:139)
    at com.test.TestDirectDocumentLoad.main(TestDirectDocumentLoad.java:116)
    Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
    at com.sun.corba.se.internal.iiop.ConnectionTable.getConnection(ConnectionTable.java:173)
    at com.sun.corba.se.internal.iiop.ConnectionTable.getConnection(ConnectionTable.java:65)
    at com.sun.corba.se.internal.iiop.GIOPImpl.getConnection(GIOPImpl.java:67)
    at com.sun.corba.se.internal.corba.ClientDelegate.createRequest(ClientDelegate.java:652)
    at com.sun.corba.se.internal.corba.ClientDelegate.createRequest(ClientDelegate.java:594)
    at com.sun.corba.se.internal.corba.InitialNamingClient.resolve(InitialNamingClient.java:1105)
    at com.sun.corba.se.internal.corba.InitialNamingClient.resolveUsingBootstrapProtocol(InitialNamingClient.java:788)
    at com.sun.corba.se.internal.corba.InitialNamingClient.cachedInitialReferences(InitialNamingClient.java:1186)
    at com.sun.corba.se.internal.corba.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:1079)
    at com.sun.corba.se.internal.corba.ORB.resolve_initial_references(ORB.java:2436)
    at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:340)
    ... 12 more
    I have the J2EE jar on the client path and all....but can't get through this error
    need help guys!
    Samir

    Samir j <> writes:
    Make sure IIOP is enabled on the server side. There was a bug in
    earlier 8.1 config wizards that defaulted it to off.
    andy
    I am trying to call an ejb on a weblogic server without using weblogic.jndi.T3InitialContextFactory.
    The context retrieval is as follows:
    Properties table = new Properties();
    table.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
    table.put(Context.PROVIDER_URL, "iiop://localhost:7001");
    Context context = new InitialContext(table);
    return context;
    but when I run the client I am getting the follwing error:
    javax.naming.CommunicationException: Cannot connect to ORB [Root exception is org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No]
    at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:362)
    at com.sun.jndi.cosnaming.CNCtx.initUsingIiopUrl(CNCtx.java:289)
    at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:245)
    at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:209)
    at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:69)
    at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.java:32)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    at com.test.TestDirectDocumentLoad.getContext(TestDirectDocumentLoad.java:59)
    at com.test.TestDirectDocumentLoad.loadDocs(TestDirectDocumentLoad.java:139)
    at com.test.TestDirectDocumentLoad.main(TestDirectDocumentLoad.java:116)
    Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
    at com.sun.corba.se.internal.iiop.ConnectionTable.getConnection(ConnectionTable.java:173)
    at com.sun.corba.se.internal.iiop.ConnectionTable.getConnection(ConnectionTable.java:65)
    at com.sun.corba.se.internal.iiop.GIOPImpl.getConnection(GIOPImpl.java:67)
    at com.sun.corba.se.internal.corba.ClientDelegate.createRequest(ClientDelegate.java:652)
    at com.sun.corba.se.internal.corba.ClientDelegate.createRequest(ClientDelegate.java:594)
    at com.sun.corba.se.internal.corba.InitialNamingClient.resolve(InitialNamingClient.java:1105)
    at com.sun.corba.se.internal.corba.InitialNamingClient.resolveUsingBootstrapProtocol(InitialNamingClient.java:788)
    at com.sun.corba.se.internal.corba.InitialNamingClient.cachedInitialReferences(InitialNamingClient.java:1186)
    at com.sun.corba.se.internal.corba.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:1079)
    at com.sun.corba.se.internal.corba.ORB.resolve_initial_references(ORB.java:2436)
    at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:340)
    ... 12 more
    I have the J2EE jar on the client path and all....but can't get through this error
    need help guys!
    Samir

  • Calling non ejb from ejb using jndi lookup

    Is it possible to call a non ejb java object from an ejb using a jndi lookup?
    For example, we have a java class where main registers itself with our application server (JBoss 3.0.1). We have a test client that can use jndi to look up the object, but we can't get an ejb inside the application server to use the object.
    Are we trying to do the impossible? If my question is not clear, please let me know so I can try to clarify.
    Thanks

    JNDI uses factories to create objects.
    It's possible that JBoss has a Bean Factory which you can use to create your instance.
    Tomcat has a Bean factory in its JNDI implementation. I use it just as you have indicated.
    The JBoss documenation may help?
    Dave

  • EJB 3 JNDI lookup with WL 12c (12.1.1) Exception

    Hi all,
    I'm trying to lookup an EJB inside my application with the following code :
    Context ctx = new InitialContext();
    ctx.lookup("java:module/MyEJB");
    it throws this Exception :
    javax.naming.NamingException [Root exception is java.rmi.RemoteException: weblogic.ejb.container.internal.StatelessLocalObject; nested exception is:
         java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject]
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
         at javax.faces.component.UICommand.broadcast(UICommand.java:315)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
         Truncated. see log file for complete stacktrace
    Caused By: javax.faces.el.EvaluationException: javax.naming.NamingException [Root exception is java.rmi.RemoteException: weblogic.ejb.container.internal.StatelessLocalObject; nested exception is:
         java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject]
         at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
         at javax.faces.component.UICommand.broadcast(UICommand.java:315)
         at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
         at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
         Truncated. see log file for complete stacktrace
    Caused By: javax.naming.NamingException [Root exception is java.rmi.RemoteException: weblogic.ejb.container.internal.StatelessLocalObject; nested exception is:
         java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject]
         at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:86)
         at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:466)
         at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:256)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:406)
         at weblogic.jndi.internal.ApplicationNamingNode.resolveObject(ApplicationNamingNode.java:170)
         Truncated. see log file for complete stacktrace
    Caused By: java.rmi.RemoteException: weblogic.ejb.container.internal.StatelessLocalObject; nested exception is:
         java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject
         at weblogic.jndi.internal.WLEventContextImpl.copyObject(WLEventContextImpl.java:384)
         at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:251)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:406)
         at weblogic.jndi.internal.ApplicationNamingNode.resolveObject(ApplicationNamingNode.java:170)
         at weblogic.jndi.internal.BasicNamingNode.resolveObject(BasicNamingNode.java:856)
         Truncated. see log file for complete stacktrace
    Caused By: java.io.NotSerializableException: weblogic.ejb.container.internal.StatelessLocalObject
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
         at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
         at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
         at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
         Truncated. see log file for complete stacktrace
    i'm using WL 12c, JDK 1.6.29.
    regards.

    I can't upload all the project, but i will upload the [required files|http://dl.dropbox.com/u/79750638/WLForum.7z] .
    inform me if you need more info.
    thanks

  • EJB 3 jndi lookup from glassfish to glassfish

    Hi,
    I have a big problem with remote access to EJB3 deployed on a glassfish server . I can get it work from a SE client or a Tomcat server but when I deploy the same code on another glassfish server,
    I get a javax.naming.NameNotFoundException.
    Here is my lookup code :
         prop.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
                             prop.setProperty("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
                             prop.setProperty("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
                             prop.setProperty("java.naming.provider.url","iiop://192.168.2.13:3700");
                             prop.setProperty("org.omg.CORBA.ORBInitialPort","3700");
                             prop.setProperty("org.omg.CORBA.ORBInitialHost","192.168.2.13");
                             System.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.2.13");
                             System.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
                             InitialContext ic = new InitialContext(prop);
                             out.println("found :"+ic.lookup("big.com.model.MyEJBRemote"));any help welcome.
    thank.

    Have you tried this: https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    Specifically using the no-arg constructor?

  • Lookup ejb in another application in same container

    Hi,
    The 1012 ejb faq http://www.oracle.com/technology/tech/java/oc4j/1012/collateral/OC4J-EJB-FAQ-101202.pdf states:
    "If you want to access an EJB in another application in the same OC4J container you do not have to use RMIInitialContextFactory and you can make the application that contains your application as the parent of your application from your you are trying to access EJBs from e.g. ..."
    Question: The FAQ implies that the "parent" attribute is NOT necessary to facilitate this situation and RMIInitialContextFactory may be used - is this correct? I have not found any examples that demonstrate how to do this as elsewhere in the Oracle doco they seem to imply that "parent" must be used (but not in 10.1.3). Can anyone please clarify this and/or what works and what doesn't?
    Note: The lookup of remote ejb from another application in same container does work without the parent attribute, its just subsequent calls from a 3rd application or redeploy breaks.
    My problem: I get a ClassCastException when :
    a) lookup remote EJB (in application A) following redeploy of application B
    b) the next invocation of the application A method from client application C
    Thanks for any advice,
    Paul

    Your understanding is correct.
    If you make application a to be the parent application of app b; then app b could access app a without using RMIInitialContext.
    Also you could use RMIInitialContext to obtain the object without using "parent application" approach, example:
    Hashtable env = new Hashtable();
    env.put("java.naming.factory.initial",
    "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put("java.naming.provider.url","ormi://remotehost/bmpapp");
    env.put("java.naming.security.principal","SCOTT");
    env.put("java.naming.security.credentials","TIGER");
    Context context = new InitialContext(env);
    Object homeObject =
    context.lookup("java:comp/env/EmployeeBean");
    For this servlet example, you also need to declare <ejb-ref> elements in the web.xml file:
    <ejb-ref>
    <ejb-ref-name>EmployeeBean</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>bmpapp.EmployeeHome</home>
    <remote>bmpapp.Employee</remote>
    </ejb-ref>
    In addition, orion-web.xml, must include a mapping from the logical name EmployeeBean to the actual JNDI name where the EJB is bound, as shown in the following example:
    <ejb-ref-mapping name="EmployeeBean" location="bmpapp/EmployeeBean" />
    Hope this helps,
    -Frances

  • Can I modify the value of an enviroment entry for an EJB without having to re-deploy.

    I wish to modify the value of an envrioment entry for an EJB. The entry already exists and has been created using
    <env-entry>
    <env-entry-name>myFlag</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>true</env-entry-value>
    </env-entry>
    I can access the value using code similar to the following:-
    InitialContext initialContext = new InitialContext();
    String value = (String) initialContext.lookup("myFlag");
    However if I try the following:-
    InitialContext initialContext = new InitialContext();
    initialContext.rebind("myFlag", "false");
    I get an OperationNotSupportedException thrown.
    Do I need to use LDAP directly (rather than through JNDI) to modify this value or is there another / better way? If I do need to use LDAP directly what would the code look like ?

    Hi,
    As per J2EE specification:
    Naming environment entries allow customization of a component during deployment or assembly without the need to access or change the component?s source code. The container implements the naming environment, and provides it to the component instance through a JNDI naming context.
    The Deployer can modify values of environment entries that have been previously set by the Application Component Provider and/or Application Assembler.
    Generally only those variables/properties are set in environment entries which are likely to be different on various Application server configurations/installations, so it is not required/advisable to change these entries programmatically. Any way iAS-6.0/6.5 doesn't support changing environment entries programmatically, it binds all the JNDI names during Server startup after reading it from the registry.
    For your purpose you can use a boolean variable in your code to set your flag, and may be put it into session.
    Please feel free to ask further questions.
    Sanjeev,
    Developer Support, Sun ONE Application Server-India.

  • Unable to Find EJB in JNDI Tree

    Good Morning to All!
    I have been scratching my head all day yesterday trying to understand this error:
    [2005-06-15 09:44:38,203][Servlet.Engine.Transports : 1][FATAL][{ServiceLocator}{getHome}{CONFIG0001}{Failed to find EJB Reference from JNDI tree}{External Message:Name comp/env/ejb not found in context "java:".}]
    {ServiceLocator}{getHome}{CONFIG0001}{Failed to find EJB Reference from JNDI tree}{External Message:Name comp/env/ejb not found in context "java:".}
    What is going on is the user is logging into the web application. The process is the user comes in from the web container and enters the EJB container through the AdminEJB. The AdminEJB has a reference to a singleton POJO entitled ServiceLocator. This POJO follows the locator pattern. One of the things the Locator is attempting to accomplish is retrieving the CacheEJBLocalHome. This Cache ejb has a JNDI name of
    ejb/CacheEJBHome
    I have promoted the Cache ejb to the Local and the Remote interfaces using WSAD.
    I realize the lookup method can not find the EJB, but I do not know what is causing this behavior. I originally thought the AdminEJB needed a bean reference to the CacheEJB, but this did not work.
    Any insight or debugging techniques into this issue would be greatly appreciated.
    Thank you for reading my post.
    Russ

    Hi Ten,
    FYI, just by placing the ejb jar inside EAR project it will not be picked up for deployment. The EJB module has to be defined on EAR Module Assembly, and the steps are:
    > EAR Project | Properties, Deployment Assembly - Add EJB module
    NOTE: To verify the dependency you could try to export the EAR project to an .ear file. If the exported .ear file bundles ejb jar then deployment should work fine.
    As far as the deployment mode, OEPE supports WebLogic Split-source (default) and Exploded archive. In the default split-source mode, the .beabuild.txt contains the mapping to the actual files whereas in exploded archive the files are copied over to deployment staging location.
    Steps to modify deployment mode:
    > In the server view, right click on server configuration | Properties, select WebLogic | Publishing
    Please make sure the ejb module is defined appropriately and let me know if this resolves the issue.
    Thanks,
    Ram

  • EJB and JNDI

    Hi,
    Suppose if I want to register a string with the JNDI and access it
    within the bean using the lookup, how should I go doing this. The binded
    string should be permanent. How this could be achieved in the weblogic
    environment.
    Thanks!

    Answered in the ejb newsgroup. Please do not cross-post to multiple
    newsgroups.
    -- Rob
    hari wrote:
    >
    Hi,
    Suppose if I want to register a string with the JNDI and access it
    within the bean using the lookup, how should I go doing this. The binded
    string should be permanent. How this could be achieved in the weblogic
    environment.
    Thanks!--
    Coming Soon: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnweblogic.com

Maybe you are looking for

  • Names changed in itunes don't update on iPod Touch

    I have a brand new 32 gb iPod touch which won't hold all of my music. I checked the convert to 128 kbps AAC so that I can get the whole collection on. The problem is I was cleaning up the names of some of my ripped music and I had a band that was lis

  • Virtual Directory License

    According to some literature out there. One can continue to run Virtual Directory for up to 6 months as an evaluation/demo system We completed our install of Identity Center and Virtual Directory. However, upon startup of VDS, we got a message that l

  • Terminal command to restart Samba?

    Anyone know what the terminal command is to restart Samba under OS X 10.5.4? I've searched all over and can't seem to find the answer to this question. I've tried... /etc/rc.d/init.d/smb restart Not valid under OS X sudo killall -HUP smbd Not sure if

  • Photoshop Crashing FIXED!!!

    Thanks for everyone that reached and tried to help with this issue. I finally resolved the problem. I figured out that by deleting the Adobe folder within the AppData folder fixed the startup crashes. The Adobe folder will regenerate itself therefore

  • Select values from table%ROWTYPE variable into a cursor

    I have a stored procedure which has an OUT parameter of table1%ROWTYPE. In future we might have to add more OUT parameters of table2%ROWTYPE etc. But at any point of time only one will have values. So instead of having table%ROWTYPE as OUT parameter,