Reputation: 31
I'm sorry so when I deploy the project in the local galssfish of netbeans ( start glassfish from netbeans I got the result that i want , the web service can got the data from mysql ( here is the url : http://localhost:8085/ServerSide/webresources/credit) but when I start glassfish from the comand line and deploy the .war of the project to see if the project can work in another local , with the same link (8085/ServerSide/webresources/credit) i got this error
root cause
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean
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_Credit, AGENCE FROM credit
Query: ReadAllQuery(referenceClass=Credit sql="SELECT id_Credit, AGENCE FROM credit")
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_Credit, AGENCE FROM credit
Query: ReadAllQuery(referenceClass=Credit sql="SELECT id_Credit, AGENCE FROM credit")
root cause
java.sql.SQLException: No database selected
At first time when when i want to deploy the .war in glassfish i have this error
Error occurred during deployment: Exception while preparing the app : Invalid resource : bd__pm. Please see server.log for more details
but I resolve this when I create a new jdbc connection pool and a jdbc ressource with the same name in my glassfish-resources.xml
Upvotes: 2
Views: 625
Reputation: 31
I have resolved it this problem, here is the method : first delete the jdbc resources and jdbc connection pool that i have create manually and i deploy the project.war with the comman line and add the glassfish-resources.xml like this:
cd C:\Program Files\glassfish\glassfish\bin
asadmin> start-domain
asadmin> deploy ...\project.war
asadmin> add-resources ...\glassfish-resources.xml
asadmin> restart-domain
Upvotes: 1