Hi first off, thanks for the link. I checked it out, but...
Unfortunately it doesn?t clarify to me why the behaviour of the JNDI Binding/Naming changed for my code when deploying in 4.0.3SP1 (where it works) or 4.0.4.RC2 (where it does not work).
I have, of course, checked all config files I know of (or could find) and the doc?s, but I don?t see why the behaviour has changed (of course I could have overseen something or looked at the wrong spots of the doc?s).
Is it suggested to always defined your own local/remote binding/naming so that you don?t run into this?
You do a look up on the remote interface class name
INatPersLst persLstI = (INatPersLst)initCtx.lookup(de.home.test.interfaces.INatPersLstRemote.clathis was the default jndi binding in previous versions of the jboss ejb3 implementation. Now your ejb3 is bound to <ejb-name>/remote. If your ejb3 is packaged inside a ear the ear name is prepended, <ear-name>/<ejb-name>/remote
Thx for the fast help !
I did it like this, since a direct lookup (NatPersLstBean/remote) didnt seem to work, but this does the job:
... Object xyz = initCtx.lookup("NatPerLstBean"); NamingContext myNamingContext = (NamingContext)xyz; xyz = myNamingContext.lookup("remote"); INatPersLst persLstI = (INatPersLst)xyz; ...
This might actually rather fit into the JNDI area, but since I?m not sure, I'll use this thread to continue my questioning:
The Problem that I am having is concerning the binding into the JNDI Tree via annotations:
After the new naming schema in 4.0.4.RC2 ( RC6 EJB 3.0), my objects get hung as "objectname/remote" and ?objectname/local? into the JNDI Tree.
Before I used too look up the remote interface using:
INatPersLst persLstI = (INatPersLst)initCtx.lookup(INatPersLstRemote.class.getName());
So now, I thought , I could look it up like this (I dont really like to hard code the name)
String jndiName = ((RemoteBinding)INatPersLstRemote.class.getAnnotation(RemoteBinding.class)).jndiBinding(); Object xyz = initCtx.lookup(jndiName);
I stated in the remote interface the annotation
as the name to use in the JNDI Tree (or at least that is what I expected), but unfortunately that is not the name with which it gets hung into the JNDI Tree, there it is still named "NatPersLstBean/remote".
Is there some config I missed that enables/disables the renaming of the JNDI Binding in some config file?
And/or is there a better non static way of fetching/naming for the interface name and doing this lookup?
Ok, I have the binding... seems like I missunderstud something there, sorry. I placed the annotation in the class representing the remote interface for the bean, that did not work. I now placed the annotation in the bean and so get the binding I want in the JNDI Tree.
hmm, next problem...
I would greatly appreciate a tip, link, hint or example for an efficient way of doing the JNDI lookup on the 4.0.4.RC2 and EJB 3.0 RC 6, like the "old" style of just asking for the name of the interface and looking this up
The problem that I have is, that I don?t wish to hard code each interface name, I am looking for a ?dynamic? approach, like before.
Since I only want the client to know the interface, I can?t fetch the value of the ?@RemoteBinding? ? Annotation of the bean, (and that?s the only place where it has effects on the naming in the JNDI Tree).
Also, I would still not be able to set it dynamic since you cant do something like ?@RemoteBinding = (jndiBinding = de.home.test.interfaces.INatPersLstRemote.class.getName())?or similar (as far as I have read up till now).
So how do most of you handle this?
I tried to find some documentation or examples on this ?new? naming approach, but have not really found anything (just lots of ?older ? examples, where in most cases they just used the name as a constant like ?myBean/remote?).
Thx ahead !