当应用程序名称包含句点时出现 NameNotFoundException
我有一个简单的 EJB 应用程序,大约 6 个月前可以运行。当我遇到这个问题时,我安装了最新的 JDeveloper (11.1.1.3.0),并试图让它再次工作。
部署在这一行失败:
TeacherManager teacherManager = (TeacherManager)context.lookup("Uran_2.0-TeacherManager#hu.elte.pgy2.BACNAAI.UranEJB.TeacherManager");
带有消息(由我强调):
javax.naming.NameNotFoundException:尝试查找“Uran_2.0-TeacherManager#hu.elte.pgy2.BACNAAI.UranEJB.TeacherManager”时未找到子上下文“Uran_2”。已解决 '' [根异常是 javax.naming.NameNotFoundException:尝试查找 'Uran_2.0-TeacherManager#hu.elte.pgy2.BACNAAI.UranEJB.TeacherManager' 时未找到子上下文 'Uran_2'。已解决'']; 剩余名称“Uran_2/0-TeacherManager#hu/elte/pgy2/BACNAAI/UranEJB/TeacherManager”
显然应用程序的名称(Uran_2.0)以某种方式提示 JDeveloper(或 JNDI?我不确定)将名称中的 .
替换为 /
,这显然会导致 JNDI 查找失败。我该如何解决这个问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的无状态/有状态 EJB 应显式指定 JNDI 名称:
@Stateless(mappedName = ?)
如果这不起作用,您可以使用
context.list("")
浏览 jndi 树以查看部署了哪些远程 EJB。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.