简体   繁体   中英

How to find JNDI name when creating entity classes from a database?

I'm using NetBeans 8.0.2 to create a web app that can create, read, update, and delete from a database. I was following this tutorial ( https://netbeans.org/kb/docs/web/jsf20-crud.html ), but ran into an issue when I was creating the entity files. However, the window in which I am supposed to enter the data source to draw from requires a JNDI Name and Database Connection.

The connection is easy enough, since it's the name of the database I already have loaded through NetBeans. However, I have no idea what the JNDI name should be, and following the model name provided by the tutorial doesn't work. When I try that, or any other name, I get an error in the server log, which reads:

Severe:   Exception while preparing the app : Invalid resource : [" whatever name I entered"]

I found almost no information online regarding this problem or how to look up a JNDI name.

I figured it out, I opened the Glassfish admin console, and added a new JDBC Connection Pool and JDBC Resource. There I was able to specify my JNDI name, and everything made sense after that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM