13 Replies Latest reply on Aug 13, 2003 3:15 PM by spoox2

    Why NameNotFoundException: not bound

    ringayumi

      I'm write a simply Stateless bean!
      But happend the Exception:
      javax.naming.NameNotFoundException: DemoEJB not bound

      what is mean?

      my session bean deploy for jboss3.2.1
      thanks!!

        • 1. Re: Why NameNotFoundException: not bound
          ringayumi

          Could anyone tell me !
          What it means?
          run a simply Stateless Bean fail for jboss3.2.1
          but for jboss3.0.4 then OK!!

          javax.naming.NameNotFoundException: DemoEJB not
          bound

          thanks!

          • 2. Re: Why NameNotFoundException: not bound

            First of all this info is not sufficient atleastfor me to tell whats wrong.
            Now is that happening at deployment time or when yr client make a call.

            My suspicion is that something wrong with Deployment Descriptors in ejb-jar.xml or jboss.xml.

            Do specify, when it is happening and post yr lookup string and Deployment descriptors so that it can be verified whats happening.

            Cheers.....

            • 3. Re: Why NameNotFoundException: not bound
              ringayumi

              client code:
              InitialContext ic = new InitialContext();
              DemoHome home = (DemoHome)javax.rmi.PortableRemoteObject.narrow(ic.lookup("RingRemote"), DemoHome.class);
              Demo v = home.create();

              file list:
              META-INF/
              META-INF/MANIFEST.MF
              Ring/DAO.class
              Ring/Demo.class
              Ring/DemoDAO.class
              Ring/DemoHome.class
              Ring/VO.class
              Ring/META-INF/ejb-jar.xml
              Ring/META-INF/jboss.xml

              my ejb-jar.xml :
              <?xml version="1.0"?>
              <!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>
              <enterprise-beans>

              <ejb-name>RingDemo</ejb-name>
              Ring.DemoHome
              Ring.Demo
              <ejb-class>Ring.DemoDAO</ejb-class>
              <session-type>Stateless</session-type>
              <transaction-type>Container</transaction-type>

              </enterprise-beans>
              </ejb-jar>

              my jboss.xml:
              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">

              <enterprise-beans>

              <ejb-name>RingDemo</ejb-name>
              <jndi-name>RingRemote</jndi-name>

              </enterprise-beans>


              thanks!!

              • 4. Re: Why NameNotFoundException: not bound

                Now, yoou still haven't specified when this error is hapening.
                Can you deploy yr bean suceesfully.
                My gusess is it is happening when u are invoking call from client.
                Secondly I noticed in yr descriptors that you are using DAO class to access DB.
                And by the looks of it, Yr bean implementation and DAO implementation are in the same class.

                Now, In case of DAO, U need descriptors for DB datasopurce u are going to use, which hasn't been specified in yr decriptors.

                <ejb-jar>
                <enterprise-beans>

                <ejb-name>RingDemo</ejb-name>
                Ring.DemoHome
                Ring.Demo
                <ejb-class>Ring.DemoDAO</ejb-class>
                <session-type>Stateless</session-type>
                <transaction-type>Container</transaction-type>
                <resource-ref >
                <res-ref-name>jdbc/DefaultDS</res-ref-name>
                <res-type>javax.sql.Datasource</res-type>
                <res-auth>Container</res-auth>
                </resource-ref>

                </enterprise-beans>
                </ejb-jar>

                Similarly, in jboss.xml
                <enterprise-beans>

                <ejb-name>RingDemo</ejb-name>
                <jndi-name>RingRemote</jndi-name>
                <resource-ref>
                <res-ref-name>jdbc/DefaultDS</res-ref-name>
                <jndi-name>java:/DefaultDS</jndi-name>
                </resource-ref>


                Now, I have just used these names which are mapped in
                standardjbosscmp-jdbc.xml, which uses Hypersonic DB,
                if you are using other DB, then u might have to create a file for taht and then use these mappings for that.

                Now,other then that, I dont see anything wrong with yr Descriptors.
                But if u are still unsuccesful, do post yr log messages form server.log
                Cheers...

                • 5. Re: Why NameNotFoundException: not bound
                  ringayumi

                  Sorry , I'm stupid!!
                  You get it , It's happening invoking from client.
                  It's for jboss3.0.4 is succesful!!
                  But that for jboss3.2.1 then unsuccesful!
                  About your decriptors , I was tried it!Still unsuccesful!!

                  • 6. Re: Why NameNotFoundException: not bound
                    ringayumi

                    server.log:


                    2003-07-12 21:36:34,684 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/test.war
                    2003-07-12 21:36:34,694 DEBUG [org.jboss.deployment.scanner.URLDeploymentScanner] Watch URL for: file:/C:/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/test.war -> file:/C:/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/test.war
                    2003-07-12 21:36:41,464 ERROR [STDERR] javax.naming.NameNotFoundException: RingRemote not bound
                    2003-07-12 21:36:41,474 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
                    2003-07-12 21:36:41,474 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
                    2003-07-12 21:36:41,484 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
                    2003-07-12 21:36:41,484 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
                    2003-07-12 21:36:41,494 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
                    2003-07-12 21:36:41,494 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
                    2003-07-12 21:36:41,504 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:347)
                    2003-07-12 21:36:41,504 ERROR [STDERR] at org.apache.jsp.newtest_jsp._jspService(newtest_jsp.java:51)
                    2003-07-12 21:36:41,514 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
                    2003-07-12 21:36:41,514 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                    2003-07-12 21:36:41,524 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
                    2003-07-12 21:36:41,524 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
                    2003-07-12 21:36:41,534 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
                    2003-07-12 21:36:41,534 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                    2003-07-12 21:36:41,544 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
                    2003-07-12 21:36:41,544 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
                    2003-07-12 21:36:41,554 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
                    2003-07-12 21:36:41,554 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                    2003-07-12 21:36:41,564 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                    2003-07-12 21:36:41,564 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                    2003-07-12 21:36:41,574 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                    2003-07-12 21:36:41,574 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                    2003-07-12 21:36:41,584 ERROR [STDERR] at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
                    2003-07-12 21:36:41,584 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                    2003-07-12 21:36:41,594 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                    2003-07-12 21:36:41,594 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                    2003-07-12 21:36:41,604 ERROR [STDERR] at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
                    2003-07-12 21:36:41,604 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
                    2003-07-12 21:36:41,614 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                    2003-07-12 21:36:41,614 ERROR [STDERR] at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
                    2003-07-12 21:36:41,624 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                    2003-07-12 21:36:41,624 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
                    2003-07-12 21:36:41,634 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                    2003-07-12 21:36:41,634 ERROR [STDERR] at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
                    2003-07-12 21:36:41,644 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
                    2003-07-12 21:36:41,644 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                    2003-07-12 21:36:41,654 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                    2003-07-12 21:36:41,654 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                    2003-07-12 21:36:41,664 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
                    2003-07-12 21:36:41,664 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
                    2003-07-12 21:36:41,674 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                    2003-07-12 21:36:41,674 ERROR [STDERR] at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
                    2003-07-12 21:36:41,684 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
                    2003-07-12 21:36:41,684 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
                    2003-07-12 21:36:41,694 ERROR [STDERR] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
                    2003-07-12 21:36:41,694 ERROR [STDERR] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
                    2003-07-12 21:36:41,704 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)

                    • 7. Re: Why NameNotFoundException: not bound

                      Now, Yr client looks to me is either a servelt or a jsp page.
                      as u are trying to deploy a .war file. Thats ok.

                      I am not sure at what port does naming servise listens in 3.0.4 but in 3.2.1 it is port no 1099. I am assuming they are same,even if they are not then shouldn't make any difference.
                      But one thing is when u lookup from client to get context which port no do u specify, is it same as what is it in jboss-service.xml file.

                      Code Snippet.
                      Hashtable props = new Hashtable();
                      props.put(
                      InitialContext.INITIAL_CONTEXT_FACTORY,
                      "org.jnp.interfaces.NamingContextFactory");

                      props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");
                      ----------------------------
                      InitialContext initialContext = new InitialContext(props);

                      Have a look at yr jboss-service.xml file, if the port nos are same first.
                      Secondly compile yr src code in jboss3.2.1 again. and then deploy yr war file.
                      And if you still can't make it just attach yr web module and servlets in zip file and I will have a look at it.

                      Cheers...

                      • 8. Re: Why NameNotFoundException: not bound
                        ringayumi

                        I check jboss-service.xml , Port is 1099 that's right!!
                        I was tried for your provide code too!
                        Still unsuccesful!!
                        well..............this is a big problem!!

                        Could you provide a simply Stateless bean for me!
                        let me try it!!

                        thanks a lot for your help!^_^

                        • 9. Re: Why NameNotFoundException: not bound
                          raja05

                          Are you sure ur bean deployed without errors? Check the logs to see if there is no deployment error.
                          If thats okay, go to http://localhost:8080/jmx-console
                          and click on the jndiview link. You should see "RingRemote" as one of the JNDI names there. Basically all ur JNDI names for all apps that u deployed shud show up. Check if this shows up in JNDIView.

                          -Raj

                          • 10. Re: Why NameNotFoundException: not bound
                            ringayumi

                            I'm going to http://localhost:8080/jmx-console and check that!
                            Oh~~my goodness , I'm can's find JNDI "RingRemote"~!!
                            I was tried that again!!
                            What answer ?Give you guess!

                            that be ok!!^_^ I'm very happy!

                            thanks a lot for vashistvishal and raja05 !!

                            Let me study more experience!^_^
                            thanks again!!

                            • 11. Re: Why NameNotFoundException: not bound
                              spoox2

                              Hi! I tried a sample EJB deployment and used the following as my environment. J2sdk1.4.1, JBoss3.0.8 with tomcat 4.1.24, J2SDk1.3.2EE for the ejb jars. I had a few problems with deploying the EJB on Jboss 4 with Tomcat4.1.24. But when i tried to deploy it on Jboss3.0.8, the deployment worked fine. At deployment it gave me a couple of warnings:

                              11:15:57,406 INFO [MainDeployer] Starting deployment of package: file:/C:/jboss308/server/default/deploy/HelloWorld.jar
                              11:15:57,468 INFO [EJBDeployer]
                              Bean : Hello
                              Section: 6.5.5
                              Warning: Session bean does not define the required ejbCreate method.

                              11:15:57,468 INFO [EJBDeployer]
                              Bean : Hello
                              Method : public abstract HelloWorld create() throws RemoteException, CreateException
                              Section: 6.10.6
                              Warning: Each create(...) method in the session bean's home interface must have a matching ejbCreate(...) method in the session bean's class.

                              11:15:57,468 INFO [EjbModule] Creating
                              11:15:57,500 INFO [EjbModule] Deploying Hello
                              11:15:57,531 INFO [EjbModule] Created
                              11:15:57,531 INFO [EjbModule] Starting
                              11:15:57,625 INFO [EjbModule] Started
                              11:15:57,625 INFO [MainDeployer] Deployed package: file:/C:/jboss308/server/default/deploy/HelloWorld.jar

                              I assume it is deployed and it shows up in the jmx-console. When i then start my client, it gives me an error saying "javax.naming.NameNotFoundException: HelloWorld not bound". i do not have a jboss.xml file. I have a ejb-jar.xml which is as follows:
                              <?xml version="1.0" encoding="UTF-8"?>
                              <ejb-jar>
                              JBoss Hello World Application
                              <display-name>Hello World EJB</display-name>
                              <enterprise-beans>

                              <ejb-name>Hello</ejb-name>
                              ejb.demonstration.HelloWorldHome
                              ejb.demonstration.HelloWorld
                              <ejb-class>ejb.demonstration.HelloWorldBean</ejb-class>
                              <session-type>Stateless</session-type>
                              <transaction-type>Bean</transaction-type>

                              </enterprise-beans>
                              </ejb-jar>
                              I dunno if i need to write up a jboss.xml and if yes, whic folder would i need to put it in. I have followed a tutorial at http://f4.grp.yahoofs.com/v1/IOUzP9EjqOn2ccnqfaYv6estnNY0u_7o4FuH3hCh_ghq38BMyYLluW7FVn4fs8UqdCu_sLVC1-S9HD7kTfHM0NMXNhSNp3zQ5I3Q5Q/JBoss%20-%20Step%20by%20Step.pdf
                              Could someone please help. thanx.
                              Rishi

                              • 12. Re: Why NameNotFoundException: not bound
                                spoox2

                                I jus' read somewhere that the jboss.xml file is to be part of the META-INF directory so i have appropriately added the file there with the following content:
                                <enterprise-beans>

                                <ejb-name>HelloWorld</ejb-name>
                                <jndi-name>HelloWorld</jndi-name>

                                </enterprise-beans>
                                But it hasn't changed the result. Please help.
                                Rishi..

                                • 13. Re: Why NameNotFoundException: not bound
                                  spoox2

                                  I made the correction and changed the ejb-name "Hello" to HelloWorld in the ejb-jar.xml . I also then made the HelloWorldMyClient call the remote interface HelloWorld in the jndiContext.lookup() method. But it still doesn't work right giving the same error that HelloWorld not bound.

                                  Rishi..