I'm attempting to set up connection pooling for my application which is hosted in a pre-configured Docker GlassFish instance running on Elastic Beanstalk. Needless to say, Amazon does not make it easy to configure an Elastic Beanstalk instance. However, one approach I thought of was to use the glassfish-resources.xml file to set up the pooling for my application (because you have no access to the admin console to configure pooling that way). My file works on the local environment but when I deploy it to Elastic Beanstalk the application does not work. When I look at the logs, I see there is a database exception (because the database resource is never set up) and the glassfish-resources.xml file is not listed.
Here's my glassfish-resources.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://ift.tt/1pGpDFD">
<resources>
<jdbc-connection-pool name="test_pool" 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" allow-non-component-callers="false"
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="portNumber" value="3306"/>
<property name="databaseName" value="TestDB"/>
<property name="User" value="admin"/>
<property name="Password" value="password"/>
<property name="URL" value="jdbc:mysql://link-to-my-database.us-east-1.rds.amazonaws.com:3306/TestDB"/>
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="java:app/jdbc/TestDB" object-type="user" pool-name="test_pool"/>
</resources>
Does pre-configured Elastic Beanstalk GlassFish environments ignore the glassfish-resources.xml file? If so, is there an alternative approach to setting up connection pooling?
Aucun commentaire:
Enregistrer un commentaire