Jboss Oracle JDBC connection failed - java

Jboss EAP 6.3, Oracle 11g Express.
I have this oracle datasource in standalone:
<datasource jta="true" jndi-name="java:/OracleDS" pool-name="OracleDS">
<connection-url>jdbc:oracle:thin:#localhost:1521:XE</connection-url>
<driver>oracleDriver</driver>
<security>
<user-name>Boris</user-name>
<password>password</password>
</security>
</datasource>
<drivers>
<driver name="oracleDriver" module="com.oracle">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
The Oracle database is running, I can connect to it using sqlplus:
SQL> connect
Enter user-name: Boris
Enter password:
Connected.
The datasource shows up in the Jboss admin panel. I run a test connection, but it responds with:
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("data-source" => "OracleDS")
],
"operation" => "test-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
"rolled-back" => true
}
And in the jboss console I found this:
Caused by: java.sql.SQLException: ORA-00604: error occurred at recursive SQL lev
el 1
ORA-12705: Cannot access NLS data files or invalid environment specified
but the solutions to that error I found on the internet didn't help.
What am I doing wrong?

The ORA-12705 error suggests that this might be a locale issue. You could try starting up JBoss with a locale that is supported by Oracle XE when converted into an NLS. For example, try adding this to your JBoss startup configuration (JAVA_OPTS variable in jboss-as/bin/run.conf):
-Duser.language=en -Duser.country=US

Related

keycloak , aws secrets manager and postgres

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

fail to migration from jboss as 6 to jboss eap 7.1 with -ds.xml configuration

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.

JBoss - How to set default data source in multi-database environment?

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 :)

MongoDB DataSource Configuration In JBoss Server

How to configure MongoDB DataSource JNDI in JBoss Server.
I downloaded MongoDB jar (mongo-java-driver-3.4.2.jar) and deployed using admin console, it got successfully deployed but when I went to add Datasource in customize option I am not able to see MongoDB driver, the only one option available was h2. Why so? Do I have to do any other configuration change or am I missing any step?
I Even tried to manually create the MongoDB driver and datasource but that is also not working.
I placed module.xml and mongo-java-driver- 3.4.2.jar to the following path
..\devstudio\runtimes\jboss-eap\modules\system\layers\base\org\mongodb\main
--------- module.xml ---------------------
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.mongodb">
<resources>
<resource-root path="mongo-java-driver-3.4.2.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
--------------standalone.xml ------------
<datasource jndi-name="java:jboss/datasources/mongodb" pool-name="mongodb"
enabled="true" use-java-context="true">
<connection-url>jdbc:mongodb://127.0.0.1:27017/example;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>mongodb</driver>
</datasource>
<driver name="mongodb" module="org.mongodb">
<xa-datasource-class>mongodb.jdbc.MongoXADataSource</xa-datasource-class>
</driver>
I was getting the following error when i started the server
("subsystem" => "datasources"),
("data-source" => "mongodb")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable
dependencies" => [
"org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]",
"jboss.driver-demander.java:jboss/datasources/mongodb is missing
[jboss.jdbc-driver.mongodb]"
]}
23:51:44,277 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "mongodb")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable
dependencies" => [
"org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]",
"jboss.driver-demander.java:jboss/datasources/mongodb is missing
[jboss.jdbc-driver.mongodb]",
"org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]"
]}
Could you let me know how to do JNDI Datasource configuration in JBoss Server ?? Please explain in detail as I am new for JNDI Configuration
Refer https://www.progress.com/blogs/configure-connect-for-jdbc-mongodb-driver-with-jboss-eap-64enter link description here

Wildfly 10 can't connect datasource: invalid connection

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/

Categories