Below is the data source configuration in my Tomcat 7.
Need to convert this into JBoss 6.1, specifically the Eviction & removeAbandoned settings in the standalone.xml file.
Can anyone tell me where I can configure these settings in JBoss?
<Resource connectionCacheName="XXX"
connectionCachingEnabled="true" driverClassName="com.mysql.jdbc.Driver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
initialSize="10" logAbandoned="true" maxActive="100" maxWait="10000" minEvictableIdleTimeMillis="60000"
minIdle="10" removeAbandoned="true" removeAbandonedTimeout="60" testOnBorrow="true"
testOnReturn="false" testWhileIdle="true" timeBetweenEvictionRunsMillis="30000"
type="javax.sql.DataSource" name="XXXX" url="jdbc:mysql://XXXX"
username="XX" password="XXXX" validationInterval="30000" validationQuery="SELECT
1"/>
According to this Tomcat to JBoss migration guide it should be:
4.x - 5.x - 6.x -> datasource-ds.xml file into JBOSS_HOME/server/[server-name]/deploy
7.x -> datasource-ds.xml file into JBOSS_HOME/standalone/deployments or as a module into JBOSS_HOME/modules
Related
I have upgraded Tomcat from 7 to 9. I am getting exception while start up. It is throwing below exception:
oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver
context.xml has following :
<Resource auth="Container" driverClassName="oracle.jdbc.xa.client.OracleXADataSource"
logAbandoned="true" initialSize="1" maxActive="2" maxIdle="2"
minIdle="2" timeBetweenEvictionRunsMillis="34000"
inEvictableIdleTimeMillis="55000" validationQuery="SELECT 1 FROM DUAL"
validationInterval="34" testOnBorrow="true" removeAbandoned="true"
removeAbandonedTimeout="600" name="jdbc/regionalDS" password="XXX"
type="javax.sql.DataSource" url="jdbc:oracle:thin:#HOSTURL"
username="XXX" />
Please let me know, what changes I need to do.
Two things you can try :
1. Change the type to type="javax.sql.XADataSource"
2. Check that the url is in the form of url="jdbc:oracle:thin:#your_host_name:port_say_1521:service_or_sid"
Has anybody a running example configuration for:
Apache Tomcat (TomEE)/8.5.6 (7.0.2) PLUME
Oracle 11g (ojdbc7.jar)
to match EE/JPA 2.1-Development as near as possible?
Currently i get TomEE's user database, if i try to use my datasource. I think it's caused by the log entry "org.apache.openejb.config.AutoConfig.deploy Found matching datasource: jdbc/jKgvDS but this one is not a JTA datasource", falling back to the last known running datasource. So how can i configure a valid JTA datasource?
server.xml:
<Resource id="jKgvDS" name="jdbc/jKgvDS"
jtaManaged="true"
auth="Container"
type="oracle.jdbc.xa.client.OracleXADataSource"
driverClassName="oracle.jdbc.xa.client.OracleXADataSource"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:#db:1521:db"
username="myuser"
password="mypass"
maxActive="20"
maxIdle="30"
maxWait="-1"
validationQuery="SELECT 1 FROM DUAL"
/>
context.xml (tried in conf and app-file)
<ResourceLink global='jdbc/jKgvDS'
name='jdbc/jKgvDS' type="javax.sql.XADatasource"
auth="Container" />
persistence.xml
<persistence-unit name="jKgvPU" transaction-type="JTA">
<jta-data-source>jdbc/jKgvDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<validation-mode>NONE</validation-mode>
<properties>
<property
name="openjpa.jdbc.DBDictionary"
value="org.apache.openjpa.jdbc.sql.OracleDictionary" />
<property
name="openjpa.jdbc.DBDictionary"
value="oracle(maxEmbeddedBlobSize=-1,maxEmbeddedClobSize=-1)" />
<property
name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)" />
</properties>
</persistence-unit>
Here we go (yeah...):
<Resource id="jKgvDS" name="jdbc/jKgvDS"
jtaManaged="true"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
url="jdbc:oracle:thin:#POSDBORA:1521:posdbora"
username="myuser"
password="mypass"
maxActive="20"
maxIdle="30"
maxWait="-1"
validationQuery="SELECT 1 FROM DUAL"
/>
References in web.xml or context.xml are not needed to run.
My web application connect DB by Tomcat jdbc pool.
this is my Tomcat context.xml
<Resource
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
name="jdbc/OracleDB"
auth="Container"
type="javax.sql.DataSource"
initialSize="70"
maxActive="100"
maxIdle="30"
minIdle="10"
maxWait="5000"
removeAbandoned="true"
removeAbandonedTimeout="60"
username="XXOO"
password="XXOO"
driverClassName="oracle.jdbc.driver.OracleDriver"
validationQuery="SELECT 'OK'"
testWhileIdle="true"
testOnBorrow="true"
numTestsPerEvictionRun="5"
timeBetweenEvictionRunsMillis="30000"
minEvictableIdleTimeMillis="60000"
url="jdbc:oracle:thin:#XXOO:testdb"/>
connection timeout will be happened 1min50sec
If I use JDBC to connect DB,it would not happen.
So what's setting do I lose or modify?
I have a web application that uses Tomcat 7, Spring MVC 4.0, and JPA (Hibernate implementation). I am migrating this application to jBoss/Wildfly application server.
Currently, the DataSource is injected in the application with JNDI in a Spring configuration file:
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/MY_DB" expected-type="javax.sql.DataSource" />
The data source itself is defined in $CATALINA_HOME/conf/context.xml in the following way:
<Context>
<Resource name="jdbc/MY_DB"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/MY_DB?useUnicode=yes&characterEncoding=UTF-8"
username="user1"
password=""
validationQuery="select 1"
removeAbandoned="true"
removeAbandonedTimeout="120"
maxWait="60"
maxActive="20"
maxIdle="10" />
</Context>
How can I define this JNDI DataSource in JBoss/Wildfly?
First, you must make the JDBC driver available to the application server; then you can configure the data source itself.
See more details in Data Source Configuration in AS 7 and DataSource configuration
I want to set the fixedString=true connection property for the Oracle JDBC driver in the datasource definition in Orion Application Server 2.0.7 (latest stable release).
I've tried the following but didn't work:
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="datasource_name" location="jdbc/datasource_location"
connection-driver="oracle.jdbc.OracleDriver"
username="user" password="pass"
url="jdbc:oracle:thin:#//database_host:1521/XE" >
<property name="fixedString" value="true" />
</data-source>
Note: I've managed to set the property in Tomcat 6.0 this way (using the same Oracle JDBC driver, of course):
<Resource name="jdbc/datasource_name" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="user" password="pass" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:#//database_host:1521/XE"
connectionProperties="fixedString=true;"
/>
But I need to set this in Orion. How can I do that?
It is a bug in the oracle application server you have to install OAS 10.1.2.3 has fix for that