5 Replies Latest reply on Jul 13, 2016 4:41 AM by mayerw01

    JBoss AS 7.2.0 - mysql connection issues

    datamyers

      I am a complete noob at jboss and java (and linux to be honest).  I am having a ton of trouble getting  jboss to connect to my mysql db.  I've googled quite a bit and tried a bunch of different things, from directory permissions and ownership to various configurations in the standalone.xml configuration file.

       

      The errors I am currently getting on the web console are as follows:

       

      On the Datasouce Subsystem option on the RUNTIME tab:

      Unknown error

      Unexpected HTTP response: 500

      Request

      {

          "address" => [

              ("subsystem" => "datasources"),

              ("data-source" => "GFTDS"),

              ("statistics" => "jdbc")

          ],

          "operation" => "read-resource",

          "include-runtime" => true

      }

      Response

      Internal Server Error

      {

          "outcome" => "failed",

          "failure-description" => "JBAS014883: No resource definition is registered for address [

          (\"subsystem\" => \"datasources\"),

          (\"data-source\" => \"GFTDS\"),

          (\"statistics\" => \"jdbc\")

      ]",

          "rolled-back" => true

      }

       

      On the Datasource Configuration from the PROFILES Tab:

      Unknown error

       

       

      Unexpected HTTP response: 500

       

       

      Request

      {

          "address" => [

              ("subsystem" => "datasources"),

              ("data-source" => "GFTDS")

          ],

          "operation" => "test-connection-in-pool"

      }

       

       

      Response

       

       

      Internal Server Error

      {

          "outcome" => "failed",

          "failure-description" => "JBAS010440: failed to invoke operation: JBAS010442: failed to match pool. Check JndiName: java:jboss/datasources/GFTDS",

          "rolled-back" => true

      }

       

      I have tried configuring the mysql datasource as a regular one or XA, just to see if one would work, but to no avail.

       

      My Java Driver/connector is located int %jbosshome%/modules/system/layers/base/com/mysql/main   AND  %jbosshome%/modules/com/mysql/main/.  Recursive Ownership of both directories is the jboss user and group with permissions 755

       

      Here is the modules.xml

      <?xml version="1.0" encoding="UTF-8"?>

       

       

       

       

      <module xmlns="urn:jboss:module:1.0" name="com.mysql">

        <resources>

          <resource-root path="mysql-connector-java-5.1.39-bin.jar"/>

        </resources>

        <dependencies>

          <module name="javax.api"/>

          <module name="javax.transaction.api"/>

          <module name="javax.servlet.api" optional="true"/>

        </dependencies>

      </module>

      And here are the relevant parts of my standalone.xml:

      <?xml version='1.0' encoding='UTF-8'?>

       

       

      <server xmlns="urn:jboss:domain:1.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:domain:datasources:1.0 http://www.jboss.org/schema/jbossas/jboss-as-datasources_1_0.xsd">

       

       

          <extensions>

              <extension module="org.jboss.as.clustering.infinispan"/>

              <extension module="org.jboss.as.configadmin"/>

              <extension module="org.jboss.as.connector"/>

              <extension module="org.jboss.as.deployment-scanner"/>

              <extension module="org.jboss.as.ee"/>

              <extension module="org.jboss.as.ejb3"/>

              <extension module="org.jboss.as.jaxrs"/>

              <extension module="org.jboss.as.jdr"/>

              <extension module="org.jboss.as.jmx"/>

              <extension module="org.jboss.as.jpa"/>

              <extension module="org.jboss.as.logging"/>

              <extension module="org.jboss.as.mail"/>

              <extension module="org.jboss.as.naming"/>

              <extension module="org.jboss.as.osgi"/>

              <extension module="org.jboss.as.pojo"/>

              <extension module="org.jboss.as.remoting"/>

              <extension module="org.jboss.as.sar"/>

              <extension module="org.jboss.as.security"/>

              <extension module="org.jboss.as.threads"/>

              <extension module="org.jboss.as.transactions"/>

              <extension module="org.jboss.as.web"/>

              <extension module="org.jboss.as.webservices"/>

              <extension module="org.jboss.as.weld"/>

              <extension module="org.jboss.as.jsf"/>

          </extensions>

       

       

          <system-properties>

              <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>

              <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="false"/>

              <property name="sysprop.bonita.db.vendor" value="h2"/>

              <property name="bonita.h2.port" value="1234"/>

              <property name="sysprop.bonita.businessdata.datasource.jndi" value="java:jboss/datasources/BusinessDataDS"/>

              <property name="sysprop.bonita.businessdata.notmanageddatasource.jndi" value="java:jboss/datasources/NotManagedBizDataDS"/>

              <property name="sysprop.bonita.database.journal.datasource.name" value="java:jboss/datasources/bonitaDS"/>

              <property name="sysprop.bonita.database.sequence.manager.datasource.name" value="java:jboss/datasources/bonitaSequenceManagerDS"/>

              <property name="sysprop.bonita.hibernate.transaction.jta_platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>

              <property name="sysprop.bonita.hibernate.transaction.manager_lookup_class" value="org.bonitasoft.JBoss7TransactionManagerLookup"/>

              <property name="sysprop.bonita.transaction.manager" value="java:jboss/TransactionManager"/>

              <property name="sysprop.bonita.userTransaction" value="java:jboss/UserTransaction"/>

          </system-properties>

       

       

       

       

          <management>

              <security-realms>

                  <security-realm name="ManagementRealm">

                      <authentication>

                          <local default-user="$local"/>

                          <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>

                      </authentication>

                  </security-realm>

                  <security-realm name="ApplicationRealm">

                      <authentication>

                          <local default-user="$local"/>

                          <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>

                      </authentication>

                  </security-realm>

              </security-realms>

              <management-interfaces>

                  <native-interface security-realm="ManagementRealm">

                      <socket-binding native="management-native"/>

                  </native-interface>

                  <http-interface security-realm="ManagementRealm">

                      <socket-binding http="management-http"/>

                  </http-interface>

              </management-interfaces>

          </management>

       

       

          <profile>

         .......

              <subsystem xmlns="urn:jboss:domain:configadmin:1.0"/>

              <subsystem xmlns="urn:jboss:domain:datasources:1.1">

                  <datasources>

                      <datasource jta="false" jndi-name="java:jboss/datasources/bonitaSequenceManagerDS" pool-name="bonitaSequenceManagerDS" enabled="true" use-java-context="false" use-ccm="false">

                          <connection-url>jdbc:h2:tcp://localhost:${bonita.h2.port}/bonita_journal.db;MVCC=TRUE;IGNORECASE=TRUE</connection-url>

                          <driver>h2</driver>

                          <security>

                              <user-name>sa</user-name>

                          </security>

                          <validation>

                              <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

                              <background-validation-millis>30000</background-validation-millis>

                          </validation>

                          <timeout>

                              <idle-timeout-minutes>0</idle-timeout-minutes>

                          </timeout>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </datasource>

                      <datasource jta="false" jndi-name="java:jboss/datasources/NotManagedBizDataDS" pool-name="NotManagedBizDataDS" enabled="true" use-java-context="false" use-ccm="false">

                          <connection-url>jdbc:h2:tcp://localhost:${bonita.h2.port}/business_data.db;MVCC=TRUE;IGNORECASE=TRUE</connection-url>

                          <driver>h2</driver>

                          <security>

                              <user-name>sa</user-name>

                          </security>

                          <validation>

                              <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

                              <background-validation-millis>30000</background-validation-millis>

                          </validation>

                          <timeout>

                              <idle-timeout-minutes>0</idle-timeout-minutes>

                          </timeout>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </datasource>

                      <datasource jndi-name="java:jboss/datasources/GFTDS" pool-name="GFTDS" enabled="true" use-java-context="true">

                          <connection-url>jdbc:mysql://localhost:3333/GFT_Build_List</connection-url>

                          <driver-class>com.mysql.jdbc.Driver</driver-class>

                          <driver>com.mysql</driver>

                          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                 <pool>

                 <min-pool-size>10</min-pool-size>

                 <max-pool-size>100</max-pool-size>

                 <prefill>true</prefill>

                 </pool>

             <security>

                              <user-name>username</user-name>

                              <password>password</password>

                          </security>

                          <validation>

                              <validate-on-match>false</validate-on-match>

                              <background-validation>false</background-validation>

                          </validation>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </datasource>

                      <xa-datasource jndi-name="java:jboss/datasources/bonitaDS" pool-name="bonitaDS" enabled="true" use-java-context="false" use-ccm="false">

                          <xa-datasource-property name="URL">

                              jdbc:h2:tcp://localhost:${bonita.h2.port}/bonita_journal.db;MVCC=TRUE;IGNORECASE=TRUE

                          </xa-datasource-property>

                          <driver>h2</driver>

                          <xa-pool>

                              <min-pool-size>1</min-pool-size>

                              <max-pool-size>50</max-pool-size>

                              <prefill>true</prefill>

                          </xa-pool>

                          <security>

                              <user-name>sa</user-name>

                          </security>

                          <validation>

                              <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

                              <background-validation-millis>30000</background-validation-millis>

                          </validation>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </xa-datasource>

                      <xa-datasource jndi-name="java:jboss/datasources/BusinessDataDS" pool-name="BusinessDataDS" enabled="true" use-java-context="false" use-ccm="false">

                          <xa-datasource-property name="URL">

                              jdbc:h2:tcp://localhost:${bonita.h2.port}/business_data.db;MVCC=TRUE;IGNORECASE=TRUE

                          </xa-datasource-property>

                          <driver>h2</driver>

                          <xa-pool>

                              <min-pool-size>1</min-pool-size>

                              <max-pool-size>50</max-pool-size>

                              <prefill>true</prefill>

                          </xa-pool>

                          <security>

                              <user-name>sa</user-name>

                          </security>

                          <validation>

                              <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

                              <background-validation-millis>30000</background-validation-millis>

                          </validation>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </xa-datasource>

                      <!-- xa-datasource jndi-name="java:jboss/datasources/GFTDatasource" pool-name="GFTDatasource" use-ccm="false">

                          <xa-datasource-property name="URL">

                              jdbc:mysql://localhost:3333/GFT_Build_List

                          </xa-datasource-property>

                          <xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>

                          <driver>com.mysql</driver>

                          <xa-pool>

                              <is-same-rm-override>false</is-same-rm-override>

                              <interleaving>false</interleaving>

                              <pad-xid>false</pad-xid>

                              <wrap-xa-resource>false</wrap-xa-resource>

                          </xa-pool>

                          <security>

                              <user-name>username</user-name>

                              <password>password</password>

                          </security>

                          <validation>

                              <validate-on-match>false</validate-on-match>

                              <background-validation>false</background-validation>

                          </validation>

                          <statement>

                              <share-prepared-statements>false</share-prepared-statements>

                          </statement>

                      </xa-datasource -->

                      <drivers>

                          <driver name="com.mysql" module="com.mysql">

                              <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>

                              <datasource-class>com.mysql.jdbc.Driver</datasource-class>

                          </driver>

                          <driver name="h2" module="com.h2database.h2">

                              <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                              <datasource-class>org.h2.Driver</datasource-class>

                          </driver>

                      </drivers>

                  </datasources>

              </subsystem>

              <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">

                  <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000"/>

              </subsystem>

      .....

       

       

       

      </server>

       

      I can add more of the standalone.xml if needs be, or anything else necessary, but I thought that was most everything relevant.

       

      Please help.  My google-fu has failed me. 

       

      Thanks.

      ~CJ

        • 1. Re: JBoss AS 7.2.0 - mysql connection issues
          wdfink

          First of all your modules should be directly under modules/ do not use modules/system/* as this is the internal module directory and not for additional custom modules.

          Also I would remove the <driver-class> element from the datasource, it should be for the driver only if you use that approach.

           

          For me a similar configuration works. But maybe you use an old version with bugs here?

          Do you use EAP? Which exact version? If you prefer the community project I would recommend to use WildFly 9+.

          • 2. Re: JBoss AS 7.2.0 - mysql connection issues
            datamyers

            Thank you for your prompt response!

             

            I have removed what I added to the modules directory and commented out the <driver-class> element.  Unfortunately that did not resolve the issue.

             

            I do not use EAP, to my knowledge.  It is entirely possible I've messed up somewhere else, like in the DB, and jboss is fine.  In fact, I'm almost certain I've missed something so basic, its laughable.

             

            I installed the Bitnami cloud app for jboss AS 7, which is version 7.2.0.  Instead of using the built in mysql (5.6.29) that came with it, I configured the newest version of mysql (5.7.13) along with phpmyadmin.  There is no data anywhere yet.  I'm just trying to build the framework, then install BPM software on top.  Then I was going to import the data and start developing the app/process I need to manipulate the data.  I can certainly look into using WildFly, but the BPM software I was going to use may only support jboss and tomcat.  I chose jboss because I thought it would be more flexible and robust, if I expanded the application in the future.

             

            Not sure where to go from here.  Since there is no data, I guess I can blow everything away and start over, but I've invested a good amount of time and it'd feel like wasted effort to begin again.

             

            Any additional info I could provide that might help?  What would you recommend?

             

            Thanks.

            • 3. Re: JBoss AS 7.2.0 - mysql connection issues
              mayerw01

              As  suggested  in JDBC Driver / DataSource Setup · HAL Management Console  you should place your module in WILDFLY_HOME/modules/system/layers/base/com/mysql/main instead.

              I would also not use any special characters in the driver name.

              • 4. Re: JBoss AS 7.2.0 - mysql connection issues
                wdfink

                Wolgang,

                as I said before the modules/system folder is for internal use (layered products, patching etc).

                So custom modules should be installed directly under modules folder.

                If you use the CLI to install modules it will use the same path. I don't think that this has been changed from former versions.

                I'll check that for the doc.

                • 5. Re: JBoss AS 7.2.0 - mysql connection issues
                  mayerw01

                  Hi Wolf-Dieter,

                  as pointed out by Mark DataSource configuration - WildFly 8 - Project Documentation Editor

                  The actual steps required to install jdbc drivers on WildFly-8 are slightly different.

                   

                  What is correct now?