cancel
Showing results for 
Search instead for 
Did you mean: 

Hibernate DB Setup

Former Member
0 Kudos

Hi,

Using hibernate and spring, I have an application that has several mdbs.

The application runs, and I have not experienced any errors during runtime.

However, during startup, I have experienced this problem:

com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException occurred in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot get connection. Reason: the thread of component "ejbContexts/amtsybex.com/dts-core-sda/dts-ejb-sap.jar/FileWriterMDB" in application "amtsybex.com/dts-core-sda" is currently associated with a restricted resource set and it is not allowed to get connection within it.

at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:59)

at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)

at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)

at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2075)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)

It seems like it is not able to get a connection to the database during initialization - which is strange as it gets it during runtime!

I am using a custom datasource which links into the same oracle db as sap, and uses the 'core_lib' as the driver, as recommended by Vladimir on this site.

Any ideas?

Regards,

Andrew

Accepted Solutions (1)

Accepted Solutions (1)

nikolai_tankov
Explorer
0 Kudos

Hi,

According ejb specification resource manager access is forbidden during initialization and during some specific ejb methods. DataSource is resource manager and access to it is also forbidden as a result this exception is thrown.

Before some months I experienced similar problem during hibernate integration and I found that this is just a log. In this stack trace Hibernate just tries to get a connection and if it is not possible later will get a connection without any problem. So the scenario was running and this exception is just redundant trace.

My stack trace was slightly different because hibernate version was different.

at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)

at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)

at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)

Best regards,

Nikolai.

Edited by: Nikolai Tankov on Mar 10, 2008 2:18 PM

Answers (0)