users@glassfish.java.net

persistence-unit-ref + java:comp/env/ = NameNotFoundException

From: <glassfish_at_javadesktop.org>
Date: Fri, 08 May 2009 06:14:35 PDT

Hello,

Im trying to deploy a JPA persitence on Glassfish

When trying to use java:comp/env/ in the jndi name for the data source I get

java.lang.RuntimeException: javax.naming.NameNotFoundException: No object bound to name java:comp/env/jdbc/xxx
        at com.sun.enterprise.server.PersistenceUnitInfoImpl._getJtaDataSource(PersistenceUnitInfoImpl.java:283) ...

persitence.xml

<persistence-unit name="xxx-sec-persistence-unit" transaction-type="JTA" >
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <jta-data-source>java:comp/env/jdbc/xxx</jta-data-source>

web.xml

        <resource-ref >
              <description>DB Connection</description>
              <res-ref-name>jdbc/ccbm2</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
              <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>
        <persistence-unit-ref>
            <persistence-unit-ref-name>persistence/xxx-sec-persistence-unit</persistence-unit-ref-name>
            <persistence-unit-name>xxx-sec-persistence-unit</persistence-unit-name>
          </persistence-unit-ref>

sun-web.xml

<sun-web-app>
   <resource-ref>
      <res-ref-name>jdbc/xxx</res-ref-name>
      <jndi-name>jdbc/xxx</jndi-name>
   </resource-ref>
   <jsp-config/>
</sun-web-app>

What am I doing wrong. I it just not supported?

Regards,

Tim
[Message sent by forum member 'timpke' (timpke)]

http://forums.java.net/jive/thread.jspa?messageID=345523