-
1. Re: Try to connect to MySQL Data base <datasource>
anijhawa Jan 11, 2018 1:00 AM (in response to alxreds)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>
alxreds Jan 11, 2018 11:13 AM (in response to anijhawa)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>
anijhawa Jan 11, 2018 11:32 AM (in response to alxreds)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>
alxreds Jan 11, 2018 11:38 AM (in response to anijhawa)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>
alxreds Jan 11, 2018 11:46 AM (in response to anijhawa)I uninstall the jBoss and reinstall
This is a New Configuration
but no is workingThanks
-
6. Re: Try to connect to MySQL Data base <datasource>
anijhawa Jan 11, 2018 11:53 AM (in response to alxreds)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>
alxreds Jan 11, 2018 12:08 PM (in response to anijhawa)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
-
8. Re: Try to connect to MySQL Data base <datasource>
anijhawa Jan 11, 2018 12:21 PM (in response to alxreds)Are you following.an approach to load driver as module [1].
[1]http://ralph.soika.com/wildfly-install-postgresql-jdbc-driver-as-a-module/
-
9. Re: Try to connect to MySQL Data base <datasource>
alxreds Jan 11, 2018 12:55 PM (in response to anijhawa)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>
alxreds Jan 11, 2018 1:03 PM (in response to anijhawa)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>
-
11. Re: Try to connect to MySQL Data base <datasource>
alxreds Jan 11, 2018 5:58 PM (in response to alxreds) -
12. Re: Try to connect to MySQL Data base <datasource>
anijhawa Jan 12, 2018 3:48 AM (in response to alxreds)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>
alxreds Jan 12, 2018 11:09 AM (in response to anijhawa) -
14. Re: Try to connect to MySQL Data base <datasource>
alxreds Jan 12, 2018 11:10 AM (in response to alxreds)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
}