I have followed this Tutorial to Create simple Java EE 7 Webservices using Netbean 7.3.1. I have Glassfish 4.0 running with Netbeans. I ran project successfully without any problem.
Next Step is to Deploy Webservice project on standalone version of GlassFish 4.0 webserver. So I can run it without Netbeans.
Using Glassfish web interface on http://localhost:4848
, and navigating
Common Taks -> Applications -> Deploy
I browse using ("packaged file to be uploaded to the server") and Select the CustomerDB.war file from my project's sub directory /dist/
I have created the war file by running project in Netbean.
But Deployment Failed with following Error.
Error occurred during deployment: Exception while preparing the app : Invalid resource Please see server.log for more details.
When I checked Server Log C:\glassfish4\glassfish\domains\domain1\logs\server.log
It says
[2013-08-20T16:15:07.633+0100] [glassfish 4.0] [INFO] [] [org.glassfish.admingui] [tid: _ThreadID=33 _ThreadName=admin-listener(2)] [timeMillis: 1377011707633] [levelValue: 800] [[
Exception Occurred :Error occurred during deployment: Exception while preparing the app : Invalid resource ]]
UPDATE:
OK I find the solution of above problem as I forget to add the connection. I just added Connection pool and connection resrouces.
Added JDBC connection pool by navigating Common Tasks -> Resources -> JDBC -> JDBC Connection Pools
.
Added the connection Resources by navigating Common Tasks -> Resources -> JDBC -> JDBC Resources
But I am still getting error. This time it is different.
Error occurred during deployment: Exception while deploying the app [CustomerDB] : Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource Error Code: 0. Please see server.log for more details.
Any Idea what I am missing?