1 2 Previous Next 25 Replies Latest reply on Jan 17, 2018 3:57 AM by Amit Nijhawan

    Try to connect to MySQL Data base <datasource>

    Alx Reds Newbie

      Im beginer in the use to jBoss

       

      In My standalone.xml i config the datasource

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

                          <connection-url>jdbc:mysql://host/database</connection-url>

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

                          <driver>mysql-connector-java.jar</driver>

                          <pool>

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

                              <max-pool-size>64</max-pool-size>

                          </pool>

                          <security>

                              <user-name>abcuser</user-name>

                              <password>passwd</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>

       

      But when test the connection i receive

       

      Unknown error

      Unexpected HTTP response: 500

      Request

      {

          "address" => [

              ("subsystem" => "datasources"),

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

          ],

          "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/abc",

          "rolled-back" => true

      }

       

      Thanks for your Helps !

        • 1. Re: Try to connect to MySQL Data base <datasource>
          Amit Nijhawan Newbie

          I can see that you are using JNDI name java:jboss/datasources/XPD , but in the test connection JNDi is different Check  "java:jboss/datasources/abc".

          While testing connection please check the JNDi properly.

           

          From CLI you can use below command to test connection:

           

          [standalone@localhost:9999 /] /subsystem=datasources/data-source=XPD:enable()
          {"outcome" => "success"} 
          [standalone@localhost:9999 /] /subsystem=datasources/data-source=XPD:test-connection-in-pool()
          {
            "outcome" => "success",
            "result" => [true]
          }

          • 2. Re: Try to connect to MySQL Data base <datasource>
            Alx Reds Newbie

            Hello, thanks for your help

            I ran the commands

            [standalone@localhost:7599 /] /subsystem=datasources/data-source=XPD:enable()

            {

                "outcome" => "failed",

                "failure-description" => "JBAS014749: Operation handler failed: Service jboss.data-source-config.XPD is already registered",

                "rolled-back" => true

            }

            [standalone@localhost:7599 /] /subsystem=datasources/data-source=XPD:test-connection-in-pool()

            {

                "outcome" => "failed",

                "failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",

                "rolled-back" => true

            }

            [standalone@localhost:7599 /]

            • 3. Re: Try to connect to MySQL Data base <datasource>
              Amit Nijhawan Newbie

              Please disable the datasource using below command:

               

              /subsystem=datasources/data-source=XPD:disable

               

              reload the server and enable the datasource using command "/subsystem=datasources/data-source=XPD:enable()".

              • 4. Re: Try to connect to MySQL Data base <datasource>
                Alx Reds Newbie

                Done

                [standalone@localhost:7599 /] /subsystem=datasources/data-source=XPD:enable()

                {"outcome" => "success"}

                [standalone@localhost:7599 /] /subsystem=datasources/data-source=XPD:test-connection-in-pool()

                {

                    "outcome" => "failed",

                    "failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",

                    "rolled-back" => true

                }

                [standalone@localhost:7599 /]

                • 5. Re: Try to connect to MySQL Data base <datasource>
                  Alx Reds Newbie

                  I uninstall the jBoss and reinstall
                  This is a New Configuration
                  but no is working

                   

                  Thanks

                  • 6. Re: Try to connect to MySQL Data base <datasource>
                    Amit Nijhawan Newbie

                    While hitting  command "/subsystem=datasources/data-source=XPD:test-connection-in-pool()" in the console are you seeing any error in the log file.Please copy/paste the log here.

                    • 7. Re: Try to connect to MySQL Data base <datasource>
                      Alx Reds Newbie

                      This is the log output

                       

                      11:07:24,945 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (management-handler-thread - 5) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection

                      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277) [ironjacamar-jdbc-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235) [ironjacamar-jdbc-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:761) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.core.connectionmanager.pool.AbstractPool.internalTestConnection(AbstractPool.java:627) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.core.connectionmanager.pool.strategy.OnePool.testConnection(OnePool.java:88) [ironjacamar-core-impl-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.as.connector.pool.PoolOperations$TestConnectionInPool.invokeCommandOn(PoolOperations.java:121) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.connector.pool.PoolOperations$1.execute(PoolOperations.java:60) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.connector.pool.PoolOperations.execute(PoolOperations.java:74) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.ModelControllerImpl$DefaultPrepareStepHandler.execute(ModelControllerImpl.java:466) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:121) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:139) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:108) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:287)

                      at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:487)

                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_80]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_80]

                      at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]

                      at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]

                      Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

                      at java.lang.String.substring(String.java:1911) [rt.jar:1.7.0_80]

                      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getDriver(LocalManagedConnectionFactory.java:583) [ironjacamar-jdbc-1.0.9.Final.jar:1.0.9.Final]

                      at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:248) [ironjacamar-jdbc-1.0.9.Final.jar:1.0.9.Final]

                      ... 29 more

                      • 9. Re: Try to connect to MySQL Data base <datasource>
                        Alx Reds Newbie

                        I create de path, copy the file and create the file

                         

                        [root@vlxportal01 main]# pwd

                        /usr/share/jboss-as-7.1.1.Final/modules/com/mysql/main

                        [root@vlxportal01 main]# ls -l

                        total 10024

                        -rw-r--r--. 1 jboss jboss      384 ene 11 11:45 module.xml

                        -rw-r--r--. 1 jboss jboss 10260480 ene 11 11:46 mysql-connector-java-5.1.45.tar

                        [root@vlxportal01 main]# cat module.xml

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

                        <properties>

                        <property name="jboss.api" value="unsupported"/>      </properties>

                        <resources>

                        <resource-root path=mysql-connector-java-5.1.45.tar/>

                        </resources>

                        <dependencies>

                        <module name="javax.api"/>

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

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

                        </module>

                        [root@vlxportal01 main]#

                        • 10. Re: Try to connect to MySQL Data base <datasource>
                          Alx Reds Newbie

                          In my standalone.xml

                          the datasource is :

                           

                                          </datasource>

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

                                              <connection-url>mysql://myserver/database</connection-url>

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

                                              <driver>h2</driver>

                                              <security>

                                                  <user-name>user123</user-name>

                                                  <password>abc123</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>

                                          <drivers>

                          • 12. Re: Try to connect to MySQL Data base <datasource>
                            Amit Nijhawan Newbie

                            I have made some changes in your configuration file,please try using at your end.

                             

                              </datasource>

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

                                                <connection-url>mysql://myserver/database</connection-url>

                                               <driver>mysql</driver>

                                           

                                                <security>

                                                    <user-name>user123</user-name>

                                                    <password>abc123</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>

                            <drivers>

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

                                            </drivers>

                             

                             

                            Please check the username and password correct or not.

                            • 13. Re: Try to connect to MySQL Data base <datasource>
                              Alx Reds Newbie

                              Hello
                              I change the driver but no is working
                              Test the connection from mysql client and this is working the user and pass are ok.


                               

                               

                               

                              Message

                               

                              Min/MaximizeClose

                               

                               

                               

                               

                              Fri Jan 12 10:08:07 GMT-600 2018

                              Unknown error

                               

                               

                               

                              • 14. Re: Try to connect to MySQL Data base <datasource>
                                Alx Reds Newbie

                                Unexpected HTTP response: 500

                                 

                                Request

                                {

                                  "address" => [

                                  ("subsystem" => "datasources"),

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

                                  ],

                                  "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/XPD",

                                  "rolled-back" => true

                                }

                                1 2 Previous Next