After searching for an error during half a day, I found a very strange behaviour in jboss 5.1.0GA that I can't explain. Here is my case :
My jboss server holds an EJB 2.1 bound to this jndi name : "A". Please note that it is bound to a global jndi namespace (not a java: namespace). As is, it is considered as remote.
I wrote a unit test where I :
- lookup this EJB using java:/A <-- my error I searched for a long time
- call a method on the stub
--> It works, even though I made a mistake on the jndi name.
Then I deployed a second ejb on another jboss server, which looked up the A ejb on the other server using the same "wrong" name "java:/A" : I got the NameNotBoundException which is normal.
After searching half a day the reason why I got the NameNotBoundException, I realized that my mistake was the jndi name I kept on using : java:/A
So I changed it to "A", and then my lookup started to work.
I now have found my error and am happy with it. The only thing I don't understand is that my code in my unit test still works using java:/A which is false.
Is there somewhere in jboss some code that would say. "ok, even if the name my client is requesting is java:/foo, I try to search foo just in case my client would have made a mistake, because I do know that I'm called by a remote client". This behaviour would not occur when called within a jboss server, even if used as a remote client for another server ?
Can someone explain it to me ?