ejb lookup problem

Discussions

EJB programming & troubleshooting: ejb lookup problem

  1. ejb lookup problem (6 messages)

    i am using jboss and tomcat. I am trying to run the sun's ejb example application RMS. I was able to deploy but when i run it i get

    javax.naming.namenotfoundexception beans.rmsbean not bound

    does anyone have any idea regarding this.

    InitialContext ctx = new InitialContext();
    Object home = ctx.lookup("beans.RMSBean");
    RMSHome rmsHome = (RMSHome) PortableRemoteObject.narrow(home, RMSHome.class);
    rms = rmsHome.create();

    in my jboss.xml i have


      <ejb-name>sessionBean</ejb-name>
      <jndi-name>beans.RMSBean</jndi-name>

    and in my ejb-jar.xml i have

     <description>no description</description>
      <display-name>sessionBean</display-name>
      <ejb-name>sessionBean</ejb-name>
      <home>examples.ejb.beans.session.RMSHome</home>
      <remote>examples.ejb.beans.session.RMS</remote>
      <ejb-class>examples.ejb.beans.session.RMSBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>

    I am new to ejb and have no idea how to fix this. any help will be greatly appreciated. thanks

    Threaded Messages (6)

  2. ejb lookup problem[ Go to top ]

    hi,

    i am not familiar with jboss/tomcat but one thing is to make sure you are obtaining your initial context properly, especially if your ejbs are on a different server than the client. typically you have to provide some information so the initial context is properly obtained, such as the provider url and the context factory.

    --
    Tinou Bao
    www.tinou.com
  3. ejb lookup problem[ Go to top ]

    my ejb and client are on the same server. i have my provider.url set to localhost in JBoss's jndi.properties file. also the contextfactory is given in that file. I am hoping that jboss looks for these settings in the jndi.properties file when making a call to context.
  4. ejb lookup problem[ Go to top ]

    Hi,

     Try to lookup your bean through JNDIView by going to the following URL.

    http://localhost:8082 (substitute localhost by any m/c)

    Then click on 'service=JNDIView'

    In the page that you get, click on the "list" button.

    java.lang.String [list](boolean)param0 True False

    This will list out everything you can access through JNDI.

    Now verify if your object exists in the Global JNDI Namespace. Access your Bean with the "parent/Child" string for your lookup.

    Hope this helps.
     

  5. ejb lookup problem[ Go to top ]

    no it does not show up in jndiview under global jndi.

    before that it has application and gives my application name. but under that it gives java:comp namespace of Interest bean. I don't know why it is using jboss's example of Interest as namespace.

    can anyone help to solve this. I undeployed jBoss's Interest example but still I see the same as follows in jndiview:

    Application: file:/C:/jboss/JBoss-2.2.1_Tomcat-3.2.1/jboss/tmp/deploy/Default/RMSApp.ear
    java:comp namespace of the Interest bean:
      +- UserTransaction (class: javax.transaction.UserTransaction)
      +- env (class: org.jnp.interfaces.NamingContext)

  6. ejb lookup problem[ Go to top ]

    Did you get any error when you deployed your bean ?

    Try changing the JNDI name from "." to "/"
    <jndi-name>beans/RMSBean</jndi-name>
  7. ejb lookup problem[ Go to top ]

    now i am able to see my beans under jndiview

    but still i am getting the following error
    I replaced beans.RMSBean with beans/RMSBean but got the same error

    [EmbeddedTomcat] ctx : javax.naming.InitialContext@2fbbe3
    [EmbeddedTomcat] getRMSConn() fails
    javax.naming.NameNotFoundException: beans.RMSBean not bound
    [EmbeddedTomcat] javax.naming.NameNotFoundException: beans.RMSBean not bound
    [EmbeddedTomcat] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedF
    romServer(Unknown Source)
    [EmbeddedTomcat] at sun.rmi.transport.StreamRemoteCall.executeCall(Unknow
    n Source)
    [EmbeddedTomcat] at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    [EmbeddedTomcat] at org.jnp.server.NamingServer_Stub.lookup(Unknown Sourc
    e)
    [EmbeddedTomcat] at org.jnp.interfaces.NamingContext.lookup(NamingContext
    .java:295)
    [EmbeddedTomcat] at org.jnp.interfaces.NamingContext.lookup(NamingContext
    .java:279)
    [EmbeddedTomcat] at javax.naming.InitialContext.lookup(Unknown Source)
    [EmbeddedTomcat] at RMS.JSP.getRMSConn(jsp.java:53)
    [EmbeddedTomcat] at RMS.JSP.getAllCategories(jsp.java:156)
    [EmbeddedTomcat] at _0002fprojSearchInfo_0002ejspprojSearchInfo_jsp_1._js
    pService(_0002fprojSearchInfo_0002ejspprojSearchInfo_jsp_1.java:96)
    [EmbeddedTomcat] at org.apache.jasper.runtime.HttpJspBase.service(HttpJsp
    Base.java:119)
    [EmbeddedTomcat] at javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:853)
    [EmbeddedTomcat] at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
    [EmbeddedTomcat] at org.apache.jasper.servlet.JspServlet.serviceJspFile(J
    spServlet.java:318)
    [EmbeddedTomcat] at org.apache.jasper.servlet.JspServlet.service(JspServl
    et.java:391)
    [EmbeddedTomcat] at javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:853)
    [EmbeddedTomcat] at org.apache.tomcat.core.ServletWrapper.doService(Servl
    etWrapper.java:404)
    [EmbeddedTomcat] at org.apache.tomcat.core.Handler.service(Handler.java:2
    86)
    [EmbeddedTomcat] at org.apache.tomcat.core.ServletWrapper.service(Servlet
    Wrapper.java:372)
    [EmbeddedTomcat] at org.apache.tomcat.core.ContextManager.internalService
    (ContextManager.java:797)
    [EmbeddedTomcat] at org.apache.tomcat.core.ContextManager.service(Context
    Manager.java:743)
    [EmbeddedTomcat] at org.apache.tomcat.service.http.HttpConnectionHandler.
    processConnection(HttpConnectionHandler.java:210)
    [EmbeddedTomcat] at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolT
    cpEndpoint.java:416)
    [EmbeddedTomcat] at org.apache.tomcat.util.ThreadPool$ControlRunnable.run
    (ThreadPool.java:498)
    [EmbeddedTomcat] at java.lang.Thread.run(Unknown Source)


    can somebody help