7 Replies Latest reply on Jul 8, 2015 3:15 AM by Jagadeesh J

    JBOSS AS7 & mysql-connector 5.1.31 => Cannot connect

    John Mullins Newbie

      Hello,

       

      I'm using JBOSS AS7 on a debian system and tried to add mysql-connector as datasource.

       

      Inside /usr/local/jboss/modules/com/mysql/main I've created a module.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
          <module xmlns="urn:jboss:module:1.0" name="com.mysql">
              <resources>
                  <resource-root path="mysql-connector.jar"/>
              </resources>
              <dependencies>
                  <module name="javax.api"/>
                  <module name="javax.transaction.api"/>
              </dependencies>
          </module>
      
      
      
      
      

       

      ls -l:

       

      -rw-r--r-- 1 jboss jboss 346 Jun  8 00:44 module.xml
      lrwxrwxrwx 1 jboss jboss  40 Jun  7 23:12 mysql-connector.jar -> /usr/share/java/mysql-connector-java.jar
      -rw-r--r-- 1 jboss jboss 339 Jun  8 00:47 mysql-connector.jar.index
      
      
      
      
      

       

      ls -l on /usr/share/java/mysql-connector-java.jar (partial result):


      -rw-r--r-- 1 root root 822526 Sep  6  2011 /usr/share/java/mysql-connector-java-5.1.16.jar
      -rw-r--r-- 1 root root 964882 May 21 01:42 /usr/share/java/mysql-connector-java-5.1.31-bin.jar
      lrwxrwxrwx 1 root root     35 Jun  8 10:09 /usr/share/java/mysql-connector-java.jar -> mysql-connector-java-5.1.31-bin.jar
      
      


      Modified part of standalone.xml


      <subsystem xmlns="urn:jboss:domain:datasources:1.0">
          <datasources>
              <datasource jndi-name="java:/EjbcaDS" pool-name="EjbcaDS" enabled="true" use-ccm="true">
                  <connection-url>jdbc:mysql://127.0.0.1:3306/ejbcadb?characterEncoding=UTF-8</connection-url>
                  <driver>com.mysql</driver>
                  <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                  <pool>
                      <min-pool-size>5</min-pool-size>
                      <max-pool-size>150</max-pool-size>
                      <prefill>true</prefill>
                  </pool>
                  <security>
                      <user-name>MYSQL_DATABASE_USER</user-name>
                      <password>MYSQL_DATABASE_PASSWORD</password>
                  </security>
                  <validation>
                      <check-valid-connection-sql>select 1</check-valid-connection-sql>
                      <validate-on-match>true</validate-on-match>
                      <background-validation>false</background-validation>
                  </validation>
                  <statement>
                      <prepared-statement-cache-size>50</prepared-statement-cache-size>
                      <share-prepared-statements>true</share-prepared-statements>
                  </statement>
              </datasource>
              <drivers>
                  <driver name="com.mysql" module="com.mysql">
                      <driver-class>com.mysql.jdbc.Driver</driver-class>
                      <xa-datasource-class>com.mysql.jdbc.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                  </driver>
              </drivers>
          </datasources>
      </subsystem>
      
      
      
      
      

       

      Test of the database-connection:


      /usr/local/jboss/bin/jboss-cli.sh
      
      
      connect
      
      
      [standalone@localhost:9999 /] /subsystem=datasources/data-source=EjbcaDS:test-connection-in-pool
      {
          "outcome" => "failed",
          "failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
          "rolled-back" => true
      }
      
      
      
      
      

       

      Latest logfile-activity when I execute the command above:


      
      
      18:10:07,838 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (management-handler-thread - 8) 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_55]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55]
              at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_55]
              at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]
      Caused by: java.sql.SQLException: java.lang.NoClassDefFoundError: com/mysql/jdbc/authentication/Sha256PasswordPlugin
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:949)
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:432)
              at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)
              at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
              at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249) [ironjacamar-jdbc-1.0.9.Final.jar:1.0.9.Final]
              ... 29 more
      Caused by: java.lang.NoClassDefFoundError: com/mysql/jdbc/authentication/Sha256PasswordPlugin
              at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2504)
              at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2541)
              at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2323)
              at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)
              at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_55]
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_55]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_55]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_55]
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
              ... 32 more
      Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.authentication.Sha256PasswordPlugin from [Module "com.mysql:main" from local module loader @c0335aa (roots: /usr/local/jboss/modules)]
              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
              ... 42 more
      
      
      
      
      

       

       

      Can someone tell me please how to solve this problem?

       

      Thanks in advance

      peng

       

      Message was edited by: John Mullins Output of ln -l for /usr/share/java updated.