2 Replies Latest reply on Jun 3, 2012 10:40 PM by Gan Dong

    Remote JNDI object already exported issue

    Gan Dong Newbie

      Hi,

       

      I'm able to locate remote JNDI object after I switched to AS7.1 specific approach. However, while doing a remote JNDI look up against jboss 7.1.1, I got an exception as below:

       

      java.rmi.server.ExportException: object already exported

              at sun.rmi.transport.ObjectTable.putTarget(ObjectTable.java:189)

              at sun.rmi.transport.Transport.exportObject(Transport.java:92)

              at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:247)

              at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:411)

              at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)

              at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:207)

              at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:310)

              at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:252)

              at java.rmi.server.UnicastRemoteObject.reexport(UnicastRemoteObject.java:213)

              at java.rmi.server.UnicastRemoteObject.readObject(UnicastRemoteObject.java:182)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:601)

              at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:213)

              at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1580)

              at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1557)

              at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1235)

              at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)

              at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)

              at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)

              at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:156)

              at org.jboss.naming.remote.protocol.v1.BaseProtocolCommand.readResult(BaseProtocolCommand.java:60)

              at org.jboss.naming.remote.protocol.v1.Protocol$1.handleClientMessage(Protocol.java:149)

              at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver$1.run(RemoteNamingStoreV1.java:192)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

              at java.lang.Thread.run(Thread.java:722)

       

      Does anyone have any ideas what is going on here? Or is there anything I missed. Thanks.

       

       

      I'm using a servlet context listener to bind a custom remote object, which is packaged to an ear file and deployed to jboss 7.1. See below:

       

          public void contextInitialized(ServletContextEvent servletContextEvent) {

           ServletContext servletContext =

               servletContextEvent.getServletContext();

           try {

            log("MyApp Servlet is starting up ...");

       

             Hashtable env = new Hashtable();

             Context context = new InitialContext(env);

             context.bind("java:jboss/exported/MyAppHome", new MyAppImpl());

             log("\n----Bound MyApp ---\n");

           } catch (Exception e) {

             //...

            }

          }

       

       

      For looking up, I'm doing like:

       

          Properties props = new Properties();

          props.put(Context.INITIAL_CONTEXT_FACTORY,

      "org.jboss.naming.remote.client.InitialContextFactory");

          props.put(Context.PROVIDER_URL, "remote://localhost:4447");

          props.put(Context.SECURITY_PRINCIPAL, "admin");

          props.put(Context.SECURITY_CREDENTIALS, "admin1");

          InitialContext ic = new InitialContext(props);

          ic.lookup("MyAppHome");