• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please explain this to me -> JNDI issues

 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i'm really confused right now, it's so weird, i just can't get it.

I use POJO business objects in a layer between my session fa�ades and my cmps.
I already have on use case working like this: the fa�ade doesn't make references to other ejbs (neither in ejb-jar.xml nor jboss.xml), as it delegates the work to a business POJO.
This is business POJO looks for a local interface in the following way.



The above code is inside the POJO's constructor. Everything works perfectly fine. I afirm: The fa�ade which delegates to this POJO, which is the PartyIssuesBean, does not have any reference in ejb-jar.xml and jboss.xml to the bean PartyHouseBean, the one i'm looking for in the above code.

So, today i was creating a new use case and build a very similar archicture -> a session fa�ade that delegates to a POJO.
I build a brand new session fa�ade that does not reference any other bean in ejb-jar.xml and jboss.xml. This fa�ade delegates to a POJO that, inside it's constructor, look for the following ejbs.



Here's the weird thing, on the second lookup i get a javax.ejb.NameNotFoundException !!!
The lookup for the PartyHouseBean works, but the lookup for the PartyNegotiationBean does not work!!!

Then, i decided to add a reference (in ejb-jar.xml and jboss.xml) to the PartyNegotiationBean for the Session fa�ade the delegates to this POJO.
With that, i lookup works fine !!!
In other words:
- When i lookup from this POJO for the PartyHouseBean (as in the code above) i do not need a reference to PartyHouseBean in ejb-jar.xml or jboss.xml for the fa�ade that uses this POJO.

- When i lookup from this POJO for the PartyNegotiationBean, it only works if a set a reference to PartyNegotiationBean in ejb-jar.xml and jboss.xml for the fa�ade that uses this POJO.

How weird is that???
I couldn't see any thing diferent between the code of PartyHouseBean and PartyNegotiationBean..., is there some kind of externalize???

I'd appreciate any help.
[ September 08, 2004: Message edited by: Leandro Melo ]
 
Brian Tinnel
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd be curious what lookupByLocalEJBReference does. And also what the ejb-jar.xml and jboss.xml look like.
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the lookup method is a service locater, and it works fine for all ejbs in my app. It's not the problem, i've been using it for almost an year.

The ejb-jar.xml and jboss.xml are exactly as i said.
Anyway, i'll post them here for the specific ejbs.

ejb-jar.xml



jboss.xml

[ September 09, 2004: Message edited by: Leandro Melo ]
 
Brian Tinnel
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am curious. Does the service locator prepend java:comp/env/ejb/ to the name passed to it? If not, it wouldn't be looking at the ref at all. If it does, then it would require that a ref exists. Perhaps it uses the name to do a HashMap lookup. If not in the HashMap, it uses java:comp/env/ejb/<name> to do an actual lookup. If that is the case, then perhaps the first lookup of PartyHouseLocal occurs in a bean that has an ejb/PartyHouseLocal ref. Otherwise, I can't see how it would work.

My other best guess is a typo in the local-jndi-name for the PartyNegotiationBean. Since the ejb-jar.xml and jboss.xml you supplied do not reference PartyNegotiationLocal I cannot confirm that.
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does prepend the ref.
Change Party to PartyNegotiation in code i posted.

As i said, the service locator works, i can locate the beans if i have local-ref tag.
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the problem!!!

I could locate the first bean because it was already cached in my factory!
Duh..., more atention....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!