7 Replies Latest reply on Jul 16, 2002 1:38 PM by Adrian Brock

    Local home and remote home Configuration

    Javier Torreblanca Beltran Newbie

      Hi,
      I'm using JBoss-3.0.1rc1_tomcat-4.0.4 and I have an entity bean with remote home and local home but I don't know if my ejb-jar.xml is right or do I need another configuration files?.

      My ejb-jar.xml contains :


      <?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>Account</ejb-name>
      com.bmp.AccountHome
      com.bmp.Account
      <local-home>com.bmp.AccountLocalHome</local-home>
      com.bmp.AccountLocal
      <ejb-class>com.bmp.AccountBean</ejb-class>
      <persistence-type>Bean</persistence-type>
      <prim-key-class>com.bmp.AccountPK</prim-key-class>
      False

      <resource-ref>
      <res-ref-name>java:/MySqlDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>Account</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>*</method-name>


      <ejb-name>Account</ejb-name>
      <method-intf>Remote</method-intf>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>


      and my client :


      Object obj = ctx.lookup("Account");
      AccountHome home = (AccountHome) javax.rmi.PortableRemoteObject.narrow(obj,AccountHome.class);

      And then I get the following error :

      javax.naming.NameNotFoundException: Account not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
      60)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
      .java:701)
      at java.lang.Thread.run(Thread.java:536)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
      RemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
      223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:450)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:434)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at com.bmp.AccountClient.main(AccountClient.java:25)

        • 2. Re: Local home and remote home Configuration
          Javier Torreblanca Beltran Newbie

          yes, in my second test I used the jboss.xml :

          <?xml version="1.0" encoding="UTF-8"?>

          <enterprise-beans>

          <ejb-name>Account</ejb-name>
          <jndi-name>account/Account</jndi-name>
          <local-jndi-name>account/Account</local-jndi-name>
          <configuration-name></configuration-name>

          </enterprise-beans>


          and then I changed my client :

          Object obj = ctx.lookup("account/Account");
          AccountHome home = (AccountHome) javax.rmi.PortableRemoteObject.narrow(obj, AccountHome.class);

          Thanks for your reply.

          • 3. Re: Local home and remote home Configuration
            Javier Torreblanca Beltran Newbie

            Sorry I forgot to say you, in my second test I get the following error :

            javax.naming.NameNotFoundException: account not bound
            at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
            at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
            at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
            at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
            java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
            at sun.rmi.transport.Transport$1.run(Transport.java:148)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
            60)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
            .java:701)
            at java.lang.Thread.run(Thread.java:536)
            at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
            RemoteCall.java:247)
            at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
            223)
            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
            at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:450)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:434)
            at javax.naming.InitialContext.lookup(InitialContext.java:347)
            at com.bmp.AccountClient.main(AccountClient.java:25)

            Thanks

            • 4. Re: Local home and remote home Configuration
              Adrian Brock Master

              I'm suprised it is deploying with

              <configuration-name></configuration-name>

              I think JBoss3 will produce a deployment exception
              for this. Try removing this line.

              Also, you do not want to bind your remote and
              local homes to the same jndi name.

              Regards,
              Adrian

              • 5. Re: Local home and remote home Configuration
                Javier Torreblanca Beltran Newbie

                Thanks Adrian,
                I changed the jboss.xml, I removed the <configuration-name></configuration-name> line and then I changed jndi names for the remote and local homes but the program doesn´t work. It sends me the same error :

                javax.naming.NameNotFoundException: Account not bound

                Do I need another configuration files?
                Do you have one Entity bean (BMP) example using local and remote home?

                I'm using JBoss-3.0.1rc1_Tomcat-4.0.4.

                Thanks in advance.

                • 6. Re: Local home and remote home Configuration
                  Adrian Brock Master

                  In your previous jboss.xml you have it bound at jndi-name
                  "account/Account" not "Account"

                  Regards,
                  Adrian

                  • 7. Re: Local home and remote home Configuration
                    Adrian Brock Master

                    You also know that you can only access the local
                    interface inside the server. It is not available to
                    the client.

                    Regards,
                    Adrian