2

I have glassfish running on the same server that the MySQL database is running on. When I attempt to deploy the web application via the admin console, I get the following error: Error occurred during deployment: Exception while preparing the app : Invalid resource : solardbdatasource__pm. Please see server.log for more details.

I am however able to run the web application from another computer and connect remotely to the database, only when I attempt to deploy the application on the same server as the database do I get the error. My glassfish-resources.xml for my working remote connection:

<resources>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" 
                      connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" 
                      connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" 
                      datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" 
                      fail-all-connections="false" idle-timeout-in-seconds="300" 
                      is-connection-validation-required="false" is-isolation-level-guaranteed="true" 
                      lazy-connection-association="false" lazy-connection-enlistment="false" 
                      match-connections="false" max-connection-usage-count="0" max-pool-size="32" 
                      max-wait-time-in-millis="60000" name="mysql_solardb_rootPool" 
                      non-transactional-connections="false" pool-resize-quantity="2" 
                      res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" 
                      steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
    <property name="serverName" value="192.168.1.113"/>
    <property name="portNumber" value="3306"/>
    <property name="databaseName" value="solardb"/>
    <property name="User" value="root"/>
    <property name="Password" value="password"/>
    <property name="URL" value="jdbc:mysql://192.168.1.113:3306/solardb?zeroDateTimeBehavior=convertToNull"/>
    <property name="driverClass" value="com.mysql.jdbc.Driver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="solardbdatasource" object-type="user" pool-name="mysql_solardb_rootPool"/>

When I attempt to deploy it on the server I change '192.168.1.113' to '127.0.0.1'(localhost) to no avail. My persistance.xml:

    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
     <persistence-unit name="solar-decathlonPU" transaction-type="JTA">
      <jta-data-source>solardbdatasource</jta-data-source>
      <exclude-unlisted-classes>false</exclude-unlisted-classes>
      <properties/>
     </persistence-unit>
    </persistence>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555

1 Answers1

0

My problem seemed to be that the stand alone download of glassfish does not come with the mysql connector. In addition, i needed to manually configure the jdbc connection pool via the administrator console. One final issue I ran into was the 'URL' property, there are actually two when setting up a connection pool by default: 'Url' and 'URL', with the latter being the one I wanted.