aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luca Burgazzoli (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARIES-1023) Construct a persistence unit with parameters
Date Thu, 07 Mar 2013 11:24:15 GMT

    [ https://issues.apache.org/jira/browse/ARIES-1023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13595792#comment-13595792
] 

Luca Burgazzoli commented on ARIES-1023:
----------------------------------------

Here you have:


<blueprint default-activation="eager"
           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"
           xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">

    <!-- ******************************************************************* -->
    <!-- ApplicationManaged                                                  -->
    <!-- ******************************************************************* -->

    <bean id="app_managed_data_service"
          class="lb.examples.karaf.jpa.openjpa.data.ApplicationManagedDataService">
        <jpa:unit unitname="OPENJPA_PU_NON_JTA" property="entityManagerFactory"/>
    </bean>

    <service ref="app_managed_data_service"
             interface="lb.examples.karaf.jpa.openjpa.data.IDataService">
        <service-properties>
            <entry key  ="osgi.jndi.service.name"
                   value="eclipselink/app_managed_data_service"/>
        </service-properties>
    </service>

    <!-- ******************************************************************* -->
    <!-- ContainerManaged                                                    -->
    <!-- ******************************************************************* -->

    <bean id="con_managed_data_service"
          class="lb.examples.karaf.jpa.openjpa.data.ContainerManagedDataService">
        <jpa:context unitname="OPENJPA_PU_JTA" property="entityManager">
            <map>
                <property name="openjpa.Log" value="DefaultLevel=TRACE"/>
            </map>
        </jpa:context>
        <tx:transaction method="*" value="Required"/>
    </bean>

    <service ref="con_managed_data_service"
             interface="lb.examples.karaf.jpa.openjpa.data.IDataService">
        <service-properties>
            <entry key  ="osgi.jndi.service.name"
                   value="eclipselink/con_managed_data_service"/>
        </service-properties>
    </service>

    <!-- ******************************************************************* -->
    <!-- COMMANDS                                                            -->
    <!-- ******************************************************************* -->

    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
        <command name="item/openjpa-am-add">
            <action class="lb.examples.karaf.jpa.openjpa.cmd.AMItemAddCommand">
                <property name="dataService" ref="app_managed_data_service"/>
            </action>
        </command>
        <command name="item/openjpa-am-list">
            <action class="lb.examples.karaf.jpa.openjpa.cmd.AMItemListCommand">
                <property name="dataService" ref="app_managed_data_service"/>
            </action>
        </command>
        <command name="item/openjpa-cm-add">
            <action class="lb.examples.karaf.jpa.openjpa.cmd.CMItemAddCommand">
                <property name="dataService" ref="con_managed_data_service"/>
            </action>
        </command>
        <command name="item/openjpa-cm-list">
            <action class="lb.examples.karaf.jpa.openjpa.cmd.CMItemListCommand">
                <property name="dataService" ref="con_managed_data_service"/>
            </action>
        </command>
    </command-bundle>

</blueprint>

                
> Construct a persistence unit with parameters
> --------------------------------------------
>
>                 Key: ARIES-1023
>                 URL: https://issues.apache.org/jira/browse/ARIES-1023
>             Project: Aries
>          Issue Type: Bug
>          Components: JPA
>            Reporter: Luca Burgazzoli
>
> According to http://aries.apache.org/modules/jpaproject.html it should be possible to
construct a persistence unit with properties supplied in the OSGi blueprint.xml instead of
hard-coding them in the persistence.xml but it does not seem to work:
> The bean definition:
> <bean id="con_managed_data_service"
>        class="lb.examples.karaf.jpa.openjpa.data.ContainerManagedDataService">
>     <jpa:context unitname="OPENJPA_PU_JTA" property="entityManager">
>         <map>
>             <property name="openjpa.Log" value="DefaultLevel=TRACE"/>
>         </map>
>     </jpa:context>
>     <tx:transaction method="*" value="Required"/>
> </bean>
> And the error:
> 2013-03-07 08:30:57,884 | ERROR | BlueprintContainerImpl           | blueprint.container.BlueprintContainerImpl
| org.apache.aries.blueprint.core | Unable to start blueprint container for bundle jpa-openjpa
> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to validate
xml
>         at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:288)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:304)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:252)[7:org.apache.aries.blueprint.core:1.0.1]
>         at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.0.1]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_17]
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_17]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_17]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_17]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_17]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_17]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_17]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_17]
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was
found starting with element 'map'. One of '{"http://aries.apache.org/xmlns/jpa/v1.1.0":map}'
is expected.
>         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:453)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3232)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1791)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:277)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:244)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:190)[:1.7.0_17]
>         at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:109)[:1.7.0_17]
>         at javax.xml.validation.Validator.validate(Unknown Source)[:2.1.0]
>         at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:285)[7:org.apache.aries.blueprint.core:1.0.1]
>         ... 11 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message