I am migrating my project from JBoss EAP 6.4 to JBoss EAP 7.2.
So I am getting this kind of error,
15:45:50,571 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "my.war")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.DefaultDataSource"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.dummy.env.myDS is missing [jboss.naming.context.java.module..DefaultDataSource]"]
}
I got to know that this error occurs because default data source is not defined in standalone.xml. In previous versions of JBoss EAP removing DefaultDataSource was not giving this issue. In this version defining DefaultDataSource is mandatory even though those applications do not need that default data source.
So I tried giving default data source as an already existing datasource. In this kind of statement:
<default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:/jdbc/existing" />
And this worked fine.
Now my problem is our environment has multiple databases and their respective data sources.
So we can't define a particular data source as a default. As this will interfere with our applications regular flow. And can create major issues.
We want the application to use their specific data sources only not the default one.
But JBoss EAP 7 is forcing us to specify default data source.
So we can define a dummy default data source? or is there any other alternative way?
default datasource option is present in default binding in standalone.xml
default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/jdbc/jndi-name" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/
Applicable to both JBoss EAP 7.2 and Wildfly :
Modify this part of standalone.xml to set the default datasource :
<?xml version="1.0" encoding="UTF-8"?>
<subsystem xmlns="urn:jboss:domain:datasources:3.0">
<datasources>
<datasource jta="true" jndi-name="java:jboss/datasources/default" pool-name="default" enabled="true" use-java-context="true" use-ccm="true" statistics-enabled="true">
<connection-url>jdbc:mysql://localhost:3306/default?autoReconnect=true&useSSL=false</connection-url>
<driver>mysql</driver>
<security>
<user-name>user</user-name>
<password>password</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
JBoss/Wildfly will pick up this as an default datasource.
Hope this helps you :)
Related
Hoping some one can point me in the right direction.
Trying to get away from hardcoded passwd for postgres in the config file for keycloak 19. I dont want to make changes code nor write a custom class based on sdk aws provides, if possible ; keycloak 19.x and using legacy/wildfly
what is needed here in the code below
jdbc-secretsmanager:postgresql://somename.rds.amazonaws.com:5432/keycloak?ssl=true;sslfactory=org.postgresql.ssl.NonValidatingFactory
<driver>awspostgresql</driver>
<pool>
<max-pool-size>20</max-pool-size>
</pool>
<security>
<user-name>_aws_secret_name</user-name>
</security>
</datasource>
<drivers>
<driver name="awspostgresql" module="com.amazonaws">
<driver-class>com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver</driver-class>
</driver>
</drivers>
</datasources>
===
After satisfying all dependencies/jars, it throws error
===
Jakarta Enterprise Beans subsystem suspension complete
,522 WARN [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 32) WFLYJCA0003: Unable to instantiate driver class "com.amazonaws.secretsmanager.sql.AWSSecretsManagerPostgreSQLDriver": java.lang.IllegalStateException: Could not load real driver with name, "org.postgresql.Driver".
followed by
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.postgresql"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.KeycloakDS is missing [jboss.jdbc-driver.postgresql]",
"jboss.driver-demander.java:jboss/datasources/KeycloakDS is missing [jboss.jdbc-driver.postgresql]"
==== ]
What or how is this supposed to be configured? Appreciate any pointers. Thanks
this is the first time for question.
Please help me to solve this problem.
I've been completed to migration from AS6 to EAP7.1. but, It still has problem with -ds.xml
10:26:01,286 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "mySource.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"mySource.war\".FIRST_MODULE_USE" => "WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"mySource.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJCA0064: Exception deploying datasource java:jboss/datasources/jt400
Caused by: java.lang.IllegalArgumentException: Empty name segment is not allowed for jdbc-driver"}}
upper is the problem log when i tried to debug my source on the JBoss EAP 7.x.
and below is one of my jt400.xml file contents.
<datasource connectable="false" enabled="true" jndi-name="java:jboss/datasources/jt400" jta="true" pool-name="jt400" spy="false" use-ccm="true" use-java-context="true">
<connection-url>jdbc:as400://127.0.0.1</connection-url>
<driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
<datasource-class/>
<driver/>
<transaction-isolation>TRANSACTION_NONE</transaction-isolation>
<pool>
<min-pool-size>0</min-pool-size>
<initial-pool-size>0</initial-pool-size>
<max-pool-size>30</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
<validation>
<check-valid-connection-sql>SELECT * FROM SYSIBM.SYSDUMMY1</check-valid-connection-sql>
<use-fast-fail>false</use-fast-fail>
</validation>
<timeout>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<xa-resource-timeout>0</xa-resource-timeout>
</timeout>
<statement>
<track-statements>false</track-statements>
</statement>
</datasource>
finally, I was copy the driver file (jt400.jar) into the standalone/lib path.
I don't have any idea to solve this problem...
Please anybody help me... It seriously headache for me haha...
Thankyou!
I think that your problem is this line driver. It can't be empty, you need to define the driver. By example:
<driver>mysql</driver>
and after the just define the driver itself, in this example:
<drivers>
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.cj.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.cj.jdbc.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
If you add that area you will resolve the error message.
Problem
I'm trying test my connection and it keeps giving me the same error while at first sight I can't see what I did wrong. Maybe I'm overlooking something...
Error
nexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("data-source" => "ProjectenDS")
],
"operation" => "test-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0047: Connection is not valid",
"rolled-back" => true
}
Standalone-full.xml
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
<datasources>
<datasource jta="true" jndi-name="java:/ProjectenDS" pool-name="ProjectenDS" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/projecten3db</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql-connector-java-5.1.40-bin.jar_com.mysql.jdbc.Driver_5_1</driver>
<pool>
<min-pool-size>10</min-pool-size>
<initial-pool-size>11</initial-pool-size>
<max-pool-size>100</max-pool-size>
</pool>
<security>
<user-name>projecten</user-name>
<password>projecten</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>
</datasources>
</subsystem>
The exception you have is generic.
Check on {WILDFLY_HOME}/standalone/log/server.log
You can use tail -f server.log while you test on the web console.
This will give you the right error to work on.
I solved this error by reducing pool size and set prefill attribute to false on datasource settings.
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
If your datasource is not XA, open standalone.xml and remove the datasource-class property from your datasource definition. Wildfly adds it even if you don't specify it whe you create the datasource.
You may have to restart the server to see it working.
We had such error on MS SQL when our user was not mapped to requested database
try to check is there any error like "Establishing SSL connection without server's identity verification is not recommended.
According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set.
For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'.
You need either to explicitly disable SSL by setting useSSL=false,"
wrong :jdbc:mysql://localhost:3306/demodb
right :jdbc:mysql://localhost:3306/demodb?useSSL=false
...this worked for me!.
and also make sure!
1.mysql connector added
2.turn off "windows firewall" plus any "antivirus" firewall
3.driver class,pool size,connection url with port number
refer:
https://mkyong.com/mysql/mysql-establishing-ssl-connection-without-servers-identity-verification-is-not-recommended/
I am using wildfly 8.2 and oracle 11g and I have my connection pool flushing an invalid connection and creating a new one if possible. I'm using Spring and Hibernate at the back-end too (we are looking up the connection via JNDI)
I could not find a concise example of pool configuration for oracle on the net that I could get to work, so I cribbed bits and bobs from various sources and managed to get it working.
My question is this. I am setting "Validate On Match" equal to true, but the Jboss documention (https://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/beta500/html/ch13s13.html) states that
<validate-on-match> - Prior to JBoss 4.0.5, connection validation occurred when the JCA layer attempted to match a managed connection. With the addition of <background-validation> this is no longer required. Specifying <validate-on-match> forces the old behavior. NOTE: this is typically NOT used in conjunction with <background-validation>
I would not like to use "old behaviour" if I can avoid it. Does anyone have an example of auto recovering connection pools with Oracle 11g Wildfly 8.2. and using the ojdbc6 driver.
Thanks
Btw my current set up for the pool is as below (nb I know I have the pool size set to 1, it was so I could easily kill the session and know the pool recovers).
<datasource jta="true" jndi-name="java:/jboss/datasources/mydatabase" pool-name="mydatabase" enabled="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:#localhost:1521:mydatabase</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>ojdbc6-11.1.0.7.0.jar</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>1</max-pool-size>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>mydatabase</user-name>
<password>mydatabase</password>
</security>
<validation>
<check-valid-connection-sql>SELECT 1 FROM DUAL</check-valid-connection-sql>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
</validation>
<timeout>
<set-tx-query-timeout>false</set-tx-query-timeout>
<blocking-timeout-millis>0</blocking-timeout-millis>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>0</query-timeout>
<use-try-lock>0</use-try-lock>
<allocation-retry>0</allocation-retry>
<allocation-retry-wait-millis>0</allocation-retry-wait-millis>
</timeout>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
</datasources>
Cheer to anyone that can help
Try this validation node:
<validation>
<background-validation>true</background-validation>
<background-validation-millis>200000</background-validation-millis>
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
</validation>
Remember to adjust the value of background-validation-millis.
I need to have H2 in the classpath. I'm using these values :
# driver=org.h2.jdbcx.JdbcDataSource # it doesn't work
driver=org.h2.Driver # it doesnt work too...
url=jdbc:h2:tcp://localhost/~/mydb;AUTO_SERVER=TRUE
login=sa
password=
And I have declared datasource in my standalone.xml :
<datasource jndi-name="java:jboss/datasources/mydb" pool-name="mydb" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:tcp://localhost/~/mydb</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
</security>
<datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
And I have the default module.xml for H2 in JBoss A7.
But when registering the JDBC using this :
Class.forName(driver);
I get this exception :
java.lang.ClassNotFoundException: org.h2.jdbcx.JdbcDataSource
And the same for the other value :
java.lang.ClassNotFoundException: org.h2.Driver
Please can you help me get the solution?
Thank you a lot!
There is normally no need to register the driver, if your (web) application runs in an application server context. You just use the data source. The application server registers the driver for you, and that's why the driver's class is not necessarily visible to your application.
As for JBoss 7, the H2 driver is provided as a module. So if you really need to register it, you could declare a module dependency (in an .ear or in a .war deployment) by adding a jboss-deployment-structure.xml file.
References (regarding to module dependencies):
What's the module name if deploy jdbc in Jboss AS 7 as web application
Add an Explicit Module Dependency to a Deployment
I have the same problem and fixed when added this dependency in maven
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.199</version>
<scope>runtime</scope>
</dependency>
source