Hello there,

I am trying to migrate a JPA app into Equinox Servlet bridge run-time env
in Tomcat 6. The PU was constructed this way,

<persistence>
  <persistence-unit name="blogExample" transaction-type="JTA">


<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <jta-data-source>osgi:service/jdbc/blogdb</jta-data-source>
    <non-jta-data-source>osgi:service/jdbc/blogdbnojta</non-jta-data-source>
...
  </persistence-unit>
</persistence>

I can see the DataSources are registered,


​
However, when trying to build EM, it throws this,

==========
[Blueprint Extender: 2] ERROR org.apache.aries.jpa.container - The
DataSource osgi:service/jdbc/blogdb required by bundl
e org.apache.aries.samples.blog.persistence.jpa/1.0.0 could not be found.
javax.naming.NoInitialContextException: Unable to find the
InitialContextFactory org.apache.naming.java.javaURLContextFa
ctory.
        at
org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:148)
        at
org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.jav
a:49)
        at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:695)
        at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:318)
        at javax.naming.InitialContext.init(InitialContext.java:253)
        at javax.naming.InitialContext.<init>(InitialContext.java:227)
        at
org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:63)
        at
org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:3
6)
        at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:137)
        at
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:112)
        at
org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:239)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:725)
...
==========

I think it is because the in Tomcat, it probably uses own jndi provider.

Is there a way to create the EMF without depending on "ogsi:serives"
namespace? What are my options? (I think I can use RESOURCE_LOCAL type as
well).

Many thanks!
David

Reply via email to