Bartosz Baranowski created WFLY-6138:
----------------------------------------
Summary: implemtentation of java.rmi.server.UnicastRemoteObject always sent
as value when remote jndi lookup
Key: WFLY-6138
URL:
https://issues.jboss.org/browse/WFLY-6138
Project: WildFly
Issue Type: Feature Request
Components: Naming
Reporter: Bartosz Baranowski
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-r...
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.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)