• 1 reply
  • Latest Post - ‏2013-10-28T13:45:52Z by C7YC_David_Westerman
12 Posts

Pinned topic Can't Find DataSource from OSGi App

‏2013-10-25T22:32:18Z | datasource jndi osgi

I'm writing an OSGi App, and I'm having trouble with it, because it can't find the DataSource that I have defined on my server.

When I try to access the JPA entity, I get the following error:
[ERROR   ] The DataSource jdbc/DvdListDataSource required by bundle DvdList.JPA/ could not be found.
Intermediate context does not exist: jdbc/DvdListDataSource

I have a separate JPA OSGi bundle, with the following in the persistence.xml:
    <persistence-unit name="DvdList.JPA" transaction-type="JTA">

And here is the server.xml for my Liberty Profile 8.5.5 server:
<server description="DlwAppServer">
    <jdbcDriver id="DerbyJdbcDriver" libraryRef="derbyLibrary">
        <library description="Derby Classes" id="derbyLibrary" name="derbyLibrary">
            <fileset dir="resources/derby"/>
    <dataSource id="DvdListDataSource" jdbcDriverRef="DerbyJdbcDriver" jndiName="jdbc/DvdListDataSource" type="javax.sql.XADataSource">
        <properties.derby.embedded createDatabase="create" databaseName="${server.config.dir}/derbyDatabases/DVDLIST"/>
    <osgiApplication id="DvdList.App" location="DvdList.App.eba" name="DvdList.App"/>

I have also tried every value for the 'type' attribute in the 'dataSource' element, including not specifying it at all, but nothing works.

Any ideas? I think I must be missing a "wiring" or "binding" setting somewhere.

  • C7YC_David_Westerman
    12 Posts

    Re: Can't Find DataSource from OSGi App


    I am seeing the following in the messages.log file:


    Caused by: <openjpa-2.2.2-SNAPSHOT-r422266:1462076 fatal user error> org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "WsJpaJDBCConfigurationImpl@c76c7698: PDQ disabled: AccessIntent Task=disable".