I completely forgot that you can still install jpa 1.x in karaf 4.
So people just need to install the feature jpa/1.0.4 instead of just jpa and their old code works without changes.

Christian

Am 25.11.2015 um 21:12 schrieb Achim Nierbeck:
As user of Karaf,
I'd expect to run my application as is without further changing if I stick to the features I used before. That's why we now have the 5th person beeing stuck at a point of agony where everything fails. This is just wrong. And merely pointing to some blogs/turorials out-of-karafs scope is not helpful.

I think I already wrote it on one ml or the other, it has to be made sure that users have an easy transition and that stuff they know which had been working is still working. From my point of view the migration to Karaf 4 regarding JPA isn't as straight forward as users (and I) are expecting.
So we need to focus on this and fix it.

Regards, Achim



2015-11-25 20:45 GMT+01:00 Jean-Baptiste Onofré <[email protected] <mailto:[email protected]>>:

    Hi Christian,

    good point for the documentation, I was more thinking about a step
    by step tutorial and a reference to the Aries website.

    Agree to separate in a new code. The point is more for the users
    using Karaf 3 to directly use Karaf 4 without changing their
    application (at least at first step), like we do with the
    shell-compat feature for the shell commands. I agree with you that
    users should update their code at some points.

    Regards
    JB


    On 11/25/2015 08:41 PM, Christian Schneider wrote:

        The documentation at the Aries web site already explains the
        main steps.
        So I think I would not duplicate this in the karaf dev guide.
        Maybe in
        tutorial form but I think the
        reference documentation should be at Aries.

        It should be possible to support the old namespace but I would
        at least
        like  to keep it separate from the new code so we can remove
        it easily
        at a later point.

        Christian

        Am 25.11.2015 um 08:08 schrieb Jean-Baptiste Onofré:

            You were faster than I Christian ;)
            Thanks ;)

            I will improve the dev guide to provide a clear picture to
            the users.

            By the way, don't you think it would be possible to
            support previous
            namespace (jpa/v1.0.0) ? It would be convenient for a
            migration like
            Jason's use case.

            Regards
            JB

            On 11/25/2015 08:05 AM, Christian Schneider wrote:

                The old namespace for jpa is not supported anymore by
                Aries JPA 2.x. Can
                you try with the new namespaces like used in my
                tutorial code? You will need to use annoations then.

                For transactions you can still use the old namespace
                but I would also
                recommend the new one.

                Christian


                On 24.11.2015 17:22, Jason Reilly wrote:

                    <?xml version="1.0" encoding="UTF-8"?>

                    <blueprint
                    xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                    xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0";

                      xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0";
                    default-activation="eager">

                      <bean id="alignmentDAOImpl"
                    class="org.renci.hearsay.dao.jpa.AlignmentDAOImpl">

                        <tx:transaction method="*" value="Required" />

                        <jpa:context property="entityManager"
                    unitname="hearsay" />

                      </bean>

                    ...snip....

                      <service ref="alignmentDAOImpl"
                    interface="org.renci.hearsay.dao.AlignmentDAO" />

                    ...snip....

                      <bean id="hearsayDAOBeanService"
                    class="org.renci.hearsay.dao.HearsayDAOBean">

                        <property name="alignmentDAO"
                    ref="alignmentDAOImpl" />

                    ...snip....

                      </bean>

                      <service ref="hearsayDAOBeanService"
                    interface="org.renci.hearsay.dao.HearsayDAOBeanService"
                    />

                    </blueprint>


                    On 11/24/2015 11:19 AM, Jean-Baptiste Onofré wrote:

                        Can you share the blueprint XML in your
                        hearsay-dao-jpa bundle ?

                        On 11/24/2015 04:57 PM, Jason Reilly wrote:

                            I tried 1.0.0 for those urls & here is the
                            error message:

                            2015-11-24 10:56:12,317 | INFO  |
                            pool-47-thread-1 |
                            BlueprintContainerImpl           | 34 -
                            org.apache.aries.blueprint.core
                            - 1.4.5 | Bundle hearsay-dao-jpa/0.0.46.
                            <http://0.0.46.>SNAPSHOT is waiting for
                            namespace handlers
                            [http://aries.apache.org/xmlns/transactions/v1.0.0,
                            http://aries.apache.org/xmlns/jpa/v1.0.0]


                            On 11/24/2015 10:55 AM, Jason Reilly wrote:

                                I gave that a whirl...here are the
                                details:

                                In my pom.xml which builds my custom
                                Karaf distribution:

                                ...snip..

                                         <bootFeatures>

                                <feature>feature</feature>

                                <feature>shell</feature>

                                <feature>bundle</feature>

                                <feature>config</feature>

                                <feature>diagnostic</feature>

                                <feature>instance</feature>

                                <feature>jaas</feature>

                                <feature>log</feature>

                                <feature>package</feature>

                                <feature>service</feature>

                                <feature>system</feature>

                                <feature>ssh</feature>

                                <feature>management</feature>

                                <feature>deployer</feature>

                                        <feature>obr</feature>

                                <feature>http</feature>

                                        <feature>war</feature>

                                <feature>jetty</feature>

                                        <feature>scr</feature>

                                <feature>jndi</feature>

                                <feature>aries-blueprint</feature>

                                        <feature>cxf</feature>

                                <feature>jdbc</feature>

                                <feature>transaction-api/1.1.0</feature>

                                <feature>openjpa/${openjpa.version}</feature>

                                <feature>spring/${spring.version}_1</feature>

                                
<feature>spring-orm/${spring.version}_1</feature>

                                
<feature>spring-web/${spring.version}_1</feature>

                                <feature>hearsay-commons</feature>

                                        <!--
                                <feature>hearsay-dao</feature> -->

                                          </bootFeatures>

                                ...snip...


                                From the Karaf prompt:

                                karaf@root()> list

                                START LEVEL 100 , List Threshold: 50

ID | State | Lvl | Version | Name

                                
--------------------------------------------------------------------------------------




8 | Active | 80 | 1.5.0 | OPS4J Base - Lang

9 | Active | 80 | 1.5.0 | OPS4J Base - Service
                                Provider Access

10 | Active | 80 | 0.7.0 | OPS4J Pax JDBC Generic
                                Driver Extender

11 | Active | 80 | 0.7.0 | OPS4J Pax JDBC Config

12 | Active | 80 | 1.8.1 | OPS4J Pax Swissbox ::
                                OSGi Core

13 | Active | 80 | 1.8.1 | OPS4J Pax Swissbox ::
                                Extender

14 | Active | 80 | 1.8.1 | OPS4J Pax Swissbox ::
                                Lifecycle

                                 15 | Active |  80 | 1.0.0.201505202023 |
                                org.osgi:org.osgi.service.jdbc

16 | Active | 80 | 2.4.1 | Jackson-annotations

17 | Active | 80 | 2.4.1 | Jackson-core

18 | Active | 80 | 2.4.1 | jackson-databind

19 | Active | 80 | 2.4.1 | Jackson-JAXRS-base

20 | Active | 80 | 2.4.1 | Jackson-JAXRS-JSON

                                 21 | Active |  80 | 2.4.1              |
                                Jackson-module-JAXB-annotations

27 | Active | 80 | 1.1.0.Final | Bean Validation API

49 | Active | 80 | 1.8.3 | Commons BeanUtils

50 | Active | 80 | 1.2 | Commons CLI

52 | Active | 80 | 3.2.1 | Commons Collections

53 | Active | 80 | 4.0.0 | Apache Commons Collections

54 | Active | 80 | 1.4.0 | Commons Compress

55 | Active | 80 | 0.5 | Commons Discovery

56 | Active | 80 | 1.3.1 | Commons Email

57 | Active | 80 | 2.4.0 | Commons IO

59 | Active | 80 | 3.4.0 | Apache Commons Lang

60 | Active | 80 | 3.5.0 | Apache Commons Math

61 | Active | 80 | 3.3.0 | Commons Net

62 | Active | 80 | 1.5.6 | Commons Pool

105 | Active | 80 | 1.1.1 | geronimo-jms_1.1_spec

106 | Active | 80 | 1.1 | Apache Geronimo JSR-317
                                JPA
                                2.0 Spec API

107 | Active | 80 | 1.1.1 | geronimo-jta_1.1_spec

123 | Active | 80 | 4.0.3 | Apache Karaf :: JDBC ::
                                Core

137 | Active | 80 | 2.0.9 | Apache MINA Core

139 | Active | 80 | 2.4.0 | OpenJPA Aggregate Jar

141 | Active | 80 | 1.7.0.6 | Apache ServiceMix ::
                                Bundles
                                :: ant

143 | Active | 80 | 1.7.4.1 | Apache ServiceMix ::
                                Bundles
                                :: aspectj

145 | Active | 80 | 1.4.0.3 | Apache ServiceMix ::
                                Bundles
                                :: commons-dbcp

154 | Active | 80 | 1.14.1.1 | Apache ServiceMix ::
                                Bundles
                                :: serp

162 | Active | 80 | 1.3.2.RELEASE_2 | Apache ServiceMix ::
                                Bundles
                                :: spring-ldap

180 | Active | 80 | 4.3.0 | Apache XBean :: ASM 5
                                shaded
                                (repackaged)

229 | Active | 80 | 9.4.0.build-1205 | PostgreSQL JDBC Driver
                                JDBC41

230 | Active | 80 | 2.2.7.RELEASE | Spring Batch Core

231 | Active | 80 | 2.2.7.RELEASE | Spring Batch
                                Infrastructure

232 | Active | 80 | 1.4.1.RELEASE | Spring Data Commons Core

237 | Active | 80 | 3.2.8.RELEASE | Spring Security LDAP

242 | Active | 80 | 0.0.1 | RENCI :: OSGi :: Bundle ::
                                XZ 1.0



                                At this point, everything looks good.
                                Then I install the
                                hearsay-dao
                                feature & the list command shows the
                                following additional bundles:

                                243 | Active      |  80 |
                                0.0.46.SNAPSHOT   | Hearsay :: DAO :: API

                                244 | GracePeriod |  80 |
                                0.0.46.SNAPSHOT   | Hearsay :: DAO :: JPA

                                245 | Active      |  80 |
                                0.0.46.SNAPSHOT   | Hearsay :: Datasource


                                From the karaf.log file, I see the
                                following:

                                2015-11-24 10:51:15,958 | INFO  |
                                pool-48-thread-1 |
                                BlueprintContainerImpl           | 34 -
                                org.apache.aries.blueprint.core -
                                1.4.5 | Bundle
                                hearsay-dao-jpa/0.0.46.
                                <http://0.0.46.>SNAPSHOT is waiting
                                for namespace handlers
                                
[http://aries.apache.org/xmlns/transactions/v1.1.0,
                                http://aries.apache.org/xmlns/jpa/v1.1.0]


                                Should the Aries transaction/jpa
                                versions be 1.0.0 instead?

                                Thanks,
                                Jason

                                On 11/24/2015 10:22 AM, Jean-Baptiste
                                Onofré wrote:

                                    Basically, you should have
                                    transaction-api 1.1.0 installed (not
                                    1.2.0) and no transaction/1.3.0
                                    feature installed for OpenJPA.

                                    Regards
                                    JB

                                    On 11/24/2015 04:13 PM, Jason
                                    Reilly wrote:

                                        Hi JB,

                                        I was using what I could find
                                        out-of-the-box....which I think is
                                        transaction/1.3.0.
                                        <http://1.3.0.> I didn't know
                                        of a transaction 2.x feature.
                                        What is
                                        the repo for that?

                                        Regards,
                                        Jason

                                        On 11/24/2015 10:05 AM,
                                        Jean-Baptiste Onofré wrote:

                                            Hi Jason,

                                            did you install
                                            transaction 2.x feature ?

                                            Regards
                                            JB

                                            On 11/24/2015 03:41 PM,
                                            Jason Reilly wrote:

                                                Hi all,

                                                I am trying to migrate
                                                an application to
                                                Karaf 4.0.3 & am using
                                                Java8. I
                                                have tried a few
                                                permutations of
                                                persistence providers
                                                (hibernate,
                                                openjpa, &
                                                eclipselink).  I got
                                                Hibernate to work, but ran
                                                into a
                                                number
                                                of problems (like not
                                                having all the
                                                collections in a
                                                @NamedEntityGraph
                                                loaded & this bug:
                                                
https://hibernate.atlassian.net/browse/HHH-9270).
                                                Wanting to continue
                                                with JPA 2.1, I tried
                                                out eclipselink. One
                                                of the
                                                problems I had with
                                                eclipselink was the
                                                following:

                                                2015-11-23
                                                16:28:10,754 | INFO  |
                                                rint Extender: 3 |
BlueprintContainerImpl | 31 -
                                                org.apache.aries.blueprint.core
                                                - 1.4.5 | Bundle
                                                hearsay-dao-jpa/0.0.46. 
<http://0.0.46.>SNAPSHOT
                                                is waiting for
                                                namespace handlers
                                                
[http://aries.apache.org/xmlns/transactions/v2.0.0]


                                                I have transaction &
                                                jpa features
                                                installed, but the
                                                hearsay-dao-jpa
                                                bundle is never
                                                activated when I use a
                                                blueprint xml file to
                                                register
                                                the services.  When I
                                                use the pax-cdi
                                                annotations (as in
                                                Christian's
                                                KarafTutorial
                                                example), the
                                                hearsay-dao-jpa bundle is
                                                activated, but
                                                throws an NPE on
                                                getEntityManager()
                                                despite using the
                                                PersistentContext
                                                annotation.  I think
                                                this might be related
                                                to the Aries JPA
                                                2.2.0
                                                problem mentioned in
                                                another thread
                                                (Problem with JPA 2.2.0 in
                                                Karaf
                                                4.0.2).

                                                When I try
                                                openjpa/2.4.0 & JPA
                                                2.0, the openjpa
                                                bundle is in a
                                                resolved
                                                state.  When I try to
                                                start that bundle the
                                                following is thrown:

                                                ERROR: Bundle
                                                org.apache.aries.jpa.container
                                                [55]
                                                EventDispatcher:
                                                Error
                                                during dispatch.
                                                (java.lang.NoClassDefFoundError:
                                                
javax/transaction/Synchronization)

                                                java.lang.NoClassDefFoundError:
                                                
javax/transaction/Synchronization


                                                However, the packages
                                                are available:

                                                karaf@root()> exports
                                                | grep javax.transaction

                                                javax.transaction.xa
                                                | 0.0.0            |
                                                0   |
                                                org.apache.felix.framework

                                                javax.transaction.xa
                                                | 1.1.0            | 122 |
                                                
org.apache.geronimo.specs.geronimo-jta_1.1_spec

                                                javax.transaction.xa
                                                | 1.2.0            |
                                                256 |
                                                javax.transaction-api

                                                javax.transaction
                                                | 0.0.0            |
                                                0   |
                                                org.apache.felix.framework

                                                javax.transaction
                                                | 1.1.0            | 122 |
                                                
org.apache.geronimo.specs.geronimo-jta_1.1_spec

                                                javax.transaction
                                                | 1.2.0            |
                                                256 |
                                                javax.transaction-api


                                                I also see the
                                                following in the log
                                                after messing with which
                                                transaction-api/persistence-api
                                                features I have installed:

                                                Caused by:
                                                java.lang.NoClassDefFoundError:
                                                
javax/transaction/SystemException

                                                     at
                                                
org.apache.openjpa.persistence.osgi.PersistenceActivator.start(PersistenceActivator.java:61)







                                                Before reverting back
                                                to Karaf 3.0.5...is
                                                there anything else I
                                                can
                                                try?  Suggestions?

                                                Thanks,
                                                Jason















-- Jean-Baptiste Onofré
    [email protected] <mailto:[email protected]>
    http://blog.nanthrax.net
    Talend - http://www.talend.com




--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master


Reply via email to