geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LDevil <lde...@poczta.onet.pl>
Subject Problem with persistence.xml (how to use data source?)
Date Sun, 30 Mar 2008 10:32:16 GMT

Hi,

I do not know what should i put in jta-data-source and non-jta-data-source
elements in persistence.xml file.

I have created database pool with name: jdbc/postgresDS
My geronimo-web.xml file contains:
<nam:resource-ref>
  <nam:ref-name>postgres</nam:ref-name>
  <nam:resource-link>jdbc/postgresDS</nam:resource-link>
</nam:resource-ref>
 
My web.xml contains:
<resource-ref>
  <description>PostgreSQL Datasource</description>
  <res-ref-name>postgres</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
  <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

When I put <non-jta-data-source>postgres</non-jta-data-source> in
persistence.xml file, following error appears during deployment:
Unable to resolve reference "NonJtaDataSourceWrapper"
...
due to: No matches for referencePatterns:
[?name=postgres#org.apache.geronimo.naming.ResourceSource]

When I changed value of <non-jta-data-source> to jdbc/postgresDS there were
no erros during deployment, but when I run following code:

EntityManagerFactory emf =
Persistence.createEntityManagerFactory("default");
EntityManager entityManager = emf.createEntityManager();

This error apperars:
  12:24:46,203 ERROR [TestDB]:281 - Servlet.service() for servlet TestDB
threw exception
<openjpa-1.0.1-r420667:592145 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: There was an error
duing JNDI lookup of the name "jdbc/postgresDS".
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:205)
	at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
	at
net.oledzki.novex.sklep2000.receiver.servlets.TestDB.doGet(TestDB.java:94)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
	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(Unknown Source)
Caused by: org.apache.commons.lang.exception.NestableRuntimeException: There
was an error duing JNDI lookup of the name "jdbc/postgresDS".
	at
org.apache.openjpa.lib.conf.Configurations.lookup(Configurations.java:592)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.lookupConnectionFactory(OpenJPAConfigurationImpl.java:966)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getConnectionFactory(OpenJPAConfigurationImpl.java:954)
	at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:801)
	at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:568)
	at
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1221)
	at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:476)
	at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:401)
	at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:102)
	at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:82)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:861)
	at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:852)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:630)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:169)
	... 23 more
Caused by: javax.naming.NotContextException: jdbc/postgresDS
	at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:167)
	at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:603)
	at javax.naming.InitialContext.lookup(Unknown Source)
	at
org.apache.openjpa.lib.conf.Configurations.lookup(Configurations.java:590)
	... 36 more".
...

What should I do to fix this problem?
-- 
Best regards,
Maciej Olędzki 


-- 
View this message in context: http://www.nabble.com/Problem-with-persistence.xml-%28how-to-use-data-source-%29-tp16380414s134p16380414.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message