Re: How to create an Oracle XA Datasource within Tomcat 7

2014-09-01 Thread Sylvain Goulmy
Hi Stefan,

I think that the url parameter is invalid, but the driverType parameter was
definitly helpful. I can start my application without any errors with the
following configuration :

  Resource
 factory=org.apache.tomcat.jdbc.naming.GenericNamingResourcesFactory
 name=jdbc/mydatasource-xa
  type=oracle.jdbc.xa.client.OracleXADataSource driverType=thin
 serverName=myDatabaseHost portNumber=1522 databaseName=databaseName
 user=userName password=password /



   Resource abandonWhenPercentageFull=50 auth=Container
 dataSourceJNDI=mydatasource-xa
 factory=org.apache.tomcat.jdbc.pool.DataSourceFactory initialSize=5
 jdbcInterceptors=ResetAbandonedTimer logAbandoned=true maxActive=20
 maxAge=0 maxIdle=10 maxWait=0 minEvictableIdleTimeMillis=12
 minIdle=5 name=jdbc/mydatasource removeAbandoned=true
 removeAbandonedTimeout=600 testOnBorrow=true
 timeBetweenEvictionRunsMillis=3 type=javax.sql.XADataSource
 validationInterval=3 validationQuery=select 1 from dual /


I've yet to test the XA commit/rollback functionality, but the pool
itself is up now.

Thank you for your support.



On Fri, Aug 29, 2014 at 5:17 PM, Stefan Mayr ste...@mayr-stefan.de wrote:

 Am 29.08.2014 14:23, schrieb Sylvain Goulmy:

  Thank you for your feedbacks.

 I had actually already tried a configuration with a url parameter. With
 this configuration :

Resource

 factory=org.apache.tomcat.jdbc.naming.GenericNamingResourcesFactory
 name=jdbc/mydatasource-xa password=password
 type=oracle.jdbc.xa.client.OracleXADataSource user=userName
 url=jdbc:oracle:thin:@myHost:1522:myDataBase /


 Did you try the other option of adding driverType=thin and
 portNumber=1521 ?

 Although I don't get why makeURL is called if an URL is set. From what I
 find via google this could be a bug in the oracle driver.

 Regards,

   Stefan


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




Re: How to create an Oracle XA Datasource within Tomcat 7

2014-08-29 Thread Sylvain Goulmy
Thank you for your feedbacks.

I had actually already tried a configuration with a url parameter. With
this configuration :

  Resource
 factory=org.apache.tomcat.jdbc.naming.GenericNamingResourcesFactory
 name=jdbc/mydatasource-xa password=password
 type=oracle.jdbc.xa.client.OracleXADataSource user=userName
 url=jdbc:oracle:thin:@myHost:1522:myDataBase /



   Resource abandonWhenPercentageFull=50 auth=Container
 dataSourceJNDI=mydatasource-xa
 factory=org.apache.tomcat.jdbc.pool.DataSourceFactory initialSize=5
 jdbcInterceptors=ResetAbandonedTimer logAbandoned=true maxActive=20
 maxAge=0 maxIdle=10 maxWait=0 minEvictableIdleTimeMillis=12
 minIdle=5 name=jdbc/mydatasource removeAbandoned=true
 removeAbandonedTimeout=600 testOnBorrow=true
 timeBetweenEvictionRunsMillis=3 type=javax.sql.XADataSource
 validationInterval=3 validationQuery=select 1 from dual /


I have the following exception :

2014-08-29 12:11:40,151 [default-startStop-1] WARN
  org.apache.naming.NamingContext- Unexpected exception resolving reference
 java.sql.SQLException: Invalid Oracle URL specified:
 OracleDataSource.makeURL
 at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:1277)
  at oracle.jdbc.pool.OracleDataSource.getURL(OracleDataSource.java:1025)
 at
 oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:205)
  at
 oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:156)
 at
 oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:101)
  at
 org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDataSource(PooledConnection.java:218)
 at
 org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:180)
  at
 org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
 at
 org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
  at
 org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
 at
 org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:144)
  at
 org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
 at
 org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
  at
 org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:554)
 at
 org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:242)
  at
 org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:141)


The configuration described in Tomcat Expert is really special, i start
wondering if it is specific to Derby or not.

Do you think we have to define two different ressources (one to describe a
connection and one to set a pool)  when you want to use a XA datasource
with Oracle ?

Regards.
Sylvain


On Wed, Aug 27, 2014 at 2:03 PM, Stefan Mayr ste...@mayr-stefan.de wrote:

 Am 27.08.2014 11:05, schrieb Sylvain Goulmy:

  Hi all,

 I'm trying to setup a XA Datasource configuration in Tomcat 7 with an
 Oracle database.

 I have spent a long time trying to set that configuration up without any
 success.

 I have read the  following blog entry which is i think the only ressource
 that deals with this subject :

 http://www.tomcatexpert.com/blog/2010/04/01/configuring-
 jdbc-pool-high-concurrency

 with the Pooling connections from other data sources paragraph.

 Here is the configuration i have done in my context.xml file :

Resource

 factory=org.apache.tomcat.jdbc.naming.GenericNamingResourcesFactory
 name=jdbc/mydatasource-xa password=password
 type=oracle.jdbc.xa.client.OracleXADataSource user=userName
 databaseName=databaseName serverName=myDatabaseHost
 portNumber=1522 /

  ...

  and here is the exception i have when the application starts :

 2014-08-27 08:25:49,748 [default-startStop-1] ERROR

 org.apache.tomcat.jdbc.pool.ConnectionPool- Unable to create initial
 connections of pool.
 java.sql.SQLException: Invalid Oracle URL specified:
 OracleDataSource.makeURL
   at oracle.jdbc.pool.OracleDataSource.makeURL(
 OracleDataSource.java:1277)
 at oracle.jdbc.pool.OracleDataSource.getURL(OracleDataSource.java:1025)


 The JDBC-Driver cannot create the JDBC-URL from these parameters: use url
 instead of serverName, databaseName, portNumber e.g.
 url=jdbc:oracle:thin:@myhost:1521/orcl or add a driverType, e.g.
 driverType=thin

 see http://www.orafaq.com/wiki/JDBC for URLs and
 http://docs.oracle.com/cd/E18283_01/appdev.112/e13995/oracle/jdbc/pool/
 OracleDataSource.html for the possible parameters and default values.

 Regards,

 Stefan

 --
 Mayr Stefan

 Hausen - Gassenaecker 10
 82269 Geltendorf

 Tel.: 08193 - 9979469


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




Re: How to create an Oracle XA Datasource within Tomcat 7

2014-08-29 Thread Stefan Mayr

Am 29.08.2014 14:23, schrieb Sylvain Goulmy:

Thank you for your feedbacks.

I had actually already tried a configuration with a url parameter. With
this configuration :

   Resource

factory=org.apache.tomcat.jdbc.naming.GenericNamingResourcesFactory
name=jdbc/mydatasource-xa password=password
type=oracle.jdbc.xa.client.OracleXADataSource user=userName
url=jdbc:oracle:thin:@myHost:1522:myDataBase /



Did you try the other option of adding driverType=thin and 
portNumber=1521 ?


Although I don't get why makeURL is called if an URL is set. From what I 
find via google this could be a bug in the oracle driver.


Regards,

  Stefan

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



How to create an Oracle XA Datasource within Tomcat 7

2014-08-27 Thread Sylvain Goulmy
Hi all,

I'm trying to setup a XA Datasource configuration in Tomcat 7 with an
Oracle database.

I have spent a long time trying to set that configuration up without any
success.

I have read the  following blog entry which is i think the only ressource
that deals with this subject :

http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency

with the Pooling connections from other data sources paragraph.

Here is the configuration i have done in my context.xml file :

  Resource
 factory=org.apache.tomcat.jdbc.naming.GenericNamingResourcesFactory
 name=jdbc/mydatasource-xa password=password
 type=oracle.jdbc.xa.client.OracleXADataSource user=userName
 databaseName=databaseName serverName=myDatabaseHost portNumber=1522 /



   Resource abandonWhenPercentageFull=50 auth=Container
 dataSourceJNDI=mydatasource-xa
 factory=org.apache.tomcat.jdbc.pool.DataSourceFactory initialSize=5
 jdbcInterceptors=ResetAbandonedTimer logAbandoned=true maxActive=20
 maxAge=0 maxIdle=10 maxWait=0 minEvictableIdleTimeMillis=12
 minIdle=5 name=jdbc/mydatasource removeAbandoned=true
 removeAbandonedTimeout=600 testOnBorrow=true
 timeBetweenEvictionRunsMillis=3 type=javax.sql.XADataSource
 validationInterval=3 validationQuery=select 1 from dual /


and here is the exception i have when the application starts :

2014-08-27 08:25:49,748 [default-startStop-1] ERROR
 org.apache.tomcat.jdbc.pool.ConnectionPool- Unable to create initial
 connections of pool.
 java.sql.SQLException: Invalid Oracle URL specified:
 OracleDataSource.makeURL
  at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:1277)
 at oracle.jdbc.pool.OracleDataSource.getURL(OracleDataSource.java:1025)
  at
 oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:205)
 at
 oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:156)
  at
 oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:101)
 at
 org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDataSource(PooledConnection.java:218)
  at
 org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:180)
 at
 org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
  at
 org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
 at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
  at
 org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:144)
 at
 org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
  at
 org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
 at
 org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(DataSourceFactory.java:554)
  at
 org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(DataSourceFactory.java:242)
 at
 org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:141)
  at
 javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:842)



Any help would be greatly appreciated.

Regards.
Sylvain


Re: How to create an Oracle XA Datasource within Tomcat 7

2014-08-27 Thread Konstantin Kolinko
2014-08-27 13:05 GMT+04:00 Sylvain Goulmy sygou...@gmail.com:
 Hi all,

 I'm trying to setup a XA Datasource configuration in Tomcat 7 with an
 Oracle database.

 I have spent a long time trying to set that configuration up without any
 success.

 I have read the  following blog entry which is i think the only ressource
 that deals with this subject :

 http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency

 with the Pooling connections from other data sources paragraph.

 Here is the configuration i have done in my context.xml file :

   Resource
 factory=org.apache.tomcat.jdbc.naming.GenericNamingResourcesFactory
 name=jdbc/mydatasource-xa password=password
 type=oracle.jdbc.xa.client.OracleXADataSource user=userName
 databaseName=databaseName serverName=myDatabaseHost portNumber=1522 /



   Resource abandonWhenPercentageFull=50 auth=Container
 dataSourceJNDI=mydatasource-xa
 factory=org.apache.tomcat.jdbc.pool.DataSourceFactory initialSize=5
 jdbcInterceptors=ResetAbandonedTimer logAbandoned=true maxActive=20
 maxAge=0 maxIdle=10 maxWait=0 minEvictableIdleTimeMillis=12
 minIdle=5 name=jdbc/mydatasource removeAbandoned=true
 removeAbandonedTimeout=600 testOnBorrow=true
 timeBetweenEvictionRunsMillis=3 type=javax.sql.XADataSource
 validationInterval=3 validationQuery=select 1 from dual /


 and here is the exception i have when the application starts :

 2014-08-27 08:25:49,748 [default-startStop-1] ERROR
 org.apache.tomcat.jdbc.pool.ConnectionPool- Unable to create initial
 connections of pool.
 java.sql.SQLException: Invalid Oracle URL specified:
 OracleDataSource.makeURL
  at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:1277)
 at oracle.jdbc.pool.OracleDataSource.getURL(OracleDataSource.java:1025)


The example at that 3rd-party site  uses Apache Derby datasource implementation,
org.apache.derby.jdbc.ClientXADataSource.

The databaseName, serverName properties apparently are properties of
that datasource implementation. I expect that the class has setters
like org.apache.derby.jdbc.ClientXADataSource.setServerName(String).

You are using Oracle datasource class.
Good news are that exception actually originates from oracle.jdbc.xa.client.
OracleXADataSource class, so the resource definition works.

Bad news are that apparently it needs some different configuration
properties such as URL to your server.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: How to create an Oracle XA Datasource within Tomcat 7

2014-08-27 Thread Stefan Mayr

Am 27.08.2014 11:05, schrieb Sylvain Goulmy:

Hi all,

I'm trying to setup a XA Datasource configuration in Tomcat 7 with an
Oracle database.

I have spent a long time trying to set that configuration up without any
success.

I have read the  following blog entry which is i think the only ressource
that deals with this subject :

http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency

with the Pooling connections from other data sources paragraph.

Here is the configuration i have done in my context.xml file :

   Resource

factory=org.apache.tomcat.jdbc.naming.GenericNamingResourcesFactory
name=jdbc/mydatasource-xa password=password
type=oracle.jdbc.xa.client.OracleXADataSource user=userName
databaseName=databaseName serverName=myDatabaseHost portNumber=1522 /


...

and here is the exception i have when the application starts :

2014-08-27 08:25:49,748 [default-startStop-1] ERROR

org.apache.tomcat.jdbc.pool.ConnectionPool- Unable to create initial
connections of pool.
java.sql.SQLException: Invalid Oracle URL specified:
OracleDataSource.makeURL
  at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:1277)
at oracle.jdbc.pool.OracleDataSource.getURL(OracleDataSource.java:1025)


The JDBC-Driver cannot create the JDBC-URL from these parameters: use 
url instead of serverName, databaseName, portNumber e.g. 
url=jdbc:oracle:thin:@myhost:1521/orcl or add a driverType, e.g. 
driverType=thin


see http://www.orafaq.com/wiki/JDBC for URLs and 
http://docs.oracle.com/cd/E18283_01/appdev.112/e13995/oracle/jdbc/pool/OracleDataSource.html 
for the possible parameters and default values.


Regards,

Stefan

--
Mayr Stefan

Hausen - Gassenaecker 10
82269 Geltendorf

Tel.: 08193 - 9979469

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org