OK - thanks Christian. Do you have any idea why the EntityManagerFactory service does not seem to be published. The logging implies that the persistence unit is found and added. What could be missing?
/Bengt 2016-07-06 19:36 GMT+02:00 Christian Schneider <[email protected]>: > You can ignore these messages. they come from Aries spi-fly and simply say > that spi-fly looked into your bundle and decided that it does not need to > do anything. I have committed a change to spi-fly recently to log these > messages only on level debug as they confuse a lot of people. > > Christian > > 2016-07-06 13:37 GMT+02:00 Bengt Rodehav <[email protected]>: > >> Actually a more complete log says: >> >> 2016-07-06 13:35:13,732 | INFO | nsole user karaf | >> PersistenceBundleTracker | er.impl.PersistenceBundleTracker 102 | >> Found persistence unit filetransferhistoryPU in bundle >> se.digia.connect.services.filetransfer.history-domain with provider >> org.apache.openjpa.persistence.PersistenceProviderImpl. >> 2016-07-06 13:35:13,733 | INFO | nsole user karaf | >> PersistenceBundleTracker | er.impl.PersistenceBundleTracker 93 | >> Persistence units added for bundle >> se.digia.connect.services.filetransfer.history-domain event 128 >> 2016-07-06 13:35:13,733 | INFO | nsole user karaf | bundle >> | ? ? | Bundle Considered for >> SPI providers: se.digia.connect.services.filetransfer.history-domain >> 2016-07-06 13:35:13,734 | INFO | nsole user karaf | bundle >> | ? ? | No 'SPI-Provider' >> Manifest header. Skipping bundle: >> se.digia.connect.services.filetransfer.history-domain >> >> This sounds like the persistence units have been added but there is >> something wrong with the "SPI-provider". >> >> /Bengt >> >> >> 2016-07-06 13:36 GMT+02:00 Bengt Rodehav <[email protected]>: >> >>> I do have the correct information in the manifest: >>> >>> Meta-Persistence: META-INF/persistence.xml >>> >>> But I think this indicates that something is wrong: >>> >>> 2016-07-06 13:35:13,733 | INFO | nsole user karaf | bundle >>> | ? ? | Bundle Considered >>> for SPI providers: se.digia.connect.services.filetransfer.history-domain >>> 2016-07-06 13:35:13,734 | INFO | nsole user karaf | bundle >>> | ? ? | No 'SPI-Provider' >>> Manifest header. Skipping bundle: >>> se.digia.connect.services.filetransfer.history-domain >>> >>> >>> What is the SPI-provider? >>> >>> /Bengt >>> >>> 2016-07-06 11:04 GMT+02:00 Christian Schneider <[email protected]> >>> : >>> >>>> If no EntityManagerFactory service is created then this is not a >>>> problem with the blueprint. >>>> Do you have the Meta-Persistence manifest entry? >>>> See >>>> >>>> https://github.com/cschneider/Karaf-Tutorial/blob/master/tasklist-ds/model/bnd.bnd >>>> >>>> As soon as you have the entry you should see in the log that Aries JPA >>>> parses the persistence xml and tries to create the EMF. It should report in >>>> the log if something is missing. >>>> >>>> For the blueprint you have to add the enable Elements for jpa and tx as >>>> they create the interceptors. >>>> >>>> Christian >>>> >>>> >>>> On 06.07.2016 10:51, Bengt Rodehav wrote: >>>> >>>> Having problems getting this to work. I get the following in the log >>>> file: >>>> >>>> 2016-07-06 10:46:54,710 | INFO | nsole user karaf | bundle >>>> | ? ? | Bundle Considered >>>> for SPI providers: se.digia.connect.services.filetransfer.history-db >>>> 2016-07-06 10:46:54,710 | INFO | nsole user karaf | bundle >>>> | ? ? | No 'SPI-Provider' >>>> Manifest header. Skipping bundle: >>>> se.digia.connect.services.filetransfer.history-db >>>> >>>> No EntityManagerFactory service is being created. >>>> >>>> Looks like I've missed something. The only changes I've made is the >>>> blueprint xml and the injection of the EntityManager using the annotation. >>>> Do I need to change anything else, like the persistence.xml? >>>> >>>> /Bengt >>>> >>>> 2016-07-06 10:24 GMT+02:00 Bengt Rodehav <[email protected]>: >>>> >>>>> OK - thanks Christian. Will try the annotations. >>>>> >>>>> /Bengt >>>>> >>>>> 2016-07-06 10:18 GMT+02:00 Christian Schneider < >>>>> <[email protected]>[email protected]>: >>>>> >>>>>> Hi Bengt, >>>>>> >>>>>> Aries JPA 2 only supports the annotations. You can install Aries JPA >>>>>> 1.x into karaf 4.0.5 if you want the old xml style. >>>>>> >>>>>> Christian >>>>>> >>>>>> >>>>>> On 06.07.2016 09:58, Bengt Rodehav wrote: >>>>>> >>>>>> I'm migrating from Karaf 2.4.1 to 4.0.5. I also go from JPA 1.0 to >>>>>> 2.0. >>>>>> >>>>>> Previously my Blueprint XML looked like this: >>>>>> >>>>>> >>>>>> *<?xml version="1.0" encoding="UTF-8"?>* >>>>>> *<blueprint xmlns=" >>>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>http://www.osgi.org/xmlns/blueprint/v1.0.0 >>>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>" xmlns:xsi=" >>>>>> <http://www.w3.org/2001/XMLSchema-instance>http://www.w3.org/2001/XMLSchema-instance >>>>>> <http://www.w3.org/2001/XMLSchema-instance>"* >>>>>> * xsi:schemaLocation=" >>>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>http://www.osgi.org/xmlns/blueprint/v1.0.0 >>>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>" xmlns:tx=" >>>>>> <http://aries.apache.org/xmlns/transactions/v1.0.0>http://aries.apache.org/xmlns/transactions/v1.0.0 >>>>>> <http://aries.apache.org/xmlns/transactions/v1.0.0>"* >>>>>> * xmlns:jpa=" >>>>>> <http://aries.apache.org/xmlns/jpa/v1.0.0>http://aries.apache.org/xmlns/jpa/v1.0.0 >>>>>> <http://aries.apache.org/xmlns/jpa/v1.0.0>">* >>>>>> >>>>>> * <bean id="messageService" >>>>>> class="se.digia.connect.iso20022.history.impl.MessageHistoryService">* >>>>>> * <tx:transaction method="*" value="RequiresNew" />* >>>>>> * <jpa:context property="entityManager" unitname="iso20022PU" />* >>>>>> * </bean>* >>>>>> >>>>>> * <service ref="messageService" >>>>>> interface="se.digia.connect.iso20022.history.api.IMessageHistoryService" >>>>>> /> >>>>>> * >>>>>> >>>>>> *</blueprint>* >>>>>> >>>>>> >>>>>> I have now changed to: >>>>>> >>>>>> *<?xml version="1.0" encoding="UTF-8"?>* >>>>>> *<blueprint xmlns=" >>>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>http://www.osgi.org/xmlns/blueprint/v1.0.0 >>>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>" xmlns:xsi=" >>>>>> <http://www.w3.org/2001/XMLSchema-instance>http://www.w3.org/2001/XMLSchema-instance >>>>>> <http://www.w3.org/2001/XMLSchema-instance>"* >>>>>> * xsi:schemaLocation=" >>>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>http://www.osgi.org/xmlns/blueprint/v1.0.0 >>>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0>" xmlns:tx=" >>>>>> <http://aries.apache.org/xmlns/transactions/v1.2.0>http://aries.apache.org/xmlns/transactions/v1.2.0 >>>>>> <http://aries.apache.org/xmlns/transactions/v1.2.0>"* >>>>>> * xmlns:jpa=" >>>>>> <http://aries.apache.org/xmlns/jpa/v2.0.0>http://aries.apache.org/xmlns/jpa/v2.0.0 >>>>>> <http://aries.apache.org/xmlns/jpa/v2.0.0>"> <!-- tjoho -->* >>>>>> >>>>>> * <bean id="messageService" >>>>>> class="se.digia.connect.iso20022.history.impl.MessageHistoryService">* >>>>>> * <tx:transaction method="*" value="RequiresNew" />* >>>>>> * <jpa:context property="entityManager" unitname="iso20022PU" />* >>>>>> * </bean>* >>>>>> >>>>>> * <service ref="messageService" >>>>>> interface="se.digia.connect.iso20022.history.api.IMessageHistoryService" >>>>>> />* >>>>>> >>>>>> *</blueprint>* >>>>>> >>>>>> On Karaf startup I get the following error: >>>>>> >>>>>> *2016-07-06 09:46:42,154 | ERROR | rint Extender: 2 | >>>>>> BlueprintContainerImpl | container.BlueprintContainerImpl 437 >>>>>> | >>>>>> Unable to start blueprint container for bundle >>>>>> se.digia.connect.services.filetransfer.history-db/2.8.0.SNAPSHOT* >>>>>> *org.osgi.service.blueprint.container.ComponentDefinitionException: >>>>>> Unable to validate xml* >>>>>> * at >>>>>> org.apache.aries.blueprint.parser.Parser.validate(Parser.java:349)[25:org.apache.aries.blueprint.core:1.6.1]* >>>>>> * at >>>>>> org.apache.aries.blueprint.parser.Parser.validate(Parser.java:336)[25:org.apache.aries.blueprint.core:1.6.1]* >>>>>> * at >>>>>> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:343)[25:org.apache.aries.blueprint.core:1.6.1]* >>>>>> * at >>>>>> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)[25:org.apache.aries.blueprint.core:1.6.1]* >>>>>> * at >>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_74]* >>>>>> * at >>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_74]* >>>>>> * at >>>>>> org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[25:org.apache.aries.blueprint.core:1.6.1]* >>>>>> * at >>>>>> org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[25:org.apache.aries.blueprint.core:1.6.1]* >>>>>> * at >>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_74]* >>>>>> * at >>>>>> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_74]* >>>>>> * at >>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_74]* >>>>>> * at >>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_74]* >>>>>> * at >>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_74]* >>>>>> * at >>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_74]* >>>>>> * at java.lang.Thread.run(Thread.java:745)[:1.8.0_74]* >>>>>> *Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: >>>>>> The matching wildcard is strict, but no declaration can be found for >>>>>> element 'jpa:context'.* >>>>>> * at >>>>>> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown >>>>>> Source)[:]* >>>>>> * at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown >>>>>> Source)[:]* >>>>>> * at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown >>>>>> Source)[:]* >>>>>> * at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown >>>>>> Source)[:]* >>>>>> * at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown >>>>>> Source)[:]* >>>>>> * at >>>>>> org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown >>>>>> Source)[:]* >>>>>> * at >>>>>> org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown >>>>>> Source)[:]* >>>>>> * at >>>>>> org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown >>>>>> Source)[:]* >>>>>> * at >>>>>> org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown >>>>>> Source)[:]* >>>>>> * at >>>>>> org.apache.xerces.jaxp.validation.DOMValidatorHelper.beginNode(Unknown >>>>>> Source)[:]* >>>>>> * at >>>>>> org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown >>>>>> Source)[:]* >>>>>> * at >>>>>> org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown >>>>>> Source)[:]* >>>>>> * at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown >>>>>> Source)[:]* >>>>>> * at javax.xml.validation.Validator.validate(Unknown Source)[:2.7.0]* >>>>>> * at >>>>>> org.apache.aries.blueprint.parser.Parser.validate(Parser.java:346)[25:org.apache.aries.blueprint.core:1.6.1]* >>>>>> * ... 14 more* >>>>>> >>>>>> I read at http://aries.apache.org/modules/jpaproject.html that >>>>>> annotations can now be used for the injection of the perstence unit >>>>>> context. But, is it the only way to do it? Is there no way to do it using >>>>>> the jpa:context element anymore? >>>>>> >>>>>> /Bengt >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Christian Schneiderhttp://www.liquid-reality.de >>>>>> >>>>>> Open Source Architecthttp://www.talend.com >>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> Christian Schneiderhttp://www.liquid-reality.de >>>> >>>> Open Source Architecthttp://www.talend.com >>>> >>>> >>> >> > > > -- > -- > Christian Schneider > http://www.liquid-reality.de > <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de> > > Open Source Architect > http://www.talend.com > <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com> >
