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 :
Javax. Naming.exception: nameNotFoundException not found.
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 !
But when i try to deploy it manually under another glassfish in an other pc it does not work
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 databaseSo it must be something that the netbeans do and i am not, when deploying the ejb-jar Any help ?
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. 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.
Here's what I did:
- Create a new database connection (right click in Services, Java DB node)
- 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
- Clean the project before running again
This worked for me, hope it's helpful for someone else.
精彩评论