我知道这个问题在持久性用户中非常普遍.我在许多论坛上访问了很多主题和问题,但仍然没有找到解决方案.
我已经从数据库(Netbeans 8.0.2中的一个选项)创建了RESTful Web服务.
我还为该项目创建了连接池和JNDI.正确给出名称,如下所示.
GET RequestFailed RequestFailed –> Status: (500)
Response: {
HTTP Status 500 – Internal Server Error
type Exception report
messageInternal Server Error
descriptionThe server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.ejb.EJBException
root cause
javax.ejb.EJBException
root cause
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services – 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selected
Error Code: 1046
Call: SELECT id, access_expires, access_token, address, bank_account_type, created, device_id, device_type, email, facebook_id, grazie_code, latitude, longitude, password, phone_number, profile_pic, refresh_expires, refresh_token, reg_id, token_created, total_balance, type_work, user_name, user_type FROM users
Query: ReadAllQuery(referenceClass=Users sql=”SELECT id, access_expires, access_token, address, bank_account_type, created, device_id, device_type, email, facebook_id, grazie_code, latitude, longitude, password, phone_number, profile_pic, refresh_expires, refresh_token, reg_id, token_created, total_balance, type_work, user_name, user_type FROM users”)
root cause
Exception [EclipseLink-4002] (Eclipse Persistence Services – 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selected
Error Code: 1046
Call: SELECT id, access_expires, access_token, address, bank_account_type, created, device_id, device_type, email, facebook_id, grazie_code, latitude, longitude, password, phone_number, profile_pic, refresh_expires, refresh_token, reg_id, token_created, total_balance, type_work, user_name, user_type FROM users
Query: ReadAllQuery(referenceClass=Users sql=”SELECT id, access_expires, access_token, address, bank_account_type, created, device_id, device_type, email, facebook_id, grazie_code, latitude, longitude, password, phone_number, profile_pic, refresh_expires, refresh_token, reg_id, token_created, total_balance, type_work, user_name, user_type FROM users”)
root cause
java.sql.SQLException: No database selected
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs.
GlassFish Server Open Source Edition 4.1
我得到了解决方案.您可以看到我已经编辑了glassfish服务器的domain.xml并设置了连接池属性和JNDI.我去了glassfish管理控制台并编辑了连接池,我发现服务器无法识别我所做的更改.它显示了URL属性,例如“ jdbc:mysql://:3306 /”,不知道为什么它没有从domain.xml获取属性,但是现在终于可以了.