title: Java EE 7 GlassFish 4.0 Restful Webservices using and Netbean and deploying on Glassfish 4.0
body: <p>I have followed <a href="https://netbeans.org/kb/docs/websvc/rest.html" rel="nofollow">this Tutorial</a> 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.</p>
  
  <p>Next Step is to Deploy Webservice project on standalone version of GlassFish 4.0 webserver. So I can run it without Netbeans.</p>
  
  <p>Using Glassfish web interface on <code>http://localhost:4848</code>, and navigating</p>
  
  <pre><code>Common Taks -&gt; Applications -&gt; Deploy
  </code></pre>
  
  <p>I browse using ("packaged file to be uploaded to the server") and Select the CustomerDB.war file from my project's sub directory /dist/</p>
  
  <p>I have created the war file by running project in Netbean.</p>
  
  <p>But Deployment Failed with following Error. </p>
  
  <pre><code>Error occurred during deployment: Exception while preparing the app : Invalid resource Please see server.log for more details.
  </code></pre>
  
  <p>When I checked Server Log C:\glassfish4\glassfish\domains\domain1\logs\server.log</p>
  
  <p>It says</p>
  
  <pre><code>[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   ]]
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>OK I find the solution of above problem as I forget to add the connection.
  I just added Connection pool and connection resrouces.</p>
  
  <p>Added JDBC connection pool by navigating <code>Common Tasks -&gt; Resources -&gt; JDBC -&gt; JDBC Connection Pools</code>. </p>
  
  <p>Added the connection Resources by navigating <code>Common Tasks -&gt; Resources -&gt; JDBC -&gt; JDBC Resources</code> </p>
  
  <p>But I am still getting error. This time it is different. </p>
  
  <pre><code>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.
  </code></pre>
  
  <p>Any Idea what I am missing?</p>