12 Replies Latest reply on Mar 8, 2008 10:11 AM by srikanth arroju

    entity bean

    srikanth arroju Newbie

      when iam deploying entity bean it is deployed sucessfully
      when i enter ant run at the command prompt
      it is generating error

      run:
      [java] Exception in thread "main"

      javax.naming.NameNotFoundException: remot
      e not bound
      [java] at

      org.jnp.server.NamingServer.getBinding(NamingServer

      .java:529)

      [java] at

      org.jnp.server.NamingServer.getBinding(NamingServer

      .java:537)

      [java] at

      org.jnp.server.NamingServer.getObject(NamingServer.

      java:543)
      [java] at

      org.jnp.server.NamingServer.lookup(NamingServer.jav

      a:296)
      [java] at

      org.jnp.server.NamingServer.lookup(NamingServer.jav

      a:270)
      [java] at

      sun.reflect.NativeMethodAccessorImpl.invoke0(Native

      Method)
      [java] at

      sun.reflect.NativeMethodAccessorImpl.invoke(NativeM

      ethodAcces
      sorImpl.java:39)
      [java] at

      sun.reflect.DelegatingMethodAccessorImpl.invoke(Del

      egatingMet
      hodAccessorImpl.java:25)
      [java] at

      java.lang.reflect.Method.invoke(Method.java:597)
      [java] at

      sun.rmi.server.UnicastServerRef.dispatch(UnicastSer

      verRef.jav
      a:305)
      [java] at

      sun.rmi.transport.Transport$1.run(Transport.java:15

      9)
      [java] at

      java.security.AccessController.doPrivileged(Native

      Method)
      [java] at

      sun.rmi.transport.Transport.serviceCall(Transport.j

      ava:155)
      [java] at

      sun.rmi.transport.tcp.TCPTransport.handleMessages(T

      CPTranspor
      t.java:535)
      [java] at

      sun.rmi.transport.tcp.TCPTransport$ConnectionHandle

      r.run0(TCP
      Transport.java:790)
      [java] at

      sun.rmi.transport.tcp.TCPTransport$ConnectionHandle

      r.run(TCPT
      ransport.java:649)
      [java] at

      java.util.concurrent.ThreadPoolExecutor$Worker.runT

      ask(Thread
      PoolExecutor.java:885)
      [java] at

      java.util.concurrent.ThreadPoolExecutor$Worker.run(

      ThreadPool
      Executor.java:907)
      [java] at

      java.lang.Thread.run(Thread.java:619)
      [java] at

      sun.rmi.transport.StreamRemoteCall.exceptionReceive

      dFromServe
      r(StreamRemoteCall.java:255)
      [java] at

      sun.rmi.transport.StreamRemoteCall.executeCall(Stre

      amRemoteCa
      ll.java:233)
      [java] at

      sun.rmi.server.UnicastRef.invoke(UnicastRef.java:14

      2)
      [java] at

      org.jnp.server.NamingServer_Stub.lookup(Unknown

      Source)
      [java] at

      org.jnp.interfaces.NamingContext.lookup(NamingConte

      xt.java:62
      5)
      [java] at

      org.jnp.interfaces.NamingContext.lookup(NamingConte

      xt.java:58
      7)
      [java] at

      javax.naming.InitialContext.lookup(InitialContext.j

      ava:392)
      [java] at x.Client.main(Client.java:12)
      [java] Java Result: 1

      BUILD SUCCESSFUL
      Total time: 3 minutes 42 seconds
      D:\software\jayendra\EJB\EntityBean>ant clean
      Buildfile: build.xml

      clean:
      [delete] Deleting directory

      D:\software\jayendra\EJB\EntityBean\build
      [delete] Deleting: D:\Program

      Files\jboss-4.0.5.GA\server\default\deploy\Ent.
      jar

      BUILD FAILED
      D:\software\jayendra\EJB\EntityBean\build.xml:85:

      Unable to delete file D:\Progr
      am

      Files\jboss-4.0.5.GA\server\default\deploy\Ent.jar

      Total time: 2 seconds

        • 1. how to run ejb3.0
          srikanth arroju Newbie

          when iam deploying entity bean it is deployed sucessfully
          when i enter ant run at the command prompt
          it is generating error

          run:
          [java] Exception in thread "main"

          javax.naming.NameNotFoundException: remot
          e not bound
          [java] at

          • 2. Re: entity bean
            jaikiran pai Master

            A NameNotFoundException is usually because you are not using the correct name for the jndi lookup. Follow the steps mentioned at http://wiki.jboss.org/wiki/Wiki.jsp?page=DisplayTheJDNITreeWithTheJMXConsole and figure out the jndi-name of the bean you are trying to lookup. Then use that jndi-name while doing the lookup.

            • 3. Re: entity bean
              srikanth arroju Newbie

              jndi name is same in jmx console

              +- EmployeeBean (class: org.jnp.interfaces.NamingContext)
              | +- remote (proxy: $Proxy67 implements interface x.EmployeeDao,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)

              and in client program

              EmployeeDao ed=(EmployeeDao)ctx.lookup("EmployeeBean/remote");

              • 4. Re: entity bean
                jaikiran pai Master

                Please post the entire exception stacktrace and the entire lookup code that you are using. Do you have any jndi.properties file in your classpath or are you passing any properties while creating the InitialContext object?

                • 5. Re: entity bean
                  srikanth arroju Newbie

                  exception stack trace



                  [java] Exception in thread "main" javax.naming.NameNotFoundException: remot
                  e not bound
                  [java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)

                  [java] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)

                  [java] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
                  [java] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
                  [java] at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
                  [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
                  sorImpl.java:39)
                  [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
                  hodAccessorImpl.java:25)
                  [java] at java.lang.reflect.Method.invoke(Method.java:597)
                  [java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.jav
                  a:305)
                  [java] at sun.rmi.transport.Transport$1.run(Transport.java:159)
                  [java] at java.security.AccessController.doPrivileged(Native Method)
                  [java] at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
                  [java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTranspor
                  t.java:535)
                  [java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCP
                  Transport.java:790)
                  [java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPT
                  ransport.java:649)
                  [java] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Thread
                  PoolExecutor.java:885)
                  [java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPool
                  Executor.java:907)
                  [java] at java.lang.Thread.run(Thread.java:619)
                  [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServe
                  r(StreamRemoteCall.java:255)
                  [java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCa
                  ll.java:233)
                  [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
                  [java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                  [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:62
                  5)
                  [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:58
                  7)
                  [java] at javax.naming.InitialContext.lookup(InitialContext.java:392)
                  [java] at x.Client.main(Client.java:12)
                  [java] Java Result: 1

                  BUILD SUCCESSFUL
                  Total time: 3 minutes 42 seconds

                  iam using jndi.properties file

                  • 6. Re: entity bean
                    srikanth arroju Newbie

                    this is the client code

                    public static void main(String[] args) throws Exception
                    {
                    InitialContext ctx=new InitialContext();
                    EmployeeDao ed=(EmployeeDao)ctx.lookup("EmployeeBean/remote");
                    System.out.println("Before Create");
                    int j=ed.create(10,"sat",1);
                    int k=ed.create(11,"sat",2);
                    System.out.println("After Create="+j);
                    List names=ed.findByName("sat");
                    System.out.println("we have "+names.size()+"sats");
                    /*Employee e=ed.find(j);
                    e.setName("hello");
                    ed.merge(e);
                    List name1=ed.findByName("sat");
                    System.out.println("we have "+names.size()+"sats");*/

                    }
                    }

                    • 7. Re: entity bean
                      jaikiran pai Master

                       

                      iam using jndi.properties file


                      What are the contents of the jndi.properties file. Please post it here. And remember, whenever you are posting logs, code or xml content in the forum please remember to wrap the contents in a code block using the Code button in the message editor window. Also use the Preview button to make sure that the contents show up fine.


                      • 8. Re: entity bean
                        jaikiran pai Master

                         

                        "arrojusrikanth" wrote:
                        jndi name is same in jmx console

                        +- EmployeeBean (class: org.jnp.interfaces.NamingContext)
                        | +- remote (proxy: $Proxy67 implements interface x.EmployeeDao,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)



                        This is from the Global JNDI Namespace, right?

                        • 9. Re: entity bean
                          srikanth arroju Newbie

                          this jndi.proprties file

                          java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                          java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                          java.naming.provider.url=localhost


                          • 10. Re: entity bean
                            jaikiran pai Master

                            I don't see any obvious problems with the configurations or the jndi-name you are using.

                            The jndi listing that you posted, is it from the "Global JNDI Namespace"? And is there anything more in the exception stacktrace than what you have posted so far?

                            Also, how do you start JBoss? Are you passing any -b option or -Djboss.bind.address while starting JBoss? I see that the client is being invoked through a build script. Are you sure that when this client is being called, the bean has already been deployed and available in the JNDI tree?

                            • 11. Re: entity bean
                              Serge Emmanuel Pagop Newbie

                              do you deploy your ejb component into a "jar" other into an "ear"?

                              • 12. Re: entity bean
                                srikanth arroju Newbie

                                i got the solution
                                thanks jaikiran