NameNotFoundException when application name contains a period
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-Teache开发者_如何学运维rManager#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?
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.
精彩评论