cancel
Showing results for 
Search instead for 
Did you mean: 

ResourceException - problems

Former Member
0 Kudos

Hi all,

I get this error when I want to connect the data source alias:

<b>ResourceException in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot open resource(Managed Connection) with LocalTransaction support or add a second one in the same transaction, for component "ejbContexts/sap.com/com.sap.xi.repository/sap.com/com.sap.xi.repository/MapServiceBean" in application "sap.com/com.sap.xi.repository"</b>

This is the code:

InitialContext ctx = new InitialContext(env);
DataSource ds =	(DataSource) ctx.lookup("jdbc/UDF_Oracle_XIFunction");
Connection con = ds.getConnection();

The datasource could be found but the connection causes the Exception.

I think it's a configuration problem but I couldn't find it out. Does somebody have an idea?

Thanx,

Susanne

Accepted Solutions (0)

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Susanne,

1. Since you're using the data source from an EJB, you should declare a resource-ref in the ejb-jar.xml and use the "java:comp/env" prefix to look it up.

2. Furthermore, you must use the InitialContext no-arg constructor to obtain the JNDI environment of the bean.

3. Another problematic point could be if you're using another resource in the same transaction, e.g. another DataSource, QueueConnectionFactory, TopicConnectionFactory, or javax.resource.cci.ConnectionFactory. If more than one resource is used in a single transaction, then they must be configured with XA support.

Please check this points and tell me if you need more help.

Best regards,

Vladimir

Former Member
0 Kudos

Hi Vladimir,

first thanks for your help.

To 1. It's no EJB, it's a java application.

To 2. Sorry, that was my mistake in the posting. I use InitialContext ctx = new InitialContext();

To 3. I have some problems to understand you. Maybe it's better to explain our enviroment. We use oracle 8.1.7.

The data source is configured in this way:

Driver name: Oracle8iThin (which I defined before and uploaded the classes12.jar)

JDBC version: 1.0 (no XA support)

Driver class: oracle.jdbc.driver.OracleDriver

Database Url: jdbc:oracle:thin:@.....

SQL Engine: Vendor SQL

Initial Connections: 1

With JDBC version: 2.0 (with XA support) it doesn't work. I tried with Datasource Type 'XADataSource' and 'ConnectionPoolDataSource' and different SQL Engines.

I uploaded my java application into the XI Design Integration Builder into the imported archives of the mapping objects (only jar and zip files are allowed). If I use in the message mapping a method from my application I get the error. In this method I try to connect to this data source alias. I use no other DataSource.

Any idea?

Thanx,

Susanne

Former Member
0 Kudos

Hi all,

the problem is solved.. I needed a XADataSource but this data source didn't worked fine. This OSS message helped:

..

This is a known problem - it happens due to the weirdness of the Oracle JDBC driver when setting properties one by one rather than via the URL property. In this case the Object Factory field should leave empty.

You need only 3 jdbc driver properties to configure the datasource:

URL (all caps), user, password. The rest of the properties (database,

host, port ...) are specified as value of the URL property. Example:

jdbc:oracle:thin:@10.0.0.1:1521:ORA9D1B4

...

The XADataSource with JDBC Version 2.0 works fine now and also my java program.

Susanne