-
1. Re: @Local and @Remote on same interface
clebert.suconic May 29, 2006 1:43 PM (in response to rpiaggio)JNDINames are different for the local and remote interface.
The application will have to decide between the local and remote interface through the JDNIName. -
2. Re: @Local and @Remote on same interface
rpiaggio May 29, 2006 4:42 PM (in response to rpiaggio)What if I use @EJB injection of the interface on the caller?
-
3. Re: @Local and @Remote on same interface
echon May 30, 2006 4:42 AM (in response to rpiaggio)the only thing i found in Spec. to this is that lookups are performed in the referencing bean's java:comp/env namespace.
When local and remote interface is identical and the local interface is "registered" with a SB in the current application server i think it make no sense to inject the remote version. Because the injection is analysed in the AS, it would (in my mind) first check if the interface is used somewhere as LocalInterface. If not it would use the remote.
So I am sure JBoss will inject the local.
Regards
Peter -
4. Re: @Local and @Remote on same interface
rpiaggio May 30, 2006 4:27 PM (in response to rpiaggio)After some tests, it seems you are wrong.
I had a call to a session bean method explicitly through an interface that was annotated as @Local. The call passed a non-serializable Entity bean as a parameter. This worked OK. (Caller and callee are part of the same application and are in the same JAR, in the same EAR, in other words, a local call is possible).
However, when I added the @Remote annotation, I started getting a NonSerializableException. Serialization is only needed for the Remote call. Therefore, when I have both annotations it seems that @Local is just ignored, at least on JBoss.
Someone from the JBoss team cares to answer if this is the expected behavior or if we have a bug here? -
5. Re: @Local and @Remote on same interface
epbernard May 30, 2006 11:46 PM (in response to rpiaggio)I thnik @Remote has priority over @Local but this is an implementation detail.
I kinda think having both annotations on the same interface is a code smell.
Transparent remote invocation is a myth, and "clients" should be aware of what they are doing -
6. Re: @Local and @Remote on same interface
clebert.suconic May 30, 2006 11:54 PM (in response to rpiaggio)If you use JBossSerialization on remoting layer you could have non serializable objects being serialized.
-
7. Re: @Local and @Remote on same interface
echon May 31, 2006 6:25 AM (in response to rpiaggio)sorry.. i was wrong.. you get a RemoteProxy to the SB.
-
8. Re: @Local and @Remote on same interface
bill.burke May 31, 2006 7:55 AM (in response to rpiaggio)an interface cannot be both a @Remote and @Local at the same time. it is illegal in the specification. The reason?
@EJB SomeINterface foo;
the container would not know if you were referencing a remote or local interface. -
9. Re: @Local and @Remote on same interface
rpiaggio May 31, 2006 9:43 AM (in response to rpiaggio)Makes sense.
If it is illegal, shouldn't I get an error (or at least a warning) when I compile (or at least deploy)?
After all, one of the reasons we use Java is not to shoot ourselves on the foot. ;)