Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 86570 invoked from network); 5 Dec 2009 05:04:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Dec 2009 05:04:15 -0000 Received: (qmail 9053 invoked by uid 500); 5 Dec 2009 05:04:14 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 8954 invoked by uid 500); 5 Dec 2009 05:04:13 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 8945 invoked by uid 99); 5 Dec 2009 05:04:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Dec 2009 05:04:13 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Dec 2009 05:04:03 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NGmo1-0003qR-Pd for user@geronimo.apache.org; Fri, 04 Dec 2009 21:03:41 -0800 Message-ID: <26653049.post@talk.nabble.com> Date: Fri, 4 Dec 2009 21:03:41 -0800 (PST) From: Bevon To: user@geronimo.apache.org Subject: Re: JNDI lookup fails with Hibernate + application-scoped datasource In-Reply-To: <26402649.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: bevon.palod@gmail.com References: <26353366.post@talk.nabble.com> <3655024B-1148-4760-9622-C0F961A0058D@yahoo.com> <26366792.post@talk.nabble.com> <78F28B9A-8E52-46D8-9D8D-B6723548A1C6@yahoo.com> <26402649.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Hi, Just to close off this issue, the solution I've tried is as follows: 1. Declare the data source name in the Hibernate configuration with the JNDI name of my own choosing. 2. Use the Context.rename(String, String) API to programmatically rename the undesireable data souce JNDI name generated by Geronimo to the JNDI nam= e declared in the Hibernate configuration. This is done during my application's startup routines... ie before I make any programmatic calls t= o Hibernate. 3. Use a properties file to provide the "mapping" between the Geronimo-generated JNDI name and the JNDI name of my own choosing. More concretely: 1. hibernate.cfg.xml: =20 jdbc/psop/derbyDs1 = =20 ... 2. application startup routine: Context initialContext =3D null; Object oldDataSource =3D null; try { initialContext =3D new InitialContext(); try { // first check to see if the new JNDI name is already i= n use oldDataSource =3D initialContext.lookup( getPsopHibernateProperties().getProperty( NEW_DATA_SOURCE_JNDI_NAME_PROPERT= Y ) ); } catch( NamingException ne ) { logger.logp( Level.FINE, getClass().getName(), "initializeDataSource()", "A JNDI exception occurred during lookup o= f a potentially old data source object. This is not an application error.", ne ); } // end try/catch // if the new JNDI name is already in use... if( oldDataSource !=3D null ) { logger.logp( Level.FINE, getClass().getName(), "initializeDataSource()", "Overwriting an existing JNDI entry." ); // lookup the new data source object at the old JNDI name Object newDataSource =3D initialContext.lookup( getPsopHibernateProperties().getProperty( OLD_DATA_SOURCE_JNDI_NAME_PROPERT= Y ) ); // rebind it to the new JNDI name (thus overwriting the old // data source object) initialContext.rebind( getPsopHibernateProperties().getProperty( NEW_DATA_SOURCE_JNDI_NAME_PROPERT= Y ), newDataSource ); // clean up the old JNDI name initialContext.unbind( getPsopHibernateProperties().getProperty( OLD_DATA_SOURCE_JNDI_NAME_PROPERT= Y ) ); initialContext.destroySubcontext( getPsopHibernateProperties().getProperty( OLD_DATA_SOURCE_JNDI_NAME_PROPERT= Y ) ); } // if the new JNDI name is not in use... else { logger.logp( Level.FINE, getClass().getName(), "initializeDataSource()", "Renaming the data source JNDI name." ); // just do a rename operation (this also cleans up the old // JNDI entry) initialContext.rename( getPsopHibernateProperties().getProperty( OLD_DATA_SOURCE_JNDI_NAME_PROPERT= Y ), =20 getPsopHibernateProperties().getProperty( NEW_DATA_SOURCE_JNDI_NAME_PROPERT= Y ) ); } // end if } catch( NamingException ne ) { // a real JNDI error... handle appropriately } // end try/catch 3. psopHibernate.properties: # Properties file that contains additional configuration information for Hibernate 3.3. # # Do not rename this file or its property keys. # .... # JNDI name mapping for the data source oldDataSourceJndiName=3Djca:/default/Psop_EAR50_Test/JCAManagedConnectionFa= ctory/jdbc/psop/derbyDs1 newDataSourceJndiName=3Djdbc/psop/derbyDs1 .... # end psopHibernate.properties Of course, this is a bit hacky, but at least in this way, the hack doesn't appear in the "official" Hibernate, EJB or EAR metadata.... it sits in an external properties file. Any thoughts, opinions or further suggestions would be appreciated. Thanks! Bevon Bevon wrote: >=20 > Hi David, > Thanks again for the prompt reply. >=20 > I certainly agree that a global JNDI registry seems like it can be easily > "polluted". Ideally, developers/deployers would be providing enough > context in their JNDI names to avoid collisions instead of leaving that t= o > Geronimo, but I guess that kind of well-known convention is still a ways > off. >=20 > I'm uncomfortable declaring a resource-ref for any of my EJBs just for th= e > sake of registering my data source with a JNDI name of my own choosing.= =20 > My EJBs don't access the data source directly... it's all Hibernate. >=20 > Is there a way to provide some kind of mapping in the EAR metadata > (application.xml, geronimo-application.xml or the deploy plan) or perhaps > "force" a given JNDI name? >=20 > I'll do some investigating on the JNDI API Context.rename(String, String)= .=20 > Perhaps I can unmangle the JNDI name before Hibernate gets to it ;-). >=20 > Kind Regards, > Bevon >=20 >=20 >=20 > djencks wrote: >>=20 >>=20 >> On Nov 15, 2009, at 8:37 PM, Bevon wrote: >>=20 >>> >>> Hi David, >>> Thanks for your prompt reply. I tried digging into what the actual =20 >>> 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=E2= =80=99s =20 >>> what I >>> found: >>> >>> In both the Hibernate-JPA and Hibernate-Core case, the data source =20 >>> showed >>> (in the Geronimo console=E2=80=99s JNDI Viewer) as: >>> jca:/default/Psop_EAR50_Test/JCAManagedConnectionFactory/jdbc/psop/=20 >>> derbyDs1 >>> >>> The fact that it's the same in both cases makes sense, since I'm =20 >>> declaring >>> the data source at the application level and it doesn't change based = =20 >>> on what >>> EJB module I'm using. If I look at the Database Pools view in the =20 >>> console, >>> I see my data source with "jdbc/psop/derbyDs1" as its name and =20 >>> deployed as >>> "default/Psop_EAR_50_Test/1.0/car". Again, the same for both cases =20 >>> 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. =20 >>> 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" =20 >>> JNDI >>> name for a data source in Geronimo? I'd think maybe in the =20 >>> application >>> metadata somwhere (application.xml, geronimo-application.xml or the >>> vendor-specific deployment plan for the database pool). The reason =20 >>> I ask >>> is: >>> 1) The JNDI name is... unwieldy and non-obvious (ie. it's not =20 >>> 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 =20 >>> hardcoded into >>> my EJB module's metadata (for ease of portability reasons). >>=20 >> I am a definite opponent of using global jndi for anything partly for = =20 >> these kind or reasons. In a global jndi name you need a lot of =20 >> context info to assure that there won't be naming collisions when you = =20 >> deploy 57 datasources named "myDS" for your 114 different independent = =20 >> apps. That's why the ear name gets into the global jndi name, and why = =20 >> it will stay there. >>=20 >> That being said you can modify the global jndi name format with a =20 >> template in var/config/config-substitutions.properties. I done't =20 >> advise it however. >>=20 >> I would try to declare a resource-ref in each of your ejb jars and =20 >> look up the java:comp/env/ string in hibernate. This =20 >> will work as long as all calls into hibernate come from javaee =20 >> components such as ejbs (or on threads whose call stack goes through =20 >> such a component). This has a little more configuration but doesn't =20 >> need the context info you are objecting to in the global name. >>=20 >> hope this helps >> david jencks >>=20 >>=20 >>> >>> In any case, changing the data source JNDI name in Hibernate =20 >>> configuration >>> file gets around the publishing errors: >>> hibernate.cfg.xml: >>> >>> >> Configuration DTD 3.0//EN" >>> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> >>> >>> >>> >>> >>> >> name=3D"hibernate.connection.datasource">jca:/default/Psop_EAR50_Test/= =20 >>> JCAManagedConnectionFactory/jdbc/psop/derbyDs1 >>> >>> >>> >> name=3D"hibernate.dialect">org.hibernate.dialect.DerbyDialect >>> >>> >>> >> name=20 >>> =3D=20 >>> "hibernate=20 >>> .transaction=20 >>> .manager_lookup_class=20 >>> ">org.hibernate.transaction.GeronimoTransactionManagerLookup>> property> >>> >>> >>> >> name=20 >>> =3D=20 >>> "hibernate=20 >>> .transaction=20 >>> .factory_class">org.hibernate.transaction.JTATransactionFactory>> property> >>> >>> >>> true >>> true >>> >>> >>> >> resource=3D"META-INF/mappings/com/psop/model/hibernate/=20 >>> PlayerHibernateEntity.hbm.xml"/> >>> >>> >>> >>> >>> 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 = =20 >>>> 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 =20 >>>> 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 = =20 >>>> 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 =20 >>>>> EAR as >>>>> follows: >>>>> application.xml: >>>>> >>>>> >>>> xmlns=3D"http://java.sun.com/xml/ns/javaee" >>>>> >>>>> xmlns:application=3D"http://java.sun.com/xml/ns/javaee/ >>>>> application_5.xsd" >>>>> xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee >>>>> http://java.sun.com/xml/ns/javaee/application_5.xsd" >>>>> id=3D"Application_ID" >>>>> version=3D"5"> >>>>> PsopEAR5_Test >>>>> >>>>> Derby/tranql-connector-derby-client-local-1.4.rar>>>> connector> >>>>> >>>>> >>>>> >>>>> Psop_Servlet25_Jsp21.war >>>>> Psop_Servlet25_Jsp21 >>>>> >>>>> >>>>> >>>>> Psop_Ejb30_Hibernate33.jar >>>>> >>>>> >>>>> >>>>> >>>>> geronimo-application.xml: >>>>> >>>>> >>>> xmlns:app=3D"http://geronimo.apache.org/xml/ns/j2ee/application-2.0" >>>>> >>>>> xmlns:client=3D"http://geronimo.apache.org/xml/ns/j2ee/application-cl= ient-2.0 >>>>> " >>>>> >>>>> xmlns:conn=3D"http://geronimo.apache.org/xml/ns/j2ee/connector-1.2" >>>>> >>>>> xmlns:dep=3D"http://geronimo.apache.org/xml/ns/deployment-1.2" >>>>> >>>>> xmlns:ejb=3D"http://openejb.apache.org/xml/ns/openejb-jar-2.2" >>>>> =20 >>>>> xmlns:name=3D"http://geronimo.apache.org/xml/ns/naming-1.2 >>>>> " >>>>> xmlns:pers=3D"http://java.sun.com/xml/ns/persistence" >>>>> xmlns:pkgen=3D"http://openejb.apache.org/xml/ns/pkgen-= 2.1 >>>>> " >>>>> =20 >>>>> xmlns:sec=3D"http://geronimo.apache.org/xml/ns/security-2.0 >>>>> " >>>>> >>>>> xmlns:web=3D"http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1" >>>>> application-name=3D"PsopEAR5_Test"> >>>>> >>>>> >>>>> default >>>>> PsopEAR5_Test >>>>> 1.0 >>>>> car >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> Derby/tranql-connector-derby-client-local-1.4.rar>>>> app:connector> >>>>> >>>>> >>>>> Derby/derby-network-server-plan.xml >>>>> >>>>> >>>>> >>>>> >>>>> derby-network-server-plan.xml: >>>>> >>>>> >>>> connector-1.2"> >>>>> >>>> xmlns:dep=3D"http://geronimo.apache.org/xml/ns/deployment-1.2"> >>>>> >>>>> console.dbpool >>>>> jdbc_psop_derbyDs1 >>>>> 1.0 >>>>> rar >>>>> >>>>> >>>>> >>>>> org.apache.geronimo.configs >>>>> system-database >>>>> 2.1.4 >>>>> car >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> javax.sql.DataSource>>>> connectionfactory- >>>>> interface> >>>>> >>>>> jdbc/psop/derbyDs1 >>>>> >>>> name=3D"DatabaseName">E:\PSOP\Databases\Derby\PSOP_DATABASE>>>> property-setting> >>>>> >>>> name=3D"Password">app >>>>> >>>> name=3D"UserName">app >>>>> >>>>> >>>>> >>>>> >>>>> 10 >>>>> 0 >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> My EJB3 module metadata is as follows: >>>>> ejb-jar.xml (essentially empty since I'm using EJB3 annotations): >>>>> >>>>> >>>> xmlns=3D"http://java.sun.com/xml/ns/javaee" >>>>> xmlns:ejb=3D"http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd= " >>>>> xsi:schemaLocation=3D"http://java.sun.com/xml/ns/javaee >>>>> http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" >>>>> version=3D"3.0"> >>>>> PSOP model implemented with EJB 3.0. PSOP =20 >>>>> persistence >>>>> implemented with Hibernate 3.3 (native). >>>>> Psop_Ejb30_Hibernate33 >>>>> >>>>> >>>>> >>>>> openejb-jar.xml (all of the dependency jars were copied into the >>>>> Geronimo >>>>> repository): >>>>> >>>>> >>>> jar-2.2" >>>>> xmlns:naming=3D"http://geronimo.apache.org/xml/ns/ >>>>> naming-1.2" >>>>> xmlns:sec=3D"http://geronimo.apache.org/xml/ns/=20 >>>>> security-2.0" >>>>> xmlns:sys=3D"http://geronimo.apache.org/xml/ns/deployment-= 1.2 >>>>> "> >>>>> >>>>> >>>>> default >>>>> Psop_Ejb30_Hibernate33 >>>>> 1.0 >>>>> car >>>>> >>>>> >>>>> >>>>> psop_hibernate >>>>> core >>>>> 3.3 >>>>> jar >>>>> >>>>> >>>>> psop_hibernate >>>>> antlr >>>>> 2.7.6 >>>>> jar >>>>> >>>>> >>>>> psop_hibernate >>>>> commons-collections >>>>> 3.1 >>>>> jar >>>>> >>>>> >>>>> psop_hibernate >>>>> dom4j >>>>> 1.6.1 >>>>> jar >>>>> >>>>> >>>>> psop_hibernate >>>>> javassist >>>>> 3.9.0.GA >>>>> jar >>>>> >>>>> >>>>> psop_hibernate >>>>> jta >>>>> 1.1 >>>>> jar >>>>> >>>>> >>>>> psop_hibernate >>>>> GeronimoTransactionManager>>>> sys:artifactId> >>>>> 1.0 >>>>> jar >>>>> >>>>> >>>>> org.slf4j >>>>> slf4j-api >>>>> 1.4.3 >>>>> jar >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> hibernate.cfg.xml: >>>>> >>>>> >>>> Configuration DTD 3.0//EN" >>>>> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> name=3D"hibernate.connection.datasource">jdbc/psop/derbyDs1 >>>>> >>>>> >>>>> >>>> name=3D"hibernate.dialect">org.hibernate.dialect.DerbyDialect>>>> property> >>>>> >>>>> >>>>> >>>> name >>>>> =3D >>>>> "hibernate >>>>> .transaction >>>>> .manager_lookup_class >>>>> ">org.hibernate.transaction.GeronimoTransactionManagerLookup>>>> property> >>>>> >>>>> >>>>> >>>> name >>>>> =3D >>>>> "hibernate >>>>> .transaction >>>>> .factory_class">org.hibernate.transaction.JTATransactionFactory>>>> property> >>>>> >>>>> >>>>> true >>>>> true >>>>> >>>>> >>>>> >>>> resource=3D"META-INF/mappings/com/psop/model/hibernate/ >>>>> PlayerHibernateEntity.hbm.xml"/> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> Here is the code that tries to build the SessionFactory: >>>>> Configuration hibernateConfiguration =3D new =20 >>>>> 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 =3D >>>>> 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 =20 >>>>> Eclipse >>>>> Ganymede with GEP): >>>>> javax.naming.NameNotFoundException: /jdbc/psop/derbyDs1 does not >>>>> exist in >>>>> the system. Check that the app was successfully deployed. >>>>> =09at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:= =20 >>>>> 277) >>>>> =09at javax.naming.InitialContext.lookup(Unknown Source) >>>>> =09at >>>>> com >>>>> .psop >>>>> .model >>>>> .ejb >>>>> .config >>>>> .EjbHibernateModelConfig >>>>> .initializeSessionFactory(EjbHibernateModelConfig.java:234) >>>>> =09at >>>>> com >>>>> .psop >>>>> .model >>>>> .ejb >>>>> .config >>>>> .EjbHibernateModelConfig >>>>> .initializeModel(EjbHibernateModelConfig.java:292) >>>>> =09at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>> =09at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) >>>>> =09at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) >>>>> =09at java.lang.reflect.Method.invoke(Unknown Source) >>>>> =09at >>>>> org.apache.openejb.core.interceptor.ReflectionInvocationContext >>>>> $Invocation.invoke(ReflectionInvocationContext.java:158) >>>>> =09at >>>>> org >>>>> .apache >>>>> .openejb >>>>> .core >>>>> .interceptor >>>>> .ReflectionInvocationContext >>>>> .proceed(ReflectionInvocationContext.java:141) >>>>> =09at >>>>> org >>>>> .apache >>>>> .openejb >>>>> .core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67) >>>>> =09at >>>>> org >>>>> .apache >>>>> .openejb >>>>> .core.stateless.StatelessContainer._invoke(StatelessContainer.java: >>>>> 210) >>>>> =09at >>>>> org >>>>> .apache >>>>> .openejb >>>>> .core.stateless.StatelessContainer._invoke(StatelessContainer.java: >>>>> 188) >>>>> =09at >>>>> org >>>>> .apache >>>>> .openejb >>>>> .core.stateless.StatelessContainer.invoke(StatelessContainer.java:=20 >>>>> 165) >>>>> =09at >>>>> org >>>>> .apache >>>>> .openejb >>>>> .server >>>>> .ejbd >>>>> .EjbRequestHandler >>>>> .doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:238) >>>>> =09at >>>>> org >>>>> .apache >>>>> .openejb >>>>> .server=20 >>>>> .ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java: >>>>> 129) >>>>> =09at >>>>> org >>>>> .apache >>>>> .openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164) >>>>> =09at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java= : >>>>> 122) >>>>> =09at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java= : >>>>> 84) >>>>> =09at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java= : >>>>> 60) >>>>> =09at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78= ) >>>>> =09at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:= =20 >>>>> 101) >>>>> =09at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown >>>>> Source) >>>>> =09at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown =20 >>>>> Source) >>>>> =09at java.lang.Thread.run(Unknown Source) >>>>> >>>>> >>>>> >>>>> Geronimo log (I don't see any binding of the datasource to JNDI =20 >>>>> here): >>>>> 2009-11-14 14:30:06,903 INFO [config] Configuring =20 >>>>> Service(id=3DDefault >>>>> Stateless Container, type=3DContainer, provider-id=3DDefault Stateles= s >>>>> Container) >>>>> 2009-11-14 14:30:06,903 INFO [config] Configuring =20 >>>>> Service(id=3DDefault >>>>> Stateful Container, type=3DContainer, provider-id=3DDefault Stateful >>>>> Container) >>>>> 2009-11-14 14:30:06,903 INFO [config] Configuring >>>>> Service(id=3DDefault BMP >>>>> Container, type=3DContainer, provider-id=3DDefault BMP Container) >>>>> 2009-11-14 14:30:06,903 INFO [config] Configuring >>>>> Service(id=3DDefault CMP >>>>> Container, type=3DContainer, provider-id=3DDefault 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=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateFinder) >>>>> 2009-11-14 14:30:06,919 INFO [OpenEJB] Auto-deploying ejb >>>>> ejb/psop/ejbHibernateDestroyer: >>>>> EjbDeployment(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateDestroyer) >>>>> 2009-11-14 14:30:06,919 INFO [OpenEJB] Auto-deploying ejb >>>>> ejb/psop/ejbHibernateCreator: >>>>> EjbDeployment(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateCreator) >>>>> 2009-11-14 14:30:06,919 INFO [OpenEJB] Auto-deploying ejb >>>>> ejb/psop/ejbHibernateModelConfig: >>>>> EjbDeployment(deployment-id=3DPsop_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=3Ddefault/PsopEAR5_Test= / >>>>> 1.0/car,JCAConnectionFactory=3Djdbc/psop/derbyDs1,JCAResource=3DDerby= / >>>>> tranql-connector-derby-client-local-1.4.rar,ResourceAdapter=3DDerby/ >>>>> tranql-connector-derby-client- >>>>> local-1.4.rar,ResourceAdapterModule=3DDerby/tranql-connector-derby- >>>>> client-local-1.4.rar,j2eeType=3DJCAManagedConnectionFactory,name=3Djd= bc/ >>>>> 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=3Dejb/psop/ejbHibernateFinderRemote) --> >>>>> Ejb(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateFinder) >>>>> 2009-11-14 14:30:07,872 INFO [startup] >>>>> Jndi(name=3Dejb/psop/ejbHibernateDestroyerRemote) --> >>>>> Ejb(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateDestroyer) >>>>> 2009-11-14 14:30:07,872 INFO [startup] >>>>> Jndi(name=3Dejb/psop/ejbHibernateCreatorRemote) --> >>>>> Ejb(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateCreator) >>>>> 2009-11-14 14:30:07,872 INFO [startup] >>>>> Jndi(name=3Dejb/psop/ejbHibernateModelConfigRemote) --> >>>>> Ejb(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateModelConfig) >>>>> 2009-11-14 14:30:07,872 INFO [startup] Created >>>>> Ejb(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateFinder, >>>>> ejb-name=3Dejb/psop/ejbHibernateFinder, container=3DDefault Stateless >>>>> Container) >>>>> 2009-11-14 14:30:07,872 INFO [startup] Created >>>>> Ejb(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateDestroyer, >>>>> ejb-name=3Dejb/psop/ejbHibernateDestroyer, container=3DDefault Statel= ess >>>>> Container) >>>>> 2009-11-14 14:30:07,872 INFO [startup] Created >>>>> Ejb(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateCreator, >>>>> ejb-name=3Dejb/psop/ejbHibernateCreator, container=3DDefault Stateles= s >>>>> Container) >>>>> 2009-11-14 14:30:07,872 INFO [startup] Created >>>>> Ejb(deployment-id=3DPsop_Ejb30_Hibernate33.jar/ejb/psop/ >>>>> ejbHibernateModelConfig, >>>>> ejb-name=3Dejb/psop/ejbHibernateModelConfig, container=3DDefault =20 >>>>> Stateless >>>>> Container) >>>>> 2009-11-14 14:30:07,872 INFO [startup] Deployed >>>>> Application(path=3DC:\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.TransactionImpl@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 =20 >>>>> 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.TransactionImpl@188807b >>>>> >>>>> >>>>> I do not see this exception when I make use of Hibernate =20 >>>>> 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: >>>>> >>>>> >>>> xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >>>>> xsi:schemaLocation=3D"http://java.sun.com/xml/ns/=20 >>>>> persistence >>>>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" >>>>> version=3D"1.0" > >>>>> >>>>> Hibernate v3.3 JPA provider >>>>> org.hibernate.ejb.HibernatePersistence >>>>> jdbc/psop/derbyDs1 >>>>> com.psop.model.jpa.PlayerJpaEntity >>>>> >>>>> >>>> name=3D"hibernate.transaction.manager_lookup_class" >>>>> value=3D"org.hibernate.transaction.GeronimoTransactionManagerLookup"/= > >>>>> >>>>> >>>>> >>>> value=3D"org.hibernate.dialect.DerbyDialect"/> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> 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 =20 >>>>> datasource"). >>>>> >>>>> Many thanks in advance!!! >>>>> Bevon >>>>> --=20 >>>>> View this message in context: >>>>> http://old.nabble.com/JNDI-lookup-fails-with-Hibernate-%2B-applicatio= n-scoped-datasource-tp26353366s134p26353366.html >>>>> Sent from the Apache Geronimo - Users mailing list archive at >>>>> Nabble.com. >>>>> >>>> >>>> >>>> >>> >>> --=20 >>> 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 =20 >>> Nabble.com. >>> >>=20 >>=20 >>=20 >=20 >=20 --=20 View this message in context: http://old.nabble.com/JNDI-lookup-fails-with-= Hibernate-%2B-application-scoped-datasource-tp26353366s134p26653049.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.