You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by luoluo <lu...@hotmail.com> on 2008/04/01 15:32:16 UTC
Re: Persistence unit deploy error in 2.1 but works in 2.02
The data source is created by wizard. The dependency is created in Geronimo
plan. Here is the plan:
geronimo-web.xml
<environment>
<moduleId>
<groupId>inpulse8</groupId>
<artifactId>CMWS</artifactId>
<version>1.0.0</version>
<type>war</type>
</moduleId>
<dependencies>
<dependency>
<groupId>console.dbpool</groupId>
<artifactId>inpulse8_cmws</artifactId>
</dependency>
</dependencies>
<hidden-classes>
<filter>org.hibernate</filter>
</hidden-classes>
</environment>
<context-root>/CMWS</context-root>
<resource-ref>
<ref-name>jdbc/cmwsDS</ref-name>
<resource-link>inpulse8_cmws</resource-link>
</resource-ref>
in web.xml, the data source is declared:
<resource-ref>
<res-ref-name>jdbc/cmwsDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
Now I changed the persistence.xml to:
<persistence-unit name="CMWS"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>inpulse8_cmws</jta-data-source>
<non-jta-data-source>inpulse8_cmws</non-jta-data-source>
<properties>
<property name="hibernate.archive.autodetection"
value="class" />
<!-- Deploy environment: Using db pooling ->
<property name="hibernate.connection.datasource"
value="java:comp/env/jdbc/cmwsDS" />
<!- Deploy environment End -->
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JDBCTransactionFactory" />
</properties>
</persistence-unit>
It could be deployed, but the entity manager can not be initialized because
of exceptions:
WARNING: Found unrecognized persistence provider
"org.hibernate.ejb.HibernatePersistence" in place of OpenJPA provider. This
provider's properties will not be used.
javax.persistence.PersistenceException: Provider error. Provider:
org.hibernate.ejb.HibernatePersistence
at javax.persistence.Persistence.createFactory(Persistence.java:176)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:112)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:66)
at
com.ek3.inpulse.cmws.persistence.JpaUtil.<clinit>(JpaUtil.java:39)
at
com.ek3.inpulse.cmws.domain.sessionproxy.SessionInvocationHandler.invoke(SessionInvocationHandler.java:37)
at $Proxy74.listConfigedClients(Unknown Source)
at
com.ek3.inpulse.cmws.serviceinterface.ProcessConfigurationServiceImpl.listConfigedClients(ProcessConfigurationServiceImpl.java:459)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:107)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:77)
at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:100)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:63)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
at
org.apache.geronimo.cxf.GeronimoDestination.invoke(GeronimoDestination.java:115)
at
org.apache.geronimo.cxf.CXFWebServiceContainer.processPOST(CXFWebServiceContainer.java:107)
at
org.apache.geronimo.cxf.CXFWebServiceContainer.invoke(CXFWebServiceContainer.java:83)
at
org.apache.geronimo.webservices.WebServiceContainerInvoker.service(WebServiceContainerInvoker.java:84)
at
org.apache.geronimo.webservices.POJOWebServiceServlet.service(POJOWebServiceServlet.java:79)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:396)
at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit:
ContentManagementWorkflow] Unable to build EntityManagerFactory
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createFactory(Persistence.java:172)
... 40 more
Caused by: org.hibernate.HibernateException: Could not find datasource
at
org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
at
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at
org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
at
org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at
org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 42 more
Caused by: javax.naming.NameNotFoundException: inpulse8_cmws
at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:169)
at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:603)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
I think because hibernate is not loaded into container (I packaged it into
my war file). It can not find the data_source without JNDI entry. Is there
any way to embedded hibernate into Geronimo? I use some of hibernate
specific annotations to extend standard JPA so hibernate is required here.
Thanks,
Bill
djencks wrote:
>
> This is progress :-)
>
> I assume your datasource plan has something like:
>
> <connectiondefinition-instance>
> <name>inpulse_cmws</name>
>
> In this case you need to do two things:
>
> - in persistence.xml, include
> <jta-datasource>inpulse_cmws</jta-datasource>
>
> - in the geronimo plan for your web app, include a dependency on the
> module defining the datasource.
>
> I think that you already have the second set up since that would be
> needed for the jndi lookup to work in g 2.0.2
>
> If this doesn't help please include more of your plans.
>
> thanks
> david jencks
>
>
> On Mar 31, 2008, at 2:24 PM, WEIPING (BILL) LUO wrote:
>
>>
>> Thanks!
>>
>> I am not sure which name should I use. So I tried use the db-pool
>> name and jdbc/cmwsDS. Geronimo can not deploy it and throw out
>> Unable to resolve reference "JtaDataSourceWrapper"
>> in gbean inpulse8/ContentManagementWorkflow/1.0.0/war?
>> J2EEApplication=null,PersistenceUnitModule=WEB-INF/
>> classes/,WebModule=inpulse8/ContentManagementWorkflow/1.0.0/
>> war,j2eeType=PersistenceUnit,name=ContentManagementWorkflow
>> to a gbean matching the pattern [?name=java:/
>> inpulse_cmws#org.apache.geronimo.naming.ResourceSource]
>> due to: No matches for referencePatterns: [?name=java:/
>> inpulse_cmws#org.apache.geronimo.naming.ResourceSource]
>> org.apache.geronimo.common.DeploymentException: Unable to resolve
>> reference "JtaDataSourceWrapper"
>> in gbean inpulse8/ContentManagementWorkflow/1.0.0/war?
>> J2EEApplication=null,PersistenceUnitModule=WEB-INF/
>> classes/,WebModule=inpulse8/ContentManagementWorkflow/1.0.0/
>> war,j2eeType=PersistenceUnit,name=ContentManagementWorkflow
>> to a gbean matching the pattern [?name=java:/
>> inpulse_cmws#org.apache.geronimo.naming.ResourceSource]
>> due to: No matches for referencePatterns: [?name=java:/
>> inpulse_cmws#org.apache.geronimo.naming.ResourceSource]
>> at
>> org.apache.geronimo.deployment.DeploymentContext.getConfigurationData(
>> DeploymentContext.java:516)
>> at org.apache.geronimo.deployment.Deployer.install(Deployer.java:319)
>> at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:256)
>> at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:133)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke
>> (ReflectionMethodInvoker.java:34)
>> at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke
>> (GBeanOperation.java:124)
>> at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke
>> (GBeanInstance.java:867)
>> at org.apache.geronimo.kernel.basic.BasicKernel.invoke
>> (BasicKernel.java:239)
>> at
>> org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDe
>> ploy(AbstractDeployCommand.java:116)
>> at
>> org.apache.geronimo.deployment.plugin.local.DistributeCommand.run
>> (DistributeCommand.java:61)
>> at java.lang.Thread.run(Thread.java:619)
>>
>> So is there any document to discuss about how to set it without JNDI?
>>
>>
>> Regards,
>>
>> Bill
>> ----------------------------------------
>>> From: david_jencks@yahoo.com
>>> Subject: Re: Persistence unit deploy error in 2.1 but works in 2.02
>>> Date: Mon, 31 Mar 2008 13:37:58 -0700
>>> To: user@geronimo.apache.org
>>>
>>> It's generally considered more polite to continue the original thread
>>> you start, answering requests for more information, rather than to
>>> appear to ignore responses and start new threads on the same topic.
>>> In this case I realize you may be having problems with your mail
>>> provider.
>>> On Mar 31, 2008, at 1:25 PM, luoluo wrote:
>>>
>>>>
>>>> Hi,
>>>>
>>>> I have an application using JPA with hibernate. I changed the
>>>> persistence
>>>> provider to hibernate and trying to using db-pools. It works
>>>> perfectly fine
>>>> in Geronimo 2.02. But when I tried to deploy it to Geronimo 2.1. It
>>>> throw
>>>> out an exception with can not find JNDI entry for the data source
>>>> when
>>>> Geronimo try to start the application.
>>>>
>>>> in persistence.xml, I use below to refer the data source:
>>>>
>>>>
>>>> org.hibernate.ejb.HibernatePersistence
>>>>
>>>> > value="class" />
>>>>
>>>> > value="java:/comp/env/jdbc/CmwsDS" />
>>>> ...
>>>>
>>>> The data source is created and defined in web.xml too.
>>>>
>>>> I found the different between 2.0.2 and 2.1. In 2.0.2, the entity
>>>> manager
>>>> was initialized when first time db-access. At that time, the data
>>>> source is
>>>> already be registered in JNDI as /comp/env/jdbc/...DS.
>>>>
>>>> In 2.1, Geronimo try to initialize the entity manager when starting
>>>> the
>>>> application. The sequence is wrong. It tried to find the data
>>>> source before
>>>> the reference in Web.xml been registered. So the JNDI entry not find
>>>> exception was thrown out.
>>>>
>>>> Is that a bug of Geronimo 2.1? Is there any way to work around this
>>>> issue in
>>>> 2.1?
>>>
>>> I recommend you use the jpa standard way of specifying datasources
>>> for jpa (using the jta-datasource and non-jta-datasource elements)
>>> rather than this hibernate specific way using a hibernate specific
>>> property. Since in geronimo the jpa standard way does not rely on
>>> jndi, you will not have this problem.
>>>
>>> Can you provide a stack trace of the problem you are seeing? That
>>> would help figure out what is causing the earlier initialization.
>>>
>>> thanks
>>> david jencks
>>>
>>>>
>>>> Thanks!
>>>>
>>>> Bill
>>>>
>>>> --
>>>> View this message in context: http://www.nabble.com/Persistence-
>>>> unit-deploy-error-in-2.1-but-works-in-2.02-
>>>> tp16396504s134p16396504.html
>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>> Nabble.com.
>>>>
>>>
>
>
>
--
View this message in context: http://www.nabble.com/Persistence-unit-deploy-error-in-2.1-but-works-in-2.02-tp16396504s134p16418427.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
Re: Persistence unit deploy error in 2.1 but works in 2.02
Posted by luoluo <lu...@hotmail.com>.
I un-comment the hibernate data source property. It could be deployed and
works fine.
It seems the first jta-data-source makes the persistence unit to be accepted
by Geronimo. And the hibernate data source setting makes hibernate could
correctly locate the data source.
luoluo wrote:
>
> The data source is created by wizard. The dependency is created in
> Geronimo plan. Here is the plan:
> geronimo-web.xml
> <environment>
> <moduleId>
> <groupId>inpulse8</groupId>
> <artifactId>CMWS</artifactId>
> <version>1.0.0</version>
> <type>war</type>
> </moduleId>
> <dependencies>
> <dependency>
> <groupId>console.dbpool</groupId>
> <artifactId>inpulse8_cmws</artifactId>
> </dependency>
> </dependencies>
> <hidden-classes>
> <filter>org.hibernate</filter>
> </hidden-classes>
>
> </environment>
>
> <context-root>/CMWS</context-root>
>
> <resource-ref>
> <ref-name>jdbc/cmwsDS</ref-name>
> <resource-link>inpulse8_cmws</resource-link>
> </resource-ref>
>
> in web.xml, the data source is declared:
> <resource-ref>
> <res-ref-name>jdbc/cmwsDS</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> <res-sharing-scope>Shareable</res-sharing-scope>
> </resource-ref>
>
> Now I changed the persistence.xml to:
>
> <persistence-unit name="CMWS"
> transaction-type="RESOURCE_LOCAL">
> <provider>org.hibernate.ejb.HibernatePersistence</provider>
> <jta-data-source>inpulse8_cmws</jta-data-source>
> <non-jta-data-source>inpulse8_cmws</non-jta-data-source>
> <properties>
> <property name="hibernate.archive.autodetection"
> value="class" />
>
> <!-- Deploy environment: Using db pooling ->
> <property name="hibernate.connection.datasource"
> value="java:comp/env/jdbc/cmwsDS" />
> <!- Deploy environment End -->
>
> <property name="hibernate.dialect"
> value="org.hibernate.dialect.MySQL5InnoDBDialect" />
>
> <property name="hibernate.transaction.factory_class"
> value="org.hibernate.transaction.JDBCTransactionFactory" />
> </properties>
>
> </persistence-unit>
>
> It could be deployed, but the entity manager can not be initialized
> because of exceptions:
>
> WARNING: Found unrecognized persistence provider
> "org.hibernate.ejb.HibernatePersistence" in place of OpenJPA provider.
> This provider's properties will not be used.
> javax.persistence.PersistenceException: Provider error. Provider:
> org.hibernate.ejb.HibernatePersistence
> at
> javax.persistence.Persistence.createFactory(Persistence.java:176)
> at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:112)
> at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:66)
> at
> com.ek3.inpulse.cmws.persistence.JpaUtil.<clinit>(JpaUtil.java:39)
> at
> com.ek3.inpulse.cmws.domain.sessionproxy.SessionInvocationHandler.invoke(SessionInvocationHandler.java:37)
> at $Proxy74.listConfigedClients(Unknown Source)
> at
> com.ek3.inpulse.cmws.serviceinterface.ProcessConfigurationServiceImpl.listConfigedClients(ProcessConfigurationServiceImpl.java:459)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:107)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:77)
> at
> org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:100)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:63)
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
> at
> org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
> at
> org.apache.geronimo.cxf.GeronimoDestination.invoke(GeronimoDestination.java:115)
> at
> org.apache.geronimo.cxf.CXFWebServiceContainer.processPOST(CXFWebServiceContainer.java:107)
> at
> org.apache.geronimo.cxf.CXFWebServiceContainer.invoke(CXFWebServiceContainer.java:83)
> at
> org.apache.geronimo.webservices.WebServiceContainerInvoker.service(WebServiceContainerInvoker.java:84)
> at
> org.apache.geronimo.webservices.POJOWebServiceServlet.service(POJOWebServiceServlet.java:79)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> at
> org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
> at
> org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:396)
> at
> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.persistence.PersistenceException: [PersistenceUnit:
> ContentManagementWorkflow] Unable to build EntityManagerFactory
> at
> org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
> at
> org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
> at
> javax.persistence.Persistence.createFactory(Persistence.java:172)
> ... 40 more
> Caused by: org.hibernate.HibernateException: Could not find datasource
> at
> org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
> at
> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
> at
> org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
> at
> org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
> at
> org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2073)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
> at
> org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
> at
> org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
> ... 42 more
> Caused by: javax.naming.NameNotFoundException: inpulse8_cmws
> at
> org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:169)
> at
> org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:603)
> at javax.naming.InitialContext.lookup(InitialContext.java:392)
> at
> org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
>
> I think because hibernate is not loaded into container (I packaged it into
> my war file). It can not find the data_source without JNDI entry. Is there
> any way to embedded hibernate into Geronimo? I use some of hibernate
> specific annotations to extend standard JPA so hibernate is required here.
>
> Thanks,
> Bill
>
> djencks wrote:
>>
>> This is progress :-)
>>
>> I assume your datasource plan has something like:
>>
>> <connectiondefinition-instance>
>> <name>inpulse_cmws</name>
>>
>> In this case you need to do two things:
>>
>> - in persistence.xml, include
>> <jta-datasource>inpulse_cmws</jta-datasource>
>>
>> - in the geronimo plan for your web app, include a dependency on the
>> module defining the datasource.
>>
>> I think that you already have the second set up since that would be
>> needed for the jndi lookup to work in g 2.0.2
>>
>> If this doesn't help please include more of your plans.
>>
>> thanks
>> david jencks
>>
>>
>> On Mar 31, 2008, at 2:24 PM, WEIPING (BILL) LUO wrote:
>>
>>>
>>> Thanks!
>>>
>>> I am not sure which name should I use. So I tried use the db-pool
>>> name and jdbc/cmwsDS. Geronimo can not deploy it and throw out
>>> Unable to resolve reference "JtaDataSourceWrapper"
>>> in gbean inpulse8/ContentManagementWorkflow/1.0.0/war?
>>> J2EEApplication=null,PersistenceUnitModule=WEB-INF/
>>> classes/,WebModule=inpulse8/ContentManagementWorkflow/1.0.0/
>>> war,j2eeType=PersistenceUnit,name=ContentManagementWorkflow
>>> to a gbean matching the pattern [?name=java:/
>>> inpulse_cmws#org.apache.geronimo.naming.ResourceSource]
>>> due to: No matches for referencePatterns: [?name=java:/
>>> inpulse_cmws#org.apache.geronimo.naming.ResourceSource]
>>> org.apache.geronimo.common.DeploymentException: Unable to resolve
>>> reference "JtaDataSourceWrapper"
>>> in gbean inpulse8/ContentManagementWorkflow/1.0.0/war?
>>> J2EEApplication=null,PersistenceUnitModule=WEB-INF/
>>> classes/,WebModule=inpulse8/ContentManagementWorkflow/1.0.0/
>>> war,j2eeType=PersistenceUnit,name=ContentManagementWorkflow
>>> to a gbean matching the pattern [?name=java:/
>>> inpulse_cmws#org.apache.geronimo.naming.ResourceSource]
>>> due to: No matches for referencePatterns: [?name=java:/
>>> inpulse_cmws#org.apache.geronimo.naming.ResourceSource]
>>> at
>>> org.apache.geronimo.deployment.DeploymentContext.getConfigurationData(
>>> DeploymentContext.java:516)
>>> at org.apache.geronimo.deployment.Deployer.install(Deployer.java:319)
>>> at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:256)
>>> at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:133)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke
>>> (NativeMethodAccessorImpl.java:39)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke
>>> (DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke
>>> (ReflectionMethodInvoker.java:34)
>>> at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke
>>> (GBeanOperation.java:124)
>>> at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke
>>> (GBeanInstance.java:867)
>>> at org.apache.geronimo.kernel.basic.BasicKernel.invoke
>>> (BasicKernel.java:239)
>>> at
>>> org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDe
>>> ploy(AbstractDeployCommand.java:116)
>>> at
>>> org.apache.geronimo.deployment.plugin.local.DistributeCommand.run
>>> (DistributeCommand.java:61)
>>> at java.lang.Thread.run(Thread.java:619)
>>>
>>> So is there any document to discuss about how to set it without JNDI?
>>>
>>>
>>> Regards,
>>>
>>> Bill
>>> ----------------------------------------
>>>> From: david_jencks@yahoo.com
>>>> Subject: Re: Persistence unit deploy error in 2.1 but works in 2.02
>>>> Date: Mon, 31 Mar 2008 13:37:58 -0700
>>>> To: user@geronimo.apache.org
>>>>
>>>> It's generally considered more polite to continue the original thread
>>>> you start, answering requests for more information, rather than to
>>>> appear to ignore responses and start new threads on the same topic.
>>>> In this case I realize you may be having problems with your mail
>>>> provider.
>>>> On Mar 31, 2008, at 1:25 PM, luoluo wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I have an application using JPA with hibernate. I changed the
>>>>> persistence
>>>>> provider to hibernate and trying to using db-pools. It works
>>>>> perfectly fine
>>>>> in Geronimo 2.02. But when I tried to deploy it to Geronimo 2.1. It
>>>>> throw
>>>>> out an exception with can not find JNDI entry for the data source
>>>>> when
>>>>> Geronimo try to start the application.
>>>>>
>>>>> in persistence.xml, I use below to refer the data source:
>>>>>
>>>>>
>>>>> org.hibernate.ejb.HibernatePersistence
>>>>>
>>>>> > value="class" />
>>>>>
>>>>> > value="java:/comp/env/jdbc/CmwsDS" />
>>>>> ...
>>>>>
>>>>> The data source is created and defined in web.xml too.
>>>>>
>>>>> I found the different between 2.0.2 and 2.1. In 2.0.2, the entity
>>>>> manager
>>>>> was initialized when first time db-access. At that time, the data
>>>>> source is
>>>>> already be registered in JNDI as /comp/env/jdbc/...DS.
>>>>>
>>>>> In 2.1, Geronimo try to initialize the entity manager when starting
>>>>> the
>>>>> application. The sequence is wrong. It tried to find the data
>>>>> source before
>>>>> the reference in Web.xml been registered. So the JNDI entry not find
>>>>> exception was thrown out.
>>>>>
>>>>> Is that a bug of Geronimo 2.1? Is there any way to work around this
>>>>> issue in
>>>>> 2.1?
>>>>
>>>> I recommend you use the jpa standard way of specifying datasources
>>>> for jpa (using the jta-datasource and non-jta-datasource elements)
>>>> rather than this hibernate specific way using a hibernate specific
>>>> property. Since in geronimo the jpa standard way does not rely on
>>>> jndi, you will not have this problem.
>>>>
>>>> Can you provide a stack trace of the problem you are seeing? That
>>>> would help figure out what is causing the earlier initialization.
>>>>
>>>> thanks
>>>> david jencks
>>>>
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Bill
>>>>>
>>>>> --
>>>>> View this message in context: http://www.nabble.com/Persistence-
>>>>> unit-deploy-error-in-2.1-but-works-in-2.02-
>>>>> tp16396504s134p16396504.html
>>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>>> Nabble.com.
>>>>>
>>>>
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Persistence-unit-deploy-error-in-2.1-but-works-in-2.02-tp16396504s134p16418461.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.