karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul McCulloch <pkmccull...@gmail.com>
Subject Re: Aries JPA: The persistence unit has incomplete configuration and cannot be created.
Date Fri, 25 May 2018 13:37:19 GMT
That's what I do Alex. I didn't think I needed the non-jta-datasource (&
everything seems to work), but this thread has made me think I should go
back & re-asses that.

I'll also look again at the Transaction Control stuff - it was at 0.0.1
when I last looked, so I was nervous about relying on it. It looks like it
will fix my hack for MSSQL of having to fake an XA datasource (as Aries JPA
transactions don't work with non XA datasources)..

On 25 May 2018 at 14:21, Alex Soto <alex.soto@envieta.com> wrote:

> Hi All,
>
> Thanks for input.  I think I found a sweet spot that seems to work,
> although I wish somebody from AriesJPA can confirm this is a valid approach.
> I removed the Dialect and the other Hibernate specific settings out of my
> persistence.xml, but I have to keep the data source reference to JNDI:
>
> <persistence-unit name="responderPersistenUnit" transaction-type="JTA">
>   <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.
> jndi.service.name=responder)</jta-data-source>
>   </persistence-unit>
>
> The Pax-exam configuration file *org.ops4j.datasource-responder.cfg*
> remains the same:
>
> osgi.jdbc.driver.name = mariadb
> dataSourceName=responder
> url = jdbc:mariadb://localhost:3306/responder?characterEncoding=UTF-8&
> useServerPrepStmts=true
> user=XXX
> password=XXX
> databaseName=responder
> ops4j.preHook=responderDB
>
>
> AriesJPA configuration in my feature provides the dialect and the provider:
>
> <config name="org.apache.aries.jpa.responderPersistenUnit">
>      javax.persistence.provider=org.hibernate.jpa.
> HibernatePersistenceProvider
>      hibernate.dialect=org.hibernate.dialect.MariaDBDialect
>      hibernate.show_sql=false
>      hibernate.format_sql=true
>      hibernate.hbm2ddl.auto=none
>   </config>
>
> When I run, first I can see in the log AriesJPA Container:
>
> 2018-05-25T09:01:22,580 | DEBUG | features-3-thread-1 |
> PersistenceBundleTracker         | 46 - org.apache.aries.jpa.container -
> 2.7.0 | Matching JPA contract for possible persistence
> bundle encryptedquery-responder-data
> 2018-05-25T09:01:22,594 | INFO  | features-3-thread-1 |
> PersistenceBundleTracker         | 46 - org.apache.aries.jpa.container -
> 2.7.0 | Found persistence unit responderPersistenUnit in
> bundle encryptedquery-responder-data with provider null.
> 2018-05-25T09:01:22,596 | INFO  | features-3-thread-1 |
> PersistenceProviderTracker       | 46 - org.apache.aries.jpa.container -
> 2.7.0 | Found provider for responderPersistenUnit org.hibernate.jpa.
> HibernatePersistenceProvider
> 2018-05-25T09:01:22,618 | INFO  | features-3-thread-1 | LogHelper
>                | 134 - org.hibernate.core - 5.2.9.Final | HHH000204:
> Processing PersistenceUnitInfo [
> name: responderPersistenUnit
> ...]
> 2018-05-25T09:01:22,688 | INFO  | features-3-thread-1 | Version
>                | 134 - org.hibernate.core - 5.2.9.Final | HHH000412:
> Hibernate Core {5.2.9.Final}
> 2018-05-25T09:01:22,691 | INFO  | features-3-thread-1 | Environment
>                | 134 - org.hibernate.core - 5.2.9.Final | HHH000206:
> hibernate.properties not found
> 2018-05-25T09:01:22,750 | INFO  | features-3-thread-1 | Version
>                | 133 - org.hibernate.common.hibernate-commons-annotations
> - 5.0.1.Final | HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
> 2018-05-25T09:01:23,330 | WARN  | features-3-thread-1 |
> JdbcEnvironmentInitiator         | 134 - org.hibernate.core - 5.2.9.Final |
> HHH000342: Could not obtain connection to query metadata : Unable to
> determine Dialect to use [name=, majorVersion=0]; user must register
> resolver or explicitly set 'hibernate.dialect'
> 2018-05-25T09:01:23,332 *| DEBUG |* features-3-thread-1 |
> PersistenceProviderTracker       | 46 - org.apache.aries.jpa.container -
> 2.7.0 | *Error while creating the Dummy EntityManagerFactory to allow
> weaving*.
> org.hibernate.service.spi.ServiceException: Unable to create requested
> service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
> at org.hibernate.service.internal.AbstractServiceRegistryImpl.
> createService(AbstractServiceRegistryImpl.java:271) ~[?:?]
> at org.hibernate.service.internal.AbstractServiceRegistryImpl.
> initializeService(AbstractServiceRegistryImpl.java:233) ~[?:?]
> at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(
> AbstractServiceRegistryImpl.java:210) ~[?:?]
> at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.
> configure(JdbcServicesImpl.java:51) ~[?:?]
> at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.
> configureService(StandardServiceRegistryImpl.java:94) ~[?:?]
> at org.hibernate.service.internal.AbstractServiceRegistryImpl.
> initializeService(AbstractServiceRegistryImpl.java:242) ~[?:?]
> at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(
> AbstractServiceRegistryImpl.java:210) ~[?:?]
> at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.
> handleTypes(MetadataBuildingProcess.java:352) ~[?:?]
> at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(
> MetadataBuildingProcess.java:111) ~[?:?]
> at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImp
> l.metadata(EntityManagerFactoryBuilderImpl.java:858) ~[?:?]
> at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(
> EntityManagerFactoryBuilderImpl.java:885) ~[?:?]
> at org.hibernate.osgi.OsgiPersistenceProvider.
> createContainerEntityManagerFactory(OsgiPersistenceProvider.java:96)
> ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.
> createAndCloseDummyEMF(PersistenceProviderTracker.java:105) ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.
> addingService(PersistenceProviderTracker.java:86) ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.
> addingService(PersistenceProviderTracker.java:44) ~[?:?]
> at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
> ~[?:?]
> at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
> ~[?:?]
> at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
> ~[?:?]
> at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
> ~[?:?]
> at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
> ~[?:?]
> at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
> ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.
> trackProvider(PersistenceBundleTracker.java:229) ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.
> findPersistenceUnits(PersistenceBundleTracker.java:213) ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.
> addingBundle(PersistenceBundleTracker.java:98) ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.
> addingBundle(PersistenceBundleTracker.java:44) ~[?:?]
> at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
> ~[?:?]
> at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
> ~[?:?]
> at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
> ~[?:?]
> at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
> ~[?:?]
> at org.osgi.util.tracker.BundleTracker$Tracked.
> bundleChanged(BundleTracker.java:444) ~[?:?]
> at org.apache.felix.framework.EventDispatcher.
> invokeBundleListenerCallback(EventDispatcher.java:915) ~[?:?]
> at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
> ~[?:?]
> at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
> ~[?:?]
> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
> ~[?:?]
> at org.apache.felix.framework.Felix.activateBundle(Felix.java:2231) ~[?:?]
> at org.apache.felix.framework.Felix.startBundle(Felix.java:2146) ~[?:?]
> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) ~[?:?]
> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984) ~[?:?]
> at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.
> startBundle(BundleInstallSupportImpl.java:161) ~[?:?]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> startBundle(FeaturesServiceImpl.java:1116) ~[?:?]
> at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:996)
> ~[?:?]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> doProvision(FeaturesServiceImpl.java:1025) ~[?:?]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$
> doProvisionInThread$13(FeaturesServiceImpl.java:964) ~[?:?]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:?]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:?]
> at java.lang.Thread.run(Thread.java:748) [?:?]
> Caused by: org.hibernate.HibernateException: Access to
> DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
> at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.
> determineDialect(DialectFactoryImpl.java:100) ~[?:?]
> at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.
> buildDialect(DialectFactoryImpl.java:54) ~[?:?]
> at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.
> initiateService(JdbcEnvironmentInitiator.java:137) ~[?:?]
> at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.
> initiateService(JdbcEnvironmentInitiator.java:35) ~[?:?]
> at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.
> initiateService(StandardServiceRegistryImpl.java:88) ~[?:?]
> at org.hibernate.service.internal.AbstractServiceRegistryImpl.
> createService(AbstractServiceRegistryImpl.java:259) ~[?:?]
> ... 46 more
>
>
> Notice the above exception is logged as DEBUG level, so I think it can be
> ignored.  Later I see this error:
>
> 2018-05-25T09:01:23,354 | ERROR | CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.jpa.responderPersistenUnit]) | configadmin
>                     | 8 - org.apache.felix.configadmin - 1.8.16 | [
> org.osgi.service.cm.ManagedService, id=196, bundle=18/mvn:org.enquery.
> encryptedquery/encryptedquery-responder-data/1.0.0-SNAPSHOT]: Unexpected
> problem updating configuration org.apache.aries.jpa.responderPersistenUnit
> java.lang.IllegalArgumentException: *The persistence unit
> responderPersistenUnit has incomplete configuration and cannot be created.*
> The configuration is{hibernate.format_sql=true,
> javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider,
> hibernate.hbm2ddl.auto=none, hibernate.dialect=org.hibernate.dialect.
> MariaDBDialect, org.apache.karaf.features.configKey=org.apache.aries.jpa.
> responderPersistenUnit, felix.fileinstall.filename=file:/Users/asoto/git/
> encryptedquery/responder/itests/target/exam/cdf383ba-
> 08b3-4157-bec3-c131857d7108/etc/org.apache.aries.jpa.responderPersistenUnit.cfg,
> hibernate.show_sql=false, javax.persistence.spi.
> PersistenceUnitTransactionType=JTA, service.pid=org.apache.aries.
> jpa.responderPersistenUnit}
> at org.apache.aries.jpa.container.impl.AriesEntityManagerFactoryBuild
> er.createAndPublishEMF(AriesEntityManagerFactoryBuilder.java:365) ~[?:?]
> at org.apache.aries.jpa.container.impl.AriesEntityManagerFactoryBuild
> er.createEntityManagerFactory(AriesEntityManagerFactoryBuilder.java:183)
> ~[?:?]
> at org.apache.aries.jpa.container.impl.ManagedEMF.updated(ManagedEMF.java:75)
> ~[?:?]
> at org.apache.felix.cm.impl.helper.ManagedServiceTracker.
> updated(ManagedServiceTracker.java:189) ~[8:org.apache.felix.
> configadmin:1.8.16]
> at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(
> ManagedServiceTracker.java:152) [8:org.apache.felix.configadmin:1.8.16]
> at org.apache.felix.cm.impl.helper.ManagedServiceTracker.
> provideConfiguration(ManagedServiceTracker.java:85) [8:org.apache.felix.
> configadmin:1.8.16]
> at org.apache.felix.cm.impl.ConfigurationManager$
> ManagedServiceUpdate.provide(ConfigurationManager.java:
> 1479) [8:org.apache.felix.configadmin:1.8.16]
> at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(
> ConfigurationManager.java:1435) [8:org.apache.felix.configadmin:1.8.16]
> at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
> [8:org.apache.felix.configadmin:1.8.16]
> at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
> [8:org.apache.felix.configadmin:1.8.16]
> at java.lang.Thread.run(Thread.java:748) [?:?]
>
>
> Later I see PAX-JDBC configuring the DataSource:
>
>
> 2018-05-25T09:01:24,065 | INFO  | CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.jpa.responderPersistenUnit]) |
> ServiceTrackerHelper             | 162 - org.ops4j.pax.jdbc.config -
> 1.3.0 | Obtained service dependency: (&(objectClass=org.osgi.service.jdbc.
> DataSourceFactory)(osgi.jdbc.driver.name=mariadb))
> 2018-05-25T09:01:24,065 | INFO  | CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.jpa.responderPersistenUnit]) |
> DataSourceRegistration           | 162 - org.ops4j.pax.jdbc.config -
> 1.3.0 | *Found DataSourceFactory. Creating DataSource responder*
> 2018-05-25T09:01:24,071 | INFO  | CM Configuration Updater (ManagedService
> Update: pid=[org.apache.aries.jpa.responderPersistenUnit]) |
> DataSourceRegistration           | 162 - org.ops4j.pax.jdbc.config -
> 1.3.0 | Executing pre hook for DataSource responder
> 2018-05-25T09:01:29,888 | INFO  | CM Configuration Updater
> (ManagedServiceFactory Update: factoryPid=[org.ops4j.datasource]) |
> DataSourceRegistration           | 162 - org.ops4j.pax.jdbc.config - 1.3.0
> | *Pre hook finished. Publishing DataSource responder*
> 2018-05-25T09:01:29,890 | INFO  | CM Configuration Updater
> (ManagedServiceFactory Update: factoryPid=[org.ops4j.datasource]) |
> DataSourceTracker                | 46 - org.apache.aries.jpa.container -
> 2.7.0 | *Found DataSource for responderPersistenUnit
> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
> <http://osgi.jndi.service.name>=responder)*
> 2018-05-25T09:01:29,890 | DEBUG | CM Configuration Updater
> (ManagedServiceFactory Update: factoryPid=[org.ops4j.datasource]) |
> AriesEntityManagerFactoryBuilder | 46 - org.apache.aries.jpa.container -
> 2.7.0 | No transaction type set in config, restoring the original value JTA
> 2018-05-25T09:01:29,890 | INFO  | CM Configuration Updater
> (ManagedServiceFactory Update: factoryPid=[org.ops4j.datasource]) |
> LogHelper                        | 134 - org.hibernate.core - 5.2.9.Final |
> HHH000204: Processing PersistenceUnitInfo [
> name: responderPersistenUnit
> ...]
> 2018-05-25T09:01:29,984 | INFO  | CM Configuration Updater
> (ManagedServiceFactory Update: factoryPid=[org.ops4j.datasource]) |
> Dialect                          | 134 - org.hibernate.core - 5.2.9.Final |
> HHH000400: *Using dialect: org.hibernate.dialect.MySQL5Dialect*
>
>
> After this, everything works normally. Looks like the errors I see are
> later corrected, so it may be just a timing issue.
>
> Best regards,
> Alex soto
>
>
>
>
> On May 25, 2018, at 8:01 AM, Paul McCulloch <pkmcculloch@gmail.com> wrote:
>
> The dialect can be left out of the pu.xml though. I started down this
> path, but in the end have just relied on hibernate to select the correct
> dialect. I deploy the same bundles on H2, Oracle & MSSQL with this approach.
>
>
> On 25 May 2018 at 12:51, Jean-Baptiste Onofré <jb@nanthrax.net> wrote:
>
>> Hi Paul,
>>
>> yes, I remember this discussion, but AFAIR, it's always overriden by the
>> dialect in the persistence.xml.
>>
>> Regards
>> JB
>>
>> On 25/05/2018 13:00, Paul McCulloch wrote:
>> > Hibernate usually does a reasonable job of auto detecting the dialect,
>> > in my experience. If you need to override this then Aries JPA supports
>> > creating a configuration file /etc/org.apache.aries.jpa.<PU name>.cfg
>> > where you can override hibernate.dialect. Beware if you have a "-" in
>> > the PU name as I think fileinstall we try and create a factory config.
>> >
>> > I can't recall where I got this info from. It might have been
>> > here: http://karaf.922171.n3.nabble.com/Dynamic-parameters-i
>> n-persistence-xml-td4043602.html
>> >
>> > On 25 May 2018 at 06:46, Jean-Baptiste Onofré <jb@nanthrax.net
>> > <mailto:jb@nanthrax.net>> wrote:
>> >
>> >     Hi Alex,
>> >
>> >     the dialect HAS to be in the persistence.xml (it's in the JPA spec).
>> >
>> >     AFAIK, Aries JPA doesn't provide a mechanism to provide the dialect
>> >     externally from the persistence.xml.
>> >
>> >     Even the Aries JPA itests define the dialect there:
>> >
>> >     https://github.com/apache/aries-jpa/blob/master/itests/jpa-
>> container-testbundle/src/main/resources/META-INF/persistence.xml#L40
>> >     <https://github.com/apache/aries-jpa/blob/master/itests/jpa
>> -container-testbundle/src/main/resources/META-INF/persistence.xml#L40>
>> >
>> >     Further more, dialect also depends of the engine you are using
>> >     (hibernate, openjpa, eclipselink).
>> >
>> >     Regards
>> >     JB
>> >
>> >     On 24/05/2018 21:26, Alex Soto wrote:
>> >     > If I change my persistence.xml to this:
>> >     >
>> >     >
>> >     > <persistence-unit name="responderPersistenUnit" transaction-
>> type="JTA">
>> >     > <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jnd
>> i.service.name
>> >     <http://osgi.jndi.service.name>=responder)</jta-data-source>
>> >     > <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jnd
>> i.service.name
>> >     <http://osgi.jndi.service.name>=responder)</jta-data-source>
>> >     >
>> >     > </persistence-unit>
>> >     >
>> >     > And the configuration entries to:
>> >     >
>> >     > <config name="org.apache.aries.jpa.responderPersistenUnit">
>> >     >
>> >     >   javax.persistence.provider=org.hibernate.jpa.HibernatePers
>> istenceProvider
>> >     >     *javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver*
>> >     >     hibernate.dialect=org.hibernate.dialect.MariaDBDialect
>> >     >     hibernate.show_sql=false
>> >     >     hibernate.format_sql=true
>> >     >     hibernate.hbm2ddl.auto=none
>> >     > </config>
>> >     >
>> >     > Then the error Is:
>> >     >
>> >     >
>> >     > java.lang.IllegalArgumentException: Cannot rebind to a different
>> >     > database driver, as per the JPA service specification
>> >     > at
>> >     >
>> >     org.apache.aries.jpa.container.impl.AriesEntityManagerFacto
>> ryBuilder.processProperties(AriesEntityManagerFactoryBuilder.java:225)
>> >     > ~[?:?]
>> >     > at
>> >     >
>> >     org.apache.aries.jpa.container.impl.AriesEntityManagerFacto
>> ryBuilder.createEntityManagerFactory(AriesEntityManagerFactoryBuilder.
>> java:173) ~[?:?]
>> >     > at
>> >     >
>> >     org.apache.aries.jpa.container.impl.ManagedEMF.updated(
>> ManagedEMF.java:75)
>> >     > ~[?:?]
>> >     > at
>> >     >
>> >     org.apache.felix.cm.impl.helper.ManagedServiceTracker.updat
>> ed(ManagedServiceTracker.java:189)
>> >     > ~[8:org.apache.felix.configadmin:1.8.16]
>> >     > at
>> >     >
>> >     org.apache.felix.cm.impl.helper.ManagedServiceTracker.updat
>> eService(ManagedServiceTracker.java:152) [8:org.apache.
>> felix.configadmin:1.8.16]
>> >     > at
>> >     >
>> >     org.apache.felix.cm.impl.helper.ManagedServiceTracker.provi
>> deConfiguration(ManagedServiceTracker.java:85) [8:org.
>> apache.felix.configadmin:1.8.16]
>> >     > at
>> >     >
>> >     org.apache.felix.cm.impl.ConfigurationManager$ManagedServic
>> eUpdate.provide(ConfigurationManager.java:1479) [8:org.
>> apache.felix.configadmin:1.8.16]
>> >     > at
>> >     >
>> >     org.apache.felix.cm.impl.ConfigurationManager$ManagedServic
>> eUpdate.run(ConfigurationManager.java:1435) [8:org.apache.
>> felix.configadmin:1.8.16]
>> >     > at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.
>> java:141)
>> >     > [8:org.apache.felix.configadmin:1.8.16]
>> >     > at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:
>> 109)
>> >     > [8:org.apache.felix.configadmin:1.8.16]
>> >     > at java.lang.Thread.run(Thread.java:748) [?:?]
>> >     >
>> >     >
>> >     > If I remove the
>> >     > line *javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
>> *from the
>> >     > config file above, then I get the previous error about
>> configuration not
>> >     > being completed.  What I am trying to do is to not  hard code
>> >     >  the /hibernate.dialect /inside the bundle, so I can switch to a
>> >     > different database without having to rebuild.
>> >     >
>> >     > Also, my DataSource is already created by PAX JDBC Config and
>> this I
>> >     > don’t want to change, since I am using PreHook facility there to
>> run
>> >     > LiquiBase migrations.
>> >     > Any hints or examples appreciated.
>> >     >
>> >     >
>> >     > Best regards,
>> >     > Alex soto
>> >     >
>> >     >
>> >     >
>> >     >
>> >     >> On May 24, 2018, at 1:41 PM, Alex Soto <alex.soto@envieta.com
>> <mailto:alex.soto@envieta.com>
>> >     >> <mailto:alex.soto@envieta.com <mailto:alex.soto@envieta.com>>>
>> wrote:
>> >     >>
>> >     >> Hello,
>> >     >>
>> >     >> I am using Aries JPA 2.7.0, I am trying provide the JPA
>> persistence
>> >     >> configuration using configuration file.  So my persistence.xml.
>> >     >>
>> >     >>     <persistence version="2.0"
>> >     >>     xmlns="http://java.sun.com/xml/ns/persistence
>> >     <http://java.sun.com/xml/ns/persistence>"
>> >     >>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
>> >     <http://www.w3.org/2001/XMLSchema-instance>"
>> >     >>     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>> >     <http://java.sun.com/xml/ns/persistence>
>> >     >>     http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd
>> >     <http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd>">
>> >     >>
>> >     >>     <persistence-unit name="responderPersistenUnit"
>> >     >>     transaction-type="JTA">
>> >     >>
>> >      <provider>org.hibernate.jpa.HibernatePersistenceProvider</
>> provider>
>> >     >>     </persistence-unit>
>> >     >>     </persistence>
>> >     >>
>> >     >>
>> >     >> I deploy config file as part of my feature:
>> >     >>
>> >     >>     <config name="org.apache.aries.jpa.responderPersistenUnit">
>> >     >>         hibernate.dialect=org.hibernate.dialect.MariaDBDialect
>> >     >>         hibernate.show_sql=false
>> >     >>         hibernate.format_sql=true
>> >     >>         hibernate.hbm2ddl.auto=none
>> >     >>
>> >     >>
>> >        jta-data-source=osgi:service/javax.sql.DataSource/(osgi.
>> jndi.service.name
>> >     <http://osgi.jndi.service.name>=responder)
>> >     >>
>> >     >>
>> >      non-jta-data-source=osgi:service/javax.sql.DataSource/(osg
>> i.jndi.service.name
>> >     <http://osgi.jndi.service.name>=responder)
>> >     >>
>> >     >>     </config>
>> >     >>
>> >     >> When I run, the following exception is thrown:
>> >     >>
>> >     >>
>> >     >>     java.lang.IllegalArgumentException: The persistence unit
>> >     >>     responderPersistenUnit has incomplete configuration and
>> cannot be
>> >     >>     created. The configuration
>> >     >>
>> >      is{non-jta-data-source=osgi:service/javax.sql.DataSource/(
>> osgi.jndi.service.name
>> >     <http://osgi.jndi.service.name>=responder),
>> >     >>     hibernate.format_sql=true, hibernate.hbm2ddl.auto=none,
>> >     >>     hibernate.dialect=org.hibernate.dialect.MariaDBDialect,
>> >     >>
>> >      jta-data-source=osgi:service/javax.sql.DataSource/(
>> osgi.jndi.service.name
>> >     <http://osgi.jndi.service.name>=responder), felix.filein
>> stall.filename=file:/Users/asoto/git/encryptedquery/
>> responder/dist/target/encryptedquery-responder-dist-
>> 1.0.0-SNAPSHOT/etc/org.apache.aries.jpa.responderPersistenUnit.cfg,
>> >     >>
>> >      hibernate.show_sql=false, javax.persistence.spi.Persistenc
>> eUnitTransactionType=JTA, service.pid=org.apache.aries.
>> jpa.responderPersistenUnit}
>> >     >>
>> >      at org.apache.aries.jpa.container.impl.AriesEntityManagerF
>> actoryBuilder.createAndPublishEMF(AriesEntityManagerFactoryBuilder.java:
>> 365)
>> >     >>     ~[?:?]
>> >     >>
>> >      at org.apache.aries.jpa.container.impl.AriesEntityManagerF
>> actoryBuilder.createEntityManagerFactory(Ari
>> esEntityManagerFactoryBuilder.java:183)
>> >     >>     ~[?:?]
>> >     >>     at
>> >     >>
>> >      org.apache.aries.jpa.container.impl.ManagedEMF.updated(
>> ManagedEMF.java:75)
>> >     >>     ~[?:?]
>> >     >>     at
>> >     >>
>> >      org.apache.felix.cm.impl.helper.ManagedServiceTracker.upda
>> ted(ManagedServiceTracker.java:189)
>> >     >>     ~[8:org.apache.felix.configadmin:1.8.16]
>> >     >>     at
>> >     >>
>> >      org.apache.felix.cm.impl.helper.ManagedServiceTracker.upda
>> teService(ManagedServiceTracker.java:152) [8:org.apache.
>> felix.configadmin:1.8.16]
>> >     >>
>> >      at org.apache.felix.cm.impl.helper.ManagedServiceTracker.p
>> rovideConfiguration(ManagedServiceTracker.java:85) [8:org.
>> apache.felix.configadmin:1.8.16]
>> >     >>
>> >      at org.apache.felix.cm.impl.ConfigurationManager$ManagedSe
>> rviceUpdate.provide(ConfigurationManager.java:1479) [8:org.
>> apache.felix.configadmin:1.8.16]
>> >     >>
>> >      at org.apache.felix.cm.impl.ConfigurationManager$ManagedSe
>> rviceUpdate.run(ConfigurationManager.java:1435) [8:org.
>> apache.felix.configadmin:1.8.16]
>> >     >>     at
>> >     >>
>> >      org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.
>> java:141) [8:org.apache.felix.configadmin:1.8.16]
>> >     >>     at
>> >     >>
>> >      org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.jav
>> a:109) [8:org.apache.felix.configadmin:1.8.16]
>> >     >>     at java.lang.Thread.run(Thread.java:748) [?:?]
>> >     >>
>> >     >>
>> >     >>
>> >     >> So Aries JPA is finding the configuration properties I am
>> providing,
>> >     >> but still missing something.  What else is needed as
>> configuration
>> >     >> properties? Why is it not complete the persistent unit?
>> >     >>
>> >     >>
>> >     >> Best regards,
>> >     >> Alex soto
>> >     >>
>> >     >>
>> >     >>
>> >     >>
>> >     >
>> >
>> >     --
>> >     --
>> >     Jean-Baptiste Onofré
>> >     jbonofre@apache.org <mailto:jbonofre@apache.org>
>> >     http://blog.nanthrax.net
>> >     Talend - http://www.talend.com
>> >
>> >
>>
>> --
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>
>
>

Mime
View raw message