On Nov 15, 2009, at 8:37 PM, Bevon wrote:


Hi David,
Thanks for your prompt reply. I tried digging into what the actual JNDI
name was for the data source as you suggested and also went with the
standard Geronimo JNDI as well (as opposed to the EJB JNDI). Here’s what I
found:

In both the Hibernate-JPA and Hibernate-Core case, the data source showed
(in the Geronimo console’s JNDI Viewer) as:
jca:/default/Psop_EAR50_Test/JCAManagedConnectionFactory/jdbc/psop/ derbyDs1

The fact that it's the same in both cases makes sense, since I'm declaring the data source at the application level and it doesn't change based on what EJB module I'm using. If I look at the Database Pools view in the console, I see my data source with "jdbc/psop/derbyDs1" as its name and deployed as "default/Psop_EAR_50_Test/1.0/car". Again, the same for both cases and as
expected.

Based on what you stated earlier, in the Hibernate-JPA case, Geronimo
doesn't use JNDI, it just uses the name to lookup the data source. And in
the Hibernate-Core case, Hibernate uses JNDI to do the lookup.

I guess my next question is -- is there a way to provide a "better" JNDI name for a data source in Geronimo? I'd think maybe in the application
metadata somwhere (application.xml, geronimo-application.xml or the
vendor-specific deployment plan for the database pool). The reason I ask
is:
1) The JNDI name is... unwieldy and non-obvious (ie. it's not obvious that
"jdbc/psop/derbyDs1" is registered in JNDI as "jca:/default/...." and
2) It contains the EAR name in it, which I'd rather not have hardcoded into
my EJB module's metadata (for ease of portability reasons).

I am a definite opponent of using global jndi for anything partly for these kind or reasons. In a global jndi name you need a lot of context info to assure that there won't be naming collisions when you deploy 57 datasources named "myDS" for your 114 different independent apps. That's why the ear name gets into the global jndi name, and why it will stay there.

That being said you can modify the global jndi name format with a template in var/config/config-substitutions.properties. I done't advise it however.

I would try to declare a resource-ref in each of your ejb jars and look up the java:comp/env/<res-ref-name> string in hibernate. This will work as long as all calls into hibernate come from javaee components such as ejbs (or on threads whose call stack goes through such a component). This has a little more configuration but doesn't need the context info you are objecting to in the global name.

hope this helps
david jencks



In any case, changing the data source JNDI name in Hibernate configuration
file gets around the publishing errors:
hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate
Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>
<hibernate-configuration>
   <session-factory name="jdbc/psop/hibernateSf1">

<!-- Derby Network Server data source as configured in the EAR -->
       <property
name="hibernate.connection.datasource">jca:/default/Psop_EAR50_Test/ JCAManagedConnectionFactory/jdbc/psop/derbyDs1</property>

       <!-- Derby SQL dialect -->
       <property
name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>

       <!-- Transaction manager lookup class for Geronimno manually
provided. -->
       <property
name = "hibernate .transaction .manager_lookup_class ">org.hibernate.transaction.GeronimoTransactionManagerLookup</ property>

<!-- Transaction manager factory class provided by Hibernate. -->
       <property
name = "hibernate .transaction .factory_class">org.hibernate.transaction.JTATransactionFactory</ property>

       <!-- Show and print nice SQL on stdout -->
       <property name="hibernate.show_sql">true</property>
       <property name="hibernate.format_sql">true</property>

       <!-- List of XML mapping files -->
       <mapping
resource="META-INF/mappings/com/psop/model/hibernate/ PlayerHibernateEntity.hbm.xml"/>
   </session-factory>
</hibernate-configuration>


Thanks in advance,
Bevon




djencks wrote:

Hi Bevon,

I haven't looked through all the files you post but want to give a
couple hints, maybe you can easily track down what is going on.

In Geronimo, the jta-datasource and non-jta-datasource values don't
refer to anything in jndi, they basically look up components
registered in the geronimo kernel.  The JPA architecture has the
container (geronimo's jpa support) setting up an object that includes
these datasources and the rest of the info from the persistence.xml,
suitably resolved. So, you don't need to declare any resource-refs in
your ejb jar anywhere to use jpa.

For non-jpa hibernate, IIUC your explanation, jndi is really used to
find the datasource(s).  I'm not clear on exactly what is getting
looked up.... I strongly advise finding out. I also suggest using the
standard geronimo jndi rather than the openejb jndi context which is
unlikely to have any datasources in it since it is for looking up
ejbs.  I'd hope that if you _don't_ set the hibernate property it
would just use
new InitialContext() which ought to work.

Finally, hibernate might be trying to look up a java:comp/env jndi
name defined by a resource ref in the ejb jar or some completely
specified string for a global jndi name.  In the latter case, you'll
want to check the geronimo.log to make sure you know exactly what the
global jndi name for your datasource actually is.... it gets logged as
the datasource starts.

hope this helps, and if you want to update our docs when you get it
working that would be great!

thanks
david jencks

On Nov 14, 2009, at 11:59 AM, Bevon wrote:


First, my apologies in advance is this should be posted on a
Hibernate board.
But this seems more of a configuration issue specific to Geronimo
so...

Geronimo:  v2.1.4
Hibernate core:  v3.3.2
Derby Network Server:  v10.4.2

I was able to get Hibernate working as my JPA provider (instead of
OpenJPA)
for my EJB3 module.  However, as an academic/learning exercise, I
have been
trying to get Hibernate core working as my persistence layer for my
EJB3
module.  The problem I'm seeing is that during the Hibernate
Configuration.buildSessionFactory() call, a JNDI exception is thrown
stating
that the datasource could not be found.


I have an application-scoped managed datasource declared for my EAR as
follows:
application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xmlns="http://java.sun.com/xml/ns/javaee";

xmlns:application="http://java.sun.com/xml/ns/javaee/
application_5.xsd"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_5.xsd";
           id="Application_ID"
           version="5">
<display-name>PsopEAR5_Test</display-name>
<module>
  <connector>Derby/tranql-connector-derby-client-local-1.4.rar</
connector>
</module>
<module>
  <web>
    <web-uri>Psop_Servlet25_Jsp21.war</web-uri>
    <context-root>Psop_Servlet25_Jsp21</context-root>
  </web>
</module>
<module>
  <ejb>Psop_Ejb30_Hibernate33.jar</ejb>
</module>
</application>


geronimo-application.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<app:application
xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0";

xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0
"

xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2";

xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2";

xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2";
               xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2
"
               xmlns:pers="http://java.sun.com/xml/ns/persistence";
               xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1
"
               xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0
"

xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1";
               application-name="PsopEAR5_Test">
  <dep:environment>
      <dep:moduleId>
          <dep:groupId>default</dep:groupId>
          <dep:artifactId>PsopEAR5_Test</dep:artifactId>
          <dep:version>1.0</dep:version>
          <dep:type>car</dep:type>
      </dep:moduleId>
      <dep:dependencies />
  </dep:environment>
  <app:module>
      <!--
          This connector module is provided by Geronimo to wrap the
JDBC
          client driver needed to access a Derby Network Server data
source.
      -->

<app:connector>Derby/tranql-connector-derby-client-local-1.4.rar</
app:connector>

      <!--
          This deployment plan provides the vendor-specific details
(eg.
          Derby-specific requirements) about the data source.
      -->
      <app:alt-dd>Derby/derby-network-server-plan.xml</app:alt-dd>
  </app:module>
</app:application>


derby-network-server-plan.xml:
<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/
connector-1.2">
  <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2";>
      <dep:moduleId>
          <dep:groupId>console.dbpool</dep:groupId>
          <dep:artifactId>jdbc_psop_derbyDs1</dep:artifactId>
          <dep:version>1.0</dep:version>
          <dep:type>rar</dep:type>
      </dep:moduleId>
      <dep:dependencies>
          <dep:dependency>
              <dep:groupId>org.apache.geronimo.configs</dep:groupId>
              <dep:artifactId>system-database</dep:artifactId>
              <dep:version>2.1.4</dep:version>
              <dep:type>car</dep:type>
          </dep:dependency>
      </dep:dependencies>
  </dep:environment>
  <resourceadapter>
      <outbound-resourceadapter>
          <connection-definition>

<connectionfactory-interface>javax.sql.DataSource</ connectionfactory-
interface>
              <connectiondefinition-instance>
                  <name>jdbc/psop/derbyDs1</name>
                  <config-property-setting
name="DatabaseName">E:\PSOP\Databases\Derby\PSOP_DATABASE</config-
property-setting>
                  <config-property-setting
name="Password">app</config-property-setting>
                  <config-property-setting
name="UserName">app</config-property-setting>
                  <config-property-setting name="LoginTimeout"/>
                  <connectionmanager>
                      <local-transaction/>
                      <single-pool>
                          <max-size>10</max-size>
                          <min-size>0</min-size>
                          <match-one/>
                      </single-pool>
                  </connectionmanager>
              </connectiondefinition-instance>
          </connection-definition>
      </outbound-resourceadapter>
  </resourceadapter>
</connector>


My EJB3 module metadata is as follows:
ejb-jar.xml (essentially empty since I'm using EJB3 annotations):
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns="http://java.sun.com/xml/ns/javaee";
       xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd";
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd";
       version="3.0">
<description>PSOP model implemented with EJB 3.0. PSOP persistence
implemented with Hibernate 3.3 (native).</description>
  <display-name>Psop_Ejb30_Hibernate33</display-name>
</ejb-jar>


openejb-jar.xml (all of the dependency jars were copied into the
Geronimo
repository):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb- jar-2.2"
           xmlns:naming="http://geronimo.apache.org/xml/ns/
naming-1.2"
xmlns:sec="http://geronimo.apache.org/xml/ns/ security-2.0"
           xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2
">
  <sys:environment>
      <sys:moduleId>
          <sys:groupId>default</sys:groupId>
          <sys:artifactId>Psop_Ejb30_Hibernate33</sys:artifactId>
          <sys:version>1.0</sys:version>
          <sys:type>car</sys:type>
      </sys:moduleId>
      <sys:dependencies>
          <sys:dependency>
              <sys:groupId>psop_hibernate</sys:groupId>
              <sys:artifactId>core</sys:artifactId>
              <sys:version>3.3</sys:version>
              <sys:type>jar</sys:type>
          </sys:dependency>
          <sys:dependency>
              <sys:groupId>psop_hibernate</sys:groupId>
              <sys:artifactId>antlr</sys:artifactId>
              <sys:version>2.7.6</sys:version>
              <sys:type>jar</sys:type>
          </sys:dependency>
          <sys:dependency>
              <sys:groupId>psop_hibernate</sys:groupId>
              <sys:artifactId>commons-collections</sys:artifactId>
              <sys:version>3.1</sys:version>
              <sys:type>jar</sys:type>
          </sys:dependency>
          <sys:dependency>
              <sys:groupId>psop_hibernate</sys:groupId>
              <sys:artifactId>dom4j</sys:artifactId>
              <sys:version>1.6.1</sys:version>
              <sys:type>jar</sys:type>
          </sys:dependency>
          <sys:dependency>
              <sys:groupId>psop_hibernate</sys:groupId>
              <sys:artifactId>javassist</sys:artifactId>
              <sys:version>3.9.0.GA</sys:version>
              <sys:type>jar</sys:type>
          </sys:dependency>
          <sys:dependency>
              <sys:groupId>psop_hibernate</sys:groupId>
              <sys:artifactId>jta</sys:artifactId>
              <sys:version>1.1</sys:version>
              <sys:type>jar</sys:type>
          </sys:dependency>
          <sys:dependency>
              <sys:groupId>psop_hibernate</sys:groupId>
              <sys:artifactId>GeronimoTransactionManager</
sys:artifactId>
              <sys:version>1.0</sys:version>
              <sys:type>jar</sys:type>
          </sys:dependency>
          <sys:dependency>
              <sys:groupId>org.slf4j</sys:groupId>
              <sys:artifactId>slf4j-api</sys:artifactId>
              <sys:version>1.4.3</sys:version>
              <sys:type>jar</sys:type>
          </sys:dependency>
      </sys:dependencies>
  </sys:environment>
</openejb-jar>


hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate
Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>
<hibernate-configuration>
  <session-factory name="jdbc/psop/hibernateSf1">

      <!-- Derby Network Server data source as configured in the
EAR -->
      <property
name="hibernate.connection.datasource">jdbc/psop/derbyDs1</property>

      <!-- Derby SQL dialect -->
      <property
name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</ property>

      <!-- Transaction manager lookup class for Geronimno manually
provided. -->
      <property
name
=
"hibernate
.transaction
.manager_lookup_class
">org.hibernate.transaction.GeronimoTransactionManagerLookup</
property>

      <!-- Transaction manager factory class provided by Hibernate.
-->
      <property
name
=
"hibernate
.transaction
.factory_class">org.hibernate.transaction.JTATransactionFactory</
property>

      <!-- Show and print nice SQL on stdout -->
      <property name="hibernate.show_sql">true</property>
      <property name="hibernate.format_sql">true</property>

      <!-- List of XML mapping files -->
      <mapping
resource="META-INF/mappings/com/psop/model/hibernate/
PlayerHibernateEntity.hbm.xml"/>
  </session-factory>
</hibernate-configuration>




Here is the code that tries to build the SessionFactory:
Configuration hibernateConfiguration = new Configuration().configure(
"/META-INF/hibernate.cfg.xml" );
hibernateConfiguration.setProperty(
org.hibernate.cfg.Environment.JNDI_CLASS,
"org.apache.openejb.client.RemoteInitialContextFactory" ) );
hibernateConfiguration
.setProperty( org.hibernate.cfg.Environment.JNDI_URL,
"ejbd://localhost:4201" );

sessionFactorySingleInstance =
hibernateConfiguration.buildSessionFactory();
// throws JNDI exception
// as a test, if I do a JNDI lookup on "jdbc/psop/derbyDs1", I get
the same
exception


Here is the exception that occurs during publishing (I'm using Eclipse
Ganymede with GEP):
javax.naming.NameNotFoundException: /jdbc/psop/derbyDs1 does not
exist in
the system.  Check that the app was successfully deployed.
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java: 277)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at
com
.psop
.model
.ejb
.config
.EjbHibernateModelConfig
.initializeSessionFactory(EjbHibernateModelConfig.java:234)
        at
com
.psop
.model
.ejb
.config
.EjbHibernateModelConfig
.initializeModel(EjbHibernateModelConfig.java:292)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext
$Invocation.invoke(ReflectionInvocationContext.java:158)
        at
org
.apache
.openejb
.core
.interceptor
.ReflectionInvocationContext
.proceed(ReflectionInvocationContext.java:141)
        at
org
.apache
.openejb
.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
        at
org
.apache
.openejb
.core.stateless.StatelessContainer._invoke(StatelessContainer.java:
210)
        at
org
.apache
.openejb
.core.stateless.StatelessContainer._invoke(StatelessContainer.java:
188)
        at
org
.apache
.openejb
.core.stateless.StatelessContainer.invoke(StatelessContainer.java: 165)
        at
org
.apache
.openejb
.server
.ejbd
.EjbRequestHandler
.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:238)
        at
org
.apache
.openejb
.server .ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:
129)
        at
org
.apache
.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
        at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:
122)
        at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:
84)
        at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:
60)
        at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78)
at org.apache.openejb.server.ServicePool$3.run(ServicePool.java: 101)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)



Geronimo log (I don't see any binding of the datasource to JNDI here): 2009-11-14 14:30:06,903 INFO [config] Configuring Service(id=Default
Stateless Container, type=Container, provider-id=Default Stateless
Container)
2009-11-14 14:30:06,903 INFO [config] Configuring Service(id=Default
Stateful Container, type=Container, provider-id=Default Stateful
Container)
2009-11-14 14:30:06,903 INFO  [config] Configuring
Service(id=Default BMP
Container, type=Container, provider-id=Default BMP Container)
2009-11-14 14:30:06,903 INFO  [config] Configuring
Service(id=Default CMP
Container, type=Container, provider-id=Default CMP Container)
2009-11-14 14:30:06,903 INFO  [config] Configuring app:
default/PsopEAR5_Test/1.0/car
2009-11-14 14:30:06,919 INFO  [OpenEJB] Auto-deploying ejb
ejb/psop/ejbHibernateFinder:
EjbDeployment(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateFinder)
2009-11-14 14:30:06,919 INFO  [OpenEJB] Auto-deploying ejb
ejb/psop/ejbHibernateDestroyer:
EjbDeployment(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateDestroyer)
2009-11-14 14:30:06,919 INFO  [OpenEJB] Auto-deploying ejb
ejb/psop/ejbHibernateCreator:
EjbDeployment(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateCreator)
2009-11-14 14:30:06,919 INFO  [OpenEJB] Auto-deploying ejb
ejb/psop/ejbHibernateModelConfig:
EjbDeployment(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateModelConfig)
2009-11-14 14:30:06,919 INFO  [config] Loaded Module:
default/PsopEAR5_Test/1.0/car
2009-11-14 14:30:07,810 INFO  [KernelContextGBean] bound gbean
default/PsopEAR5_Test/1.0/car?J2EEApplication=default/PsopEAR5_Test/
1.0/car,JCAConnectionFactory=jdbc/psop/derbyDs1,JCAResource=Derby/
tranql-connector-derby-client-local-1.4.rar,ResourceAdapter=Derby/
tranql-connector-derby-client-
local-1.4.rar,ResourceAdapterModule=Derby/tranql-connector-derby-
client-local-1.4.rar,j2eeType=JCAManagedConnectionFactory,name=jdbc/
psop/derbyDs1
at name default/PsopEAR5_Test/JCAManagedConnectionFactory/jdbc/psop/
derbyDs1
2009-11-14 14:30:07,810 INFO  [startup] Assembling app: C:\Documents
and
Settings\Bevon Palod\Local
Settings\Temp\geronimo-deploymentUtil3743899707090395072.jar
2009-11-14 14:30:07,872 INFO  [startup]
Jndi(name=ejb/psop/ejbHibernateFinderRemote) -->
Ejb(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateFinder)
2009-11-14 14:30:07,872 INFO  [startup]
Jndi(name=ejb/psop/ejbHibernateDestroyerRemote) -->
Ejb(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateDestroyer)
2009-11-14 14:30:07,872 INFO  [startup]
Jndi(name=ejb/psop/ejbHibernateCreatorRemote) -->
Ejb(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateCreator)
2009-11-14 14:30:07,872 INFO  [startup]
Jndi(name=ejb/psop/ejbHibernateModelConfigRemote) -->
Ejb(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateModelConfig)
2009-11-14 14:30:07,872 INFO  [startup] Created
Ejb(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateFinder,
ejb-name=ejb/psop/ejbHibernateFinder, container=Default Stateless
Container)
2009-11-14 14:30:07,872 INFO  [startup] Created
Ejb(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateDestroyer,
ejb-name=ejb/psop/ejbHibernateDestroyer, container=Default Stateless
Container)
2009-11-14 14:30:07,872 INFO  [startup] Created
Ejb(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateCreator,
ejb-name=ejb/psop/ejbHibernateCreator, container=Default Stateless
Container)
2009-11-14 14:30:07,872 INFO  [startup] Created
Ejb(deployment-id=Psop_Ejb30_Hibernate33.jar/ejb/psop/
ejbHibernateModelConfig,
ejb-name=ejb/psop/ejbHibernateModelConfig, container=Default Stateless
Container)
2009-11-14 14:30:07,872 INFO  [startup] Deployed
Application(path=C:\Documents and Settings\Bevon Palod\Local
Settings\Temp\geronimo-deploymentUtil3743899707090395072.jar)
2009-11-14 14:30:08,013 INFO  [OpenEJB] invoking method create on
Psop_Ejb30_Hibernate33.jar/ejb/psop/ejbHibernateModelConfig
2009-11-14 14:30:08,013 INFO  [OpenEJB] finished invoking method
create
2009-11-14 14:30:08,013 INFO  [Transaction] TX Required: Started
transaction
org.apache.geronimo.transaction.manager.transactioni...@188807b
2009-11-14 14:30:08,091 INFO  [Environment] Hibernate 3.3.2.GA
2009-11-14 14:30:08,091 INFO  [Environment] hibernate.properties not
found
2009-11-14 14:30:08,106 INFO  [Environment] Bytecode provider name :
javassist
2009-11-14 14:30:08,122 INFO  [Environment] using JDK 1.4
java.sql.Timestamp
handling
2009-11-14 14:30:08,356 INFO  [Configuration] configuring from
resource:
/META-INF/hibernate.cfg.xml
2009-11-14 14:30:08,356 INFO [Configuration] Configuration resource:
/META-INF/hibernate.cfg.xml
2009-11-14 14:30:08,497 INFO  [Configuration] Reading mappings from
resource
: META-INF/mappings/com/psop/model/hibernate/
PlayerHibernateEntity.hbm.xml
2009-11-14 14:30:08,606 INFO  [HbmBinder] Mapping class:
com.psop.model.hibernate.PlayerHibernateEntity -> PLAYERS
2009-11-14 14:30:08,685 INFO  [Configuration] Configured
SessionFactory:
jdbc/psop/hibernateSf1
2009-11-14 14:30:08,685 INFO  [Transaction] TX Required: Committing
transaction
org.apache.geronimo.transaction.manager.transactioni...@188807b


I do not see this exception when I make use of Hibernate Annotations +
EnitityManager and stick with JPA-only API/annotations in my code.
In terms
of configuration, the EAR metadata is exactly the same (save for
swapping
the EJB3 modules).  The EJB3 module metadata has two differences:
1.  I've got a persistence.xml instead of hibernate.cfg.xml.
2.  I've added the Hibernate Annotations + EntityManager
dependencies to my
openejb-jar.xml (won't bother pasting it again here).

persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/ persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";
           version="1.0" >
  <persistence-unit name="Psop_Ejb30_Jpa10" transaction-type="JTA">
      <description>Hibernate v3.3 JPA provider</description>
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>jdbc/psop/derbyDs1</jta-data-source>
      <class>com.psop.model.jpa.PlayerJpaEntity</class>
      <properties>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.GeronimoTransactionManagerLookup"/>
          <property name="hibernate.show_sql" value="true"/>
          <property name="hibernate.format_sql" value="true"/>
          <property name="hibernate.dialect"
value="org.hibernate.dialect.DerbyDialect"/>
      </properties>
  </persistence-unit>
</persistence>


My best guess -- I'm doing something wrong or it's a faulty
assumption that
my datasource will automagically be registered in JNDI (as it is
with JPA).

Please bear with me as I'm a newbie.  I've been banging on Geronimo
for just
about a month and have been at Hibernate for maybe a week.  If
someone could
shed some light on this problem or perhaps point me to some
documentation
(yes, I've read the Hibernate to Geronimo migration docs, yes, I've
googled,
yes, I did a keyword search on this forum for "Hibernate datasource").

Many thanks in advance!!!
Bevon
--
View this message in context:
http://old.nabble.com/JNDI-lookup-fails-with-Hibernate-%2B-application-scoped-datasource-tp26353366s134p26353366.html
Sent from the Apache Geronimo - Users mailing list archive at
Nabble.com.





--
View this message in context: 
http://old.nabble.com/JNDI-lookup-fails-with-Hibernate-%2B-application-scoped-datasource-tp26353366s134p26366792.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Reply via email to