-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
6.1.0
-
None
Reproducible also on jboss eap 6.2 i.e. AS 7.3.
We have an legacy j2ee app that runs on many application servers. We are trying to port it to AS 7.x, but found one issue.
We use java rmi. Our remote interface implementation (ImplClass) extends java.rmi.server.UnicastRemoteObject. We have a singleton instance of this class in our app that is initialized at the start of the application and then bound into the jndi tree.
For this, we use a context created with org.jboss.as.naming.InitialContextFactory as java.naming.factory.initial
We bind to "java:jboss/exported/" prefix and it works for us for all the other simple values but not for our ImplClass.
When doing lookup on the server, the jndi lookup returns correctly an instance that was created on the server pointing to local connection, but when doing lookup on client with this context
org.jboss.naming.remote.client.InitialContextFactory
remote://localhost:port/
we retrieve the same instance as on the server that point to local connection. Hence it seems, that our object is always copied and sent as a value to the client instead of sending the remote proxy which can be used on the client.
The same code works on jboss AS 5.1 (when using jnp) and also on netweaver, websphere and weblogic when using their context implementations.
It would be great if this could be also fixed in jboss as 7.x.
Known workaround: Use a java.rmi.registry.Registry on the server for registering proxy instead of jndi.
According to this site (and possibly some spec)
http://www.javaworld.com/article/2076234/soa/get-smart-with-proxies-and-rmi.html
an object should be passed by value if and only if it is implementing Serializable interface, but the current implementation in jboss as 7.x does not respect this and always passes objects by value.