Skip to Content
avatar image
Former Member

Restricted resource set on EJB? No DB connection...

I get the following error:

Caused by: 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/.../TreeHolderBean" in application "..." is currently associated with a restricted resource set and it is not allowed to get connection within it.

I get this from a Web Dynpro application, that references an EJB application through local interface, the EJB wants to connect to Database through a stateful session bean.

No idea what that means... Any help?

Thx,

Frank

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 08, 2009 at 02:04 PM

    How is the connection being established? Via data source alias?

    BR, Sergei

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Siarhei Pisarenka

      It was a stupid mistake from my site.

      I instantiated a resource via the statement in the declaration of a private variable inside a stateless Session Bean. Like

      private Resource myRes = new Resource();
      

      Inside that "new Resource()" somewhere the DB connection was made. That will naturaly not work. I put that statement in the business method and voila it worked.

      Thx for your time and help anyway 😊

      Frank

  • avatar image
    Former Member
    Jun 16, 2009 at 02:02 PM

    Hi all,

    i get a very similar exception:

    "ResourceException occurred in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot get connection. Reason: the thread of component 'ejbContexts/JavaEE/.../<StatelessBean>' in application 'JavaEE/<app>' is currently associated with a restricted resource set and it is not allowed to get connection within it."

    We declared the data source & an data source alias in separate data-sources.xml and data-source-aliases.xml files in the META-INF folder and the above stated error occures during write operations. As background: we use Hibernate as persistence provider and a TableGenerator based GeneratedValue for the associated object ID, declared via annotations in the ejb 3 project.

    any help is very appreciated!

    Arne Hildebrand

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Frank,

      thanks for your answer. IMHO Hibernate will do this transparently (obtain connections & stuff around). Anyhow - i am going to refactor our app in order to avoid using hibernate in favor to the extisting persistence provider. I have still some trouble with it but i will open another thread therefore.

      Best, Arne