简体   繁体   English

如何修复 Javax。 命名异常:nameNotFoundException<my_jndi_name> 未找到</my_jndi_name>

[英]how to fix Javax. Naming.exception: nameNotFoundException <my_JNDI_name> not found

I got this exception while trying to deploy ejb-jar file on a glassfish 2.1:尝试在 glassfish 2.1 上部署 ejb-jar 文件时遇到此异常:

Javax.爪哇。 Naming.exception: nameNotFoundException not found. Naming.exception:未找到 nameNotFoundException。

This drive me to be crazy... I don't know why i got this exception while when i launch the hole application (ear) using Netbeans 6.7.1 with integrated glassfish 2.1 it work like magic !这让我发疯......我不知道为什么当我使用带有集成 glassfish 2.1 的 Netbeans 6.7.1 启动孔应用程序(耳朵)时出现此异常,它就像魔术一样工作!

But when i try to deploy it manually under another glassfish in an other pc it does not work但是当我尝试在另一台电脑的另一台 glassfish 下手动部署它时,它不起作用
And i am having this exception when i try to deploy it So i think that the ejb module does not find out how to link to the database当我尝试部署它时我遇到了这个异常所以我认为ejb模块没有找到如何链接到数据库

So it must be something that the netbeans do and i am not, when deploying the ejb-jar Any help?所以它必须是 netbeans 做的事情,而我不是,在部署 ejb-jar 有帮助吗?

I realise this is a bit old, but having just worked through this, I thought I may as well document it here.我意识到这有点老了,但是刚刚完成了这个,我想我不妨在这里记录一下。

For me the issue was the database connection.对我来说,问题是数据库连接。 In your project you should have a persistence.xml file (mine was in the EJB project), which details the database connection parameters.在您的项目中,您应该有一个 persistence.xml 文件(我的是在 EJB 项目中),其中详细说明了数据库连接参数。 I was using a localhost URL, but when I ran the database project, I noticed in my Services tab under Glassfish that no database connection was being registered.我使用的是本地主机 URL,但是当我运行数据库项目时,我注意到 Glassfish 下的“服务”选项卡中没有注册数据库连接。

Here's what I did:这是我所做的:

  • Create a new database connection (right click in Services, Java DB node)新建数据库连接(在Services中右键,Java DB节点)
  • In Services, right click Java DB connection, Properties, check that the pool it's registered to is in the Glassfish JDBC Connection Pools and is the correct one, if not, make sure your database connection is correct, update persistence.xml在Services中,右键Java DB connection,Properties,检查它注册的池是否在Glassfish JDBC Connection Pools中并且是正确的,如果不是,确保你的数据库连接正确,更新persistence.Z0F635D0ECZF1338E
  • Clean the project before running again在再次运行之前清理项目

This worked for me, hope it's helpful for someone else.这对我有用,希望对其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 javax.naming.NameNotFoundException:找不到MyBean#MyBean - javax.naming.NameNotFoundException: MyBean#MyBean not found 原因:javax.naming.NameNotFoundException:池 - Caused by: javax.naming.NameNotFoundException: pools 应用程序重新加载后,Glassfish和javax.naming.NameNotFoundException - Glassfish and javax.naming.NameNotFoundException after app Reload 在JEE 5中调用WebMethod时获取javax.Naming.NameNotFoundException - Getting javax.Naming.NameNotFoundException when calling WebMethod in JEE 5 javax.resource.ResourceException:MQRA:EC:无效的connectionFactoryLookup xxx在MDB的ActivationSpec中配置为找不到JNDI名称 - javax.resource.ResourceException: MQRA:EC:Invalid connectionFactoryLookup xxx configured in ActivationSpec of MDB for no JNDI name found Glassfish NameNotFoundException用于远程JNDI查找 - Glassfish NameNotFoundException for remote JNDI lookup 如何解决 Java EE EJB Glassfish 错误 javax.naming.NamingException: Invocation exception: Got null ComponentInvocation? - How to solve Java EE EJB Glassfish error javax.naming.NamingException: Invocation exception: Got null ComponentInvocation? 目的地JNDI名称缺失 - Missing Destination JNDI Name Glassfish 4:如何为JNDI设置应用程序或模块名称 - Glassfish 4: how to set application or module name for JNDI 引起原因:javax.naming.NamingException - Caused by: javax.naming.NamingException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM