views:

54

answers:

1

I have a simple EJB app that used to work about 6 months ago. I installed the latest JDeveloper (11.1.1.3.0) and I'm trying to get it to work again, when I ran into this problem.

Deployment fails on this line:

TeacherManager teacherManager = (TeacherManager)context.lookup("Uran_2.0-TeacherManager#hu.elte.pgy2.BACNAAI.UranEJB.TeacherManager");

With the message (emphasis by me):

javax.naming.NameNotFoundException: While trying to lookup 'Uran_2.0-TeacherManager#hu.elte.pgy2.BACNAAI.UranEJB.TeacherManager' didn't find subcontext 'Uran_2'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'Uran_2.0-TeacherManager#hu.elte.pgy2.BACNAAI.UranEJB.TeacherManager' didn't find subcontext 'Uran_2'. Resolved '']; remaining name 'Uran_2/0-TeacherManager#hu/elte/pgy2/BACNAAI/UranEJB/TeacherManager'

Apparently the application's name (Uran_2.0) somehow prompts JDeveloper (or JNDI? I'm not sure) to replace the . in the name with a /, which obviously causes the JNDI lookups to fail. How can I get around this?

A: 

Your Stateless/Stateful EJB should explicitly specified the JNDI name :

@Stateless(mappedName = ?)

If this doesn't work, you can use context.list("") to browse the jndi tree in order to see what remote EJB are deployed.

h3xStream
Yep, it's there: `@Stateless(name = "TeacherManager", mappedName = "Uran_2.0-TeacherManager")`. JNDI still looks for `Uran_2/0-TeacherManager` though.
suszterpatt
then lookup for "Uran_2\\.0-TeacherManager"
h3xStream
@h3xStream: that gives: `javax.naming.NameNotFoundException: While trying to lookup 'Uran_2.0-TeacherManager#hu.elte.pgy2.BACNAAI.UranEJB.TeacherManager' didn't find subcontext 'Uran_2.0-TeacherManager#hu'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'Uran_2.0-TeacherManager#hu.elte.pgy2.BACNAAI.UranEJB.TeacherManager' didn't find subcontext 'Uran_2.0-TeacherManager#hu'. Resolved '']; remaining name 'Uran_2/0-TeacherManager#hu/elte/pgy2/BACNAAI/UranEJB/TeacherManager'`. Slightly better, but not quite there yet.
suszterpatt
the part "#hu/elte..." is probably optional (I don't know if you still include it like in the question). I have no idea what could fix it if you escape the dot. Here is a reference that mention the dot problem : http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.websphere.express.doc/info/exp/ae/tnam_develop_naming.html.
h3xStream
also did the jndi browsing list the name you are looking for..
h3xStream