Hibernate could not find datasource - Websphere

This is a discussion on Hibernate could not find datasource - Websphere ; My goal is using hibernate with WAS. I'm running WAS 6.1.0.13. I've used following articles as a reference: http://www.ibm.com/developerworks/websphere/techjournal/0409_patil/0409_patil.html http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html I have a data source named MyDataSource and I'm well aware that it works on my JSP pages. So, in ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Hibernate could not find datasource

  1. Hibernate could not find datasource

    My goal is using hibernate with WAS. I'm running WAS 6.1.0.13. I've used following articles as a reference:



    http://www.ibm.com/developerworks/websphere/techjournal/0409_patil/0409_patil.html

    http://www.ibm.com/developerworks/websphere/techjournal/0609_alcott/0609_alcott.html



    I have a data source named MyDataSource and I'm well aware that it works on my JSP pages. So, in my hibernate.cfg.xml file there is a reference to that data source:



    <property name="connection.datasource">

    jdbc/MyDataSource

    </property>

  2. Re: Hibernate could not find datasource

    Seems you're running code in an unmanaged thread:
    "
    Could not find datasource: java:/comp/env/jdbc/MyDataSource
    javax.naming.ConfigurationException: Name space accessor for the java: name
    space has not been set. Possible cause is that the user is specifying a
    java: URL name in a JNDI Context method call but is not running in a J2EE
    client or server environment.
    "


  3. Re: Hibernate could not find datasource

    This condition typically arises when an application spawns a thread and then attempts a java: lookup from the spawned thread. The java: context is thread-local and won't be on the spawned thread.

    Ben_ wrote:
    > Seems you're running code in an unmanaged thread:
    > "
    > Could not find datasource: java:/comp/env/jdbc/MyDataSource
    > javax.naming.ConfigurationException: Name space accessor for the java:
    > name space has not been set. Possible cause is that the user is
    > specifying a java: URL name in a JNDI Context method call but is not
    > running in a J2EE client or server environment.
    > "


+ Reply to Thread