NameNotFoundException on lookup - Weblogic

This is a discussion on NameNotFoundException on lookup - Weblogic ; I see a bunch of questions in this area, but not a solution. I have an applet that tries to instantiate a stateless session bean to talk back to the server. I have an ear deployment that contains a bean ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: NameNotFoundException on lookup

  1. NameNotFoundException on lookup


    I see a bunch of questions in this area, but not a solution.

    I have an applet that tries to instantiate a stateless session bean to talk back
    to the server.

    I have an ear deployment that contains a bean (jar) & a application (war). The
    bean has a jndi entry (that I can see in the admin console, I can test the ejb
    in the admin console as well), but when the applet (that is in the war), does
    a lookup, it gets a NameNotFoundException.

    ********************


    ejb-jar.xml:
    ********************
    2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">




    TADGenerateMapService
    TAD.ejbs.TADGenerateMapEJBHome
    TAD.ejbs.TADGenerateMapEJBRemote
    TAD.ejbs.TADGenerateMapEJB
    Stateless
    Container



    ****************************



    Weblogic-ejb-jar.xml:
    *****************************


    '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN'
    'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>




    TADGenerateMapService
    TAD.map.statelessSession


    *****************************


    web.xml contains
    ********************

    TADGenerateMapService
    Session
    TAD.ejbs.TADGenerateMapEJBHome
    TAD.ejbs.TADGenerateMapEJBRemote
    TAD_EJB.jar#TADGenerateMapService

    ***************************


    Lookup snippet:
    String hostName = this.getCodeBase().getHost();
    Hashtable env = new Hashtable();
    env.put(Context.PROVIDER_URL, "t3://" + hostName + ":7001");
    env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    try {
    context = new InitialContext(env);
    }
    catch( Exception e ) {
    System.out.println("Caught exception " + e.toString() + " in init");
    }
    try
    {
    // Get Initial JNDI Context
    //

    // Get EJB
    //
    TADGenerateMapEJBHome mapHome = (TADGenerateMapEJBHome) context.lookup
    ("TAD.map.statelessSession");
    TADGenerateMapEJBRemote mapRemote = mapHome.create () ;
    mapNameWithPath = mapRemote.generateMap (mapProjection,
    mapType,
    mapWidth,
    mapCenterLat,
    mapCenterLon);
    }
    catch (NamingException e)
    {
    System.out.println ("TADMapClient.generateMap - NamingException => " +
    e) ;
    e.printStackTrace();
    }


    **********************
    Error I receive in the browser java console:
    **********************
    TADMapClient.generateMap - NamingException => javax.naming.NameNotFoundException:
    remaining name: java:/comp/env/TAD.map.statelessSession

    javax.naming.NameNotFoundException: remaining name: java:/comp/env/TAD.map.statelessSession
    at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:35)
    at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:39)
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:57)
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:62)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at TAD.common.TestApp.generateMap(TestApp.java:67)
    at TAD.common.TestApp.start(TestApp.java:45)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)


    **********************
    I think I am missing a piece.

    Thanks


  2. Re: NameNotFoundException on lookup


    Hi,
    If you use the EJB from your applet you must make the home and remote interfaces
    avavilable for your applet.
    Wouldn't it be easier to use an intermediate servlet.
    Eran

    "James Martin" wrote:
    >
    >I see a bunch of questions in this area, but not a solution.
    >
    >I have an applet that tries to instantiate a stateless session bean to
    >talk back
    >to the server.
    >
    >I have an ear deployment that contains a bean (jar) & a application (war).
    > The
    >bean has a jndi entry (that I can see in the admin console, I can test
    >the ejb
    >in the admin console as well), but when the applet (that is in the war),
    >does
    >a lookup, it gets a NameNotFoundException.
    >
    >********************
    >
    >
    >ejb-jar.xml:
    >********************
    > >2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    >
    >
    >
    >
    > TADGenerateMapService
    > TAD.ejbs.TADGenerateMapEJBHome
    > TAD.ejbs.TADGenerateMapEJBRemote
    > TAD.ejbs.TADGenerateMapEJB
    > Stateless
    > Container
    >

    >

    >

    >****************************
    >
    >
    >
    >Weblogic-ejb-jar.xml:
    >*****************************
    >
    >
    > >'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN'
    >'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
    >
    >
    >
    >
    > TADGenerateMapService
    > TAD.map.statelessSession
    >

    >

    >*****************************
    >
    >
    >web.xml contains
    >********************
    >
    > TADGenerateMapService
    > Session
    > TAD.ejbs.TADGenerateMapEJBHome
    > TAD.ejbs.TADGenerateMapEJBRemote
    > TAD_EJB.jar#TADGenerateMapService
    >

    >***************************
    >
    >
    >Lookup snippet:
    > String hostName = this.getCodeBase().getHost();
    > Hashtable env = new Hashtable();
    > env.put(Context.PROVIDER_URL, "t3://" + hostName + ":7001");
    > env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    > try {
    > context = new InitialContext(env);
    > }
    > catch( Exception e ) {
    > System.out.println("Caught exception " + e.toString() + " in init");
    > }
    > try
    > {
    > // Get Initial JNDI Context
    > //
    >
    > // Get EJB
    > //
    > TADGenerateMapEJBHome mapHome = (TADGenerateMapEJBHome) context.lookup
    >("TAD.map.statelessSession");
    > TADGenerateMapEJBRemote mapRemote = mapHome.create () ;
    > mapNameWithPath = mapRemote.generateMap (mapProjection,
    > mapType,
    > mapWidth,
    > mapCenterLat,
    > mapCenterLon);
    > }
    > catch (NamingException e)
    > {
    > System.out.println ("TADMapClient.generateMap - NamingException
    >=> " +
    >e) ;
    > e.printStackTrace();
    > }
    >
    >
    >**********************
    >Error I receive in the browser java console:
    >**********************
    >TADMapClient.generateMap - NamingException => javax.naming.NameNotFoundException:
    >remaining name: java:/comp/env/TAD.map.statelessSession
    >
    >javax.naming.NameNotFoundException: remaining name: java:/comp/env/TAD.map.statelessSession
    > at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:35)
    > at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:39)
    > at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:57)
    > at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:62)
    > at javax.naming.InitialContext.lookup(Unknown Source)
    > at TAD.common.TestApp.generateMap(TestApp.java:67)
    > at TAD.common.TestApp.start(TestApp.java:45)
    > at sun.applet.AppletPanel.run(Unknown Source)
    > at java.lang.Thread.run(Unknown Source)
    >
    >
    >**********************
    >I think I am missing a piece.
    >
    >Thanks
    >



  3. Re: NameNotFoundException on lookup


    I do have a remote and home interface. Can't use an intermediate servlet for this.



    "eran" wrote:
    >
    >Hi,
    >If you use the EJB from your applet you must make the home and remote
    >interfaces
    >avavilable for your applet.
    >Wouldn't it be easier to use an intermediate servlet.
    >Eran
    >
    >"James Martin" wrote:
    >>
    >>I see a bunch of questions in this area, but not a solution.
    >>
    >>I have an applet that tries to instantiate a stateless session bean

    >to
    >>talk back
    >>to the server.
    >>
    >>I have an ear deployment that contains a bean (jar) & a application

    >(war).
    >> The
    >>bean has a jndi entry (that I can see in the admin console, I can test
    >>the ejb
    >>in the admin console as well), but when the applet (that is in the war),
    >>does
    >>a lookup, it gets a NameNotFoundException.
    >>
    >>********************
    >>
    >>
    >>ejb-jar.xml:
    >>********************
    >>
    >JavaBeans
    >>2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    >>
    >>
    >>
    >>
    >> TADGenerateMapService
    >> TAD.ejbs.TADGenerateMapEJBHome
    >> TAD.ejbs.TADGenerateMapEJBRemote
    >> TAD.ejbs.TADGenerateMapEJB
    >> Stateless
    >> Container
    >>

    >>

    >>

    >>****************************
    >>
    >>
    >>
    >>Weblogic-ejb-jar.xml:
    >>*****************************
    >>
    >>
    >> >>'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN'
    >>'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
    >>
    >>
    >>
    >>
    >> TADGenerateMapService
    >> TAD.map.statelessSession
    >>

    >>

    >>*****************************
    >>
    >>
    >>web.xml contains
    >>********************
    >>
    >> TADGenerateMapService
    >> Session
    >> TAD.ejbs.TADGenerateMapEJBHome
    >> TAD.ejbs.TADGenerateMapEJBRemote
    >> TAD_EJB.jar#TADGenerateMapService
    >>

    >>***************************
    >>
    >>
    >>Lookup snippet:
    >> String hostName = this.getCodeBase().getHost();
    >> Hashtable env = new Hashtable();
    >> env.put(Context.PROVIDER_URL, "t3://" + hostName + ":7001");
    >> env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    >> try {
    >> context = new InitialContext(env);
    >> }
    >> catch( Exception e ) {
    >> System.out.println("Caught exception " + e.toString() + " in init");
    >> }
    >> try
    >> {
    >> // Get Initial JNDI Context
    >> //
    >>
    >> // Get EJB
    >> //
    >> TADGenerateMapEJBHome mapHome = (TADGenerateMapEJBHome) context.lookup
    >>("TAD.map.statelessSession");
    >> TADGenerateMapEJBRemote mapRemote = mapHome.create () ;
    >> mapNameWithPath = mapRemote.generateMap (mapProjection,
    >> mapType,
    >> mapWidth,
    >> mapCenterLat,
    >> mapCenterLon);
    >> }
    >> catch (NamingException e)
    >> {
    >> System.out.println ("TADMapClient.generateMap - NamingException
    >>=> " +
    >>e) ;
    >> e.printStackTrace();
    >> }
    >>
    >>
    >>**********************
    >>Error I receive in the browser java console:
    >>**********************
    >>TADMapClient.generateMap - NamingException => javax.naming.NameNotFoundException:
    >>remaining name: java:/comp/env/TAD.map.statelessSession
    >>
    >>javax.naming.NameNotFoundException: remaining name: java:/comp/env/TAD.map.statelessSession
    >> at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:35)
    >> at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:39)
    >> at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:57)
    >> at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:62)
    >> at javax.naming.InitialContext.lookup(Unknown Source)
    >> at TAD.common.TestApp.generateMap(TestApp.java:67)
    >> at TAD.common.TestApp.start(TestApp.java:45)
    >> at sun.applet.AppletPanel.run(Unknown Source)
    >> at java.lang.Thread.run(Unknown Source)
    >>
    >>
    >>**********************
    >>I think I am missing a piece.
    >>
    >>Thanks
    >>

    >



  4. Re: NameNotFoundException on lookup


    Does the bean's JNDI name appears in the server JNDI tree?

    "James Martin" wrote:
    >
    >I do have a remote and home interface. Can't use an intermediate servlet
    >for this.
    >
    >
    >
    >"eran" wrote:
    >>
    >>Hi,
    >>If you use the EJB from your applet you must make the home and remote
    >>interfaces
    >>avavilable for your applet.
    >>Wouldn't it be easier to use an intermediate servlet.
    >>Eran
    >>
    >>"James Martin" wrote:
    >>>
    >>>I see a bunch of questions in this area, but not a solution.
    >>>
    >>>I have an applet that tries to instantiate a stateless session bean

    >>to
    >>>talk back
    >>>to the server.
    >>>
    >>>I have an ear deployment that contains a bean (jar) & a application

    >>(war).
    >>> The
    >>>bean has a jndi entry (that I can see in the admin console, I can test
    >>>the ejb
    >>>in the admin console as well), but when the applet (that is in the

    >war),
    >>>does
    >>>a lookup, it gets a NameNotFoundException.
    >>>
    >>>********************
    >>>
    >>>
    >>>ejb-jar.xml:
    >>>********************
    >>>
    >>JavaBeans
    >>>2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    >>>
    >>>
    >>>
    >>>
    >>> TADGenerateMapService
    >>> TAD.ejbs.TADGenerateMapEJBHome
    >>> TAD.ejbs.TADGenerateMapEJBRemote
    >>> TAD.ejbs.TADGenerateMapEJB
    >>> Stateless
    >>> Container
    >>>

    >>>

    >>>

    >>>****************************
    >>>
    >>>
    >>>
    >>>Weblogic-ejb-jar.xml:
    >>>*****************************
    >>>
    >>>
    >>> >>>'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN'
    >>>'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
    >>>
    >>>
    >>>
    >>>
    >>> TADGenerateMapService
    >>> TAD.map.statelessSession
    >>>

    >>>

    >>>*****************************
    >>>
    >>>
    >>>web.xml contains
    >>>********************
    >>>
    >>> TADGenerateMapService
    >>> Session
    >>> TAD.ejbs.TADGenerateMapEJBHome
    >>> TAD.ejbs.TADGenerateMapEJBRemote
    >>> TAD_EJB.jar#TADGenerateMapService
    >>>

    >>>***************************
    >>>
    >>>
    >>>Lookup snippet:
    >>> String hostName = this.getCodeBase().getHost();
    >>> Hashtable env = new Hashtable();
    >>> env.put(Context.PROVIDER_URL, "t3://" + hostName + ":7001");
    >>> env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    >>> try {
    >>> context = new InitialContext(env);
    >>> }
    >>> catch( Exception e ) {
    >>> System.out.println("Caught exception " + e.toString() + " in

    >init");
    >>> }
    >>> try
    >>> {
    >>> // Get Initial JNDI Context
    >>> //
    >>>
    >>> // Get EJB
    >>> //
    >>> TADGenerateMapEJBHome mapHome = (TADGenerateMapEJBHome)

    >context.lookup
    >>>("TAD.map.statelessSession");
    >>> TADGenerateMapEJBRemote mapRemote = mapHome.create () ;
    >>> mapNameWithPath = mapRemote.generateMap (mapProjection,
    >>> mapType,
    >>> mapWidth,
    >>> mapCenterLat,
    >>> mapCenterLon);
    >>> }
    >>> catch (NamingException e)
    >>> {
    >>> System.out.println ("TADMapClient.generateMap - NamingException
    >>>=> " +
    >>>e) ;
    >>> e.printStackTrace();
    >>> }
    >>>
    >>>
    >>>**********************
    >>>Error I receive in the browser java console:
    >>>**********************
    >>>TADMapClient.generateMap - NamingException => javax.naming.NameNotFoundException:
    >>>remaining name: java:/comp/env/TAD.map.statelessSession
    >>>
    >>>javax.naming.NameNotFoundException: remaining name: java:/comp/env/TAD.map.statelessSession
    >>> at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:35)
    >>> at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:39)
    >>> at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:57)
    >>> at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:62)
    >>> at javax.naming.InitialContext.lookup(Unknown Source)
    >>> at TAD.common.TestApp.generateMap(TestApp.java:67)
    >>> at TAD.common.TestApp.start(TestApp.java:45)
    >>> at sun.applet.AppletPanel.run(Unknown Source)
    >>> at java.lang.Thread.run(Unknown Source)
    >>>
    >>>
    >>>**********************
    >>>I think I am missing a piece.
    >>>
    >>>Thanks
    >>>

    >>

    >



  5. Re: NameNotFoundException on lookup


    Yes. it is in the JNDI tree.

    "eran" wrote:
    >
    >Does the bean's JNDI name appears in the server JNDI tree?
    >
    >"James Martin" wrote:
    >>
    >>I do have a remote and home interface. Can't use an intermediate servlet
    >>for this.
    >>
    >>
    >>
    >>"eran" wrote:
    >>>
    >>>Hi,
    >>>If you use the EJB from your applet you must make the home and remote
    >>>interfaces
    >>>avavilable for your applet.
    >>>Wouldn't it be easier to use an intermediate servlet.
    >>>Eran
    >>>
    >>>"James Martin" wrote:
    >>>>
    >>>>I see a bunch of questions in this area, but not a solution.
    >>>>
    >>>>I have an applet that tries to instantiate a stateless session bean
    >>>to
    >>>>talk back
    >>>>to the server.
    >>>>
    >>>>I have an ear deployment that contains a bean (jar) & a application
    >>>(war).
    >>>> The
    >>>>bean has a jndi entry (that I can see in the admin console, I can

    >test
    >>>>the ejb
    >>>>in the admin console as well), but when the applet (that is in the

    >>war),
    >>>>does
    >>>>a lookup, it gets a NameNotFoundException.
    >>>>
    >>>>********************
    >>>>
    >>>>
    >>>>ejb-jar.xml:
    >>>>********************
    >>>> >>>JavaBeans
    >>>>2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    >>>>
    >>>>
    >>>>
    >>>>
    >>>> TADGenerateMapService
    >>>> TAD.ejbs.TADGenerateMapEJBHome
    >>>> TAD.ejbs.TADGenerateMapEJBRemote
    >>>> TAD.ejbs.TADGenerateMapEJB
    >>>> Stateless
    >>>> Container
    >>>>

    >>>>

    >>>>

    >>>>****************************
    >>>>
    >>>>
    >>>>
    >>>>Weblogic-ejb-jar.xml:
    >>>>*****************************
    >>>>
    >>>>
    >>>> >>>>'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN'
    >>>>'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>> TADGenerateMapService
    >>>> TAD.map.statelessSession
    >>>>

    >>>>

    >>>>*****************************
    >>>>
    >>>>
    >>>>web.xml contains
    >>>>********************
    >>>>
    >>>> TADGenerateMapService
    >>>> Session
    >>>> TAD.ejbs.TADGenerateMapEJBHome
    >>>> TAD.ejbs.TADGenerateMapEJBRemote
    >>>> TAD_EJB.jar#TADGenerateMapService
    >>>>

    >>>>***************************
    >>>>
    >>>>
    >>>>Lookup snippet:
    >>>> String hostName = this.getCodeBase().getHost();
    >>>> Hashtable env = new Hashtable();
    >>>> env.put(Context.PROVIDER_URL, "t3://" + hostName + ":7001");
    >>>> env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    >>>> try {
    >>>> context = new InitialContext(env);
    >>>> }
    >>>> catch( Exception e ) {
    >>>> System.out.println("Caught exception " + e.toString() + " in

    >>init");
    >>>> }
    >>>> try
    >>>> {
    >>>> // Get Initial JNDI Context
    >>>> //
    >>>>
    >>>> // Get EJB
    >>>> //
    >>>> TADGenerateMapEJBHome mapHome = (TADGenerateMapEJBHome)

    >>context.lookup
    >>>>("TAD.map.statelessSession");
    >>>> TADGenerateMapEJBRemote mapRemote = mapHome.create () ;
    >>>> mapNameWithPath = mapRemote.generateMap (mapProjection,
    >>>> mapType,
    >>>> mapWidth,
    >>>> mapCenterLat,
    >>>> mapCenterLon);
    >>>> }
    >>>> catch (NamingException e)
    >>>> {
    >>>> System.out.println ("TADMapClient.generateMap - NamingException
    >>>>=> " +
    >>>>e) ;
    >>>> e.printStackTrace();
    >>>> }
    >>>>
    >>>>
    >>>>**********************
    >>>>Error I receive in the browser java console:
    >>>>**********************
    >>>>TADMapClient.generateMap - NamingException => javax.naming.NameNotFoundException:
    >>>>remaining name: java:/comp/env/TAD.map.statelessSession
    >>>>
    >>>>javax.naming.NameNotFoundException: remaining name: java:/comp/env/TAD.map.statelessSession
    >>>> at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:35)
    >>>> at weblogic.j2eeclient.SimpleContext.resolve(SimpleCo ntext.java:39)
    >>>> at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:57)
    >>>> at weblogic.j2eeclient.SimpleContext.lookup(SimpleCon text.java:62)
    >>>> at javax.naming.InitialContext.lookup(Unknown Source)
    >>>> at TAD.common.TestApp.generateMap(TestApp.java:67)
    >>>> at TAD.common.TestApp.start(TestApp.java:45)
    >>>> at sun.applet.AppletPanel.run(Unknown Source)
    >>>> at java.lang.Thread.run(Unknown Source)
    >>>>
    >>>>
    >>>>**********************
    >>>>I think I am missing a piece.
    >>>>
    >>>>Thanks
    >>>>
    >>>

    >>

    >