OK - thanks Christian. Will try the annotations. /Bengt
2016-07-06 10:18 GMT+02:00 Christian Schneider <ch...@die-schneider.net>: > 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>" > xmlns:xsi="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>" > xmlns:tx="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>">* > > * <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>" > xmlns:xsi="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>" > xmlns:tx="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>"> <!-- 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 > >