You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by simon <si...@outlook.com> on 2016/01/24 20:11:17 UTC

How to solve bundle state GracePeriod

Hello, I am trying to use Karaf with OpenJPA and Derby (Embedded). However my
module state is always "GracePeriod". The sample I am trying to deploy is
available here:

https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter7/chapter7-recipe4

I build the example with maven. I then open Karaf (please note I tried these
steps with both apache-karaf-3.0.5 and apache-karaf-4.0.4). I then install
the following features as explained in the book "Apache Karaf Cookbook":

feature:install jpa
feature:install openjpa/2.2.2
feature:install transaction
install -s mvn:org.apache.derby/derbyclient/10.8.1.2
feature:install jndi

(Note: for Karaf 4.0.4 I removed versions so latest is installed but when I
try an install transaction I got java.lang.ClassNotFoundException:
javax.transaction.SystemException not found by org.apache.openjpa so
reverted to use 3.0.5!)

Here I check and everything is nice and state is "Active". I then follow the
last step, to deploy the compiled code:

install -s mvn:com.packt/jpa-only/1.0.0-SNAPSHOT

I check the state and "jpa-only" bundle is in state "GracePeriod"

When I look in the logs I see the following error:

[error]
JPA-Only Demo Bundle starting...
2016-01-24 19:30:03,662 | INFO  | l for user karaf | BlueprintContainerImpl          
| 15 - org.apache.aries.blueprint.core - 1.4.4 | Bundle
jpa-only/1.0.0.SNAPSHOT is waiting for dependencies
[(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=recipe))(objectClass=javax.persistence.EntityManagerFactory))]
2016-01-24 19:30:03,678 | WARN  | l for user karaf | container                       
| 70 - org.apache.aries.jpa.container - 1.0.2 | There are no providers
available.
Bundle ID: 95
[/error]

I have searched all over the Internet to find a solution but nothing seems
to work. I found the following which suggest that the is related to Aries
JPA update.
https://issues.apache.org/jira/browse/KARAF-3244

However if I try "feature:install jpa/1.0.1" as suggested I get "Can't
install feature jpa/1.0.1". 

I found this:
http://www.liquid-reality.de/display/liquid/2012/01/13/Apache+Karaf+Tutorial+Part+6+-+Database+Access

This does not really suite me because it makes use of Hibernate not OpenJPA.
However I tried it all the same. 

On a clean install of 3.0.5 I run the following:

feature:install jdbc
feature:repo-add mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.5.0/xml/features
feature:install transaction jndi pax-jdbc-h2 pax-jdbc-config
pax-jdbc-pool-dbcp2 jpa/2.1.0 hibernate/4.3.6.Final
install -s mvn:net.lr.tutorial.karaf.db/db-examplejpa/1.0-SNAPSHOT

This works. However on 4.0.4 I get the "GracePeriod" message as well. 

I wonder if anyone has a working Karaf + OpenJPA + Derby (Embedded) example?
That would really help me out.

I would like to use latest version of all but I read that Blueprint XML is
no longer supported. 



--
View this message in context: http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: How to solve bundle state GracePeriod

Posted by simon <si...@outlook.com>.
When I check the installed bundles I can see the following:

67 | Active      |  30 | 1.0.0.Final          | hibernate-jpa-2.1-api
68 | Active      |  30 | 1.0.2                | Aries JPA Container API
69 | Active      |  30 | 1.0.4                | Aries JPA Container
blueprint integration for Aries blueprint
70 | Active      |  30 | 1.0.2                | Aries JPA Container
71 | Active      |  30 | 1.0.4                | Aries JPA Container Managed
Contexts
72 | Active      |  30 | 1.1                  | Apache Geronimo JSR-317 JPA
2.0 Spec API

My understanding is that the JPA bundles deployed are for JPA 2.0

I have updated the persistence.xml of the example to as int he provided
link. I have changed the blueprint header as follows:
http://aries.apache.org/xmlns/jpa/v2.0.0

Now when I deploy the example bundle I get the following error: "Bundle
jpa-only/1.0.0.SNAPSHOT is waiting for namespace handlers
[http://aries.apache.org/xmlns/jpa/v2.0.0"

If I want to go with JPA 2.0 what should be the header in the blueprint xml?









--
View this message in context: http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982p4044987.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: How to solve bundle state GracePeriod

Posted by Tom Barber <to...@meteorite.bi>.
i say blueprint, I also mean the persistence.xml depending on how you're
bootstrapping it, for 2.x I had to switch to this:
https://github.com/OSBI/meteorite-core/blob/master/model/src/main/resources/META-INF/persistence.xml#L3

On Sun, Jan 24, 2016 at 7:53 PM, simon <si...@outlook.com> wrote:

> Hi Tom, thanks for your reply. Ok, downloaded sample aries libraries and
> moved the jpa libraries and transaction to deploy (instead of using
> feature:install) and it marks as "Active".
>
> So am I understanding this right; the problem is the headers in blueprint
> are JPA1 but the bundles installed are JPA2? or I am not on the right road?
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982p4044985.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: How to solve bundle state GracePeriod

Posted by simon <si...@outlook.com>.
Hi Tom, thanks for your reply. Ok, downloaded sample aries libraries and
moved the jpa libraries and transaction to deploy (instead of using
feature:install) and it marks as "Active". 

So am I understanding this right; the problem is the headers in blueprint
are JPA1 but the bundles installed are JPA2? or I am not on the right road?



--
View this message in context: http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982p4044985.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: How to solve bundle state GracePeriod

Posted by Tom Barber <to...@meteorite.bi>.
I had similar although I don't see your logs so I can't say if its 100% the
same, but mixing jpa 1.x headers in blueprint with jpa 2.x as the installed
feature will cause you that problem.

Tom

On Sun, Jan 24, 2016 at 7:11 PM, simon <si...@outlook.com> wrote:

> Hello, I am trying to use Karaf with OpenJPA and Derby (Embedded). However
> my
> module state is always "GracePeriod". The sample I am trying to deploy is
> available here:
>
>
> https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter7/chapter7-recipe4
>
> I build the example with maven. I then open Karaf (please note I tried
> these
> steps with both apache-karaf-3.0.5 and apache-karaf-4.0.4). I then install
> the following features as explained in the book "Apache Karaf Cookbook":
>
> feature:install jpa
> feature:install openjpa/2.2.2
> feature:install transaction
> install -s mvn:org.apache.derby/derbyclient/10.8.1.2
> feature:install jndi
>
> (Note: for Karaf 4.0.4 I removed versions so latest is installed but when I
> try an install transaction I got java.lang.ClassNotFoundException:
> javax.transaction.SystemException not found by org.apache.openjpa so
> reverted to use 3.0.5!)
>
> Here I check and everything is nice and state is "Active". I then follow
> the
> last step, to deploy the compiled code:
>
> install -s mvn:com.packt/jpa-only/1.0.0-SNAPSHOT
>
> I check the state and "jpa-only" bundle is in state "GracePeriod"
>
> When I look in the logs I see the following error:
>
> [error]
> JPA-Only Demo Bundle starting...
> 2016-01-24 19:30:03,662 | INFO  | l for user karaf | BlueprintContainerImpl
> | 15 - org.apache.aries.blueprint.core - 1.4.4 | Bundle
> jpa-only/1.0.0.SNAPSHOT is waiting for dependencies
> [(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name
> =recipe))(objectClass=javax.persistence.EntityManagerFactory))]
> 2016-01-24 19:30:03,678 | WARN  | l for user karaf | container
> | 70 - org.apache.aries.jpa.container - 1.0.2 | There are no providers
> available.
> Bundle ID: 95
> [/error]
>
> I have searched all over the Internet to find a solution but nothing seems
> to work. I found the following which suggest that the is related to Aries
> JPA update.
> https://issues.apache.org/jira/browse/KARAF-3244
>
> However if I try "feature:install jpa/1.0.1" as suggested I get "Can't
> install feature jpa/1.0.1".
>
> I found this:
>
> http://www.liquid-reality.de/display/liquid/2012/01/13/Apache+Karaf+Tutorial+Part+6+-+Database+Access
>
> This does not really suite me because it makes use of Hibernate not
> OpenJPA.
> However I tried it all the same.
>
> On a clean install of 3.0.5 I run the following:
>
> feature:install jdbc
> feature:repo-add
> mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.5.0/xml/features
> feature:install transaction jndi pax-jdbc-h2 pax-jdbc-config
> pax-jdbc-pool-dbcp2 jpa/2.1.0 hibernate/4.3.6.Final
> install -s mvn:net.lr.tutorial.karaf.db/db-examplejpa/1.0-SNAPSHOT
>
> This works. However on 4.0.4 I get the "GracePeriod" message as well.
>
> I wonder if anyone has a working Karaf + OpenJPA + Derby (Embedded)
> example?
> That would really help me out.
>
> I would like to use latest version of all but I read that Blueprint XML is
> no longer supported.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: How to solve bundle state GracePeriod

Posted by simon <si...@outlook.com>.
Thanks for the command. That is most helpful.

So on Karaf 4.0.4 if I install jpa, transaction and openjp I get status
"GracePeriod" on transaction bundles and errors on restart
(java.lang.NoClassDefFoundError: javax/transaction/SystemException) from
openjpa bundle. I guess this is what you meant by the current version of
openjpa not working with jta.

On Karaf 3.0.5 I am now using the correct namespace and the error is as it
was in the original post.

[error]
2016-01-27 16:14:26,064 | INFO  | FelixStartLevel  | BlueprintContainerImpl          
| 15 - org.apache.aries.blueprint.core - 1.4.4 | Bundle
jpa-only/1.0.0.SNAPSHOT is waiting for dependencies
[(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=recipe))(objectClass=javax.persistence.EntityManagerFactory))]
[/error]

I have looked on the Internet and found one of your posts ( here
<https://github.com/cschneider/Karaf-Tutorial/issues/8>  ) were you say that
aries jpa tends to swallow the real error. 

It seems it is useless to continue trying until latest version of OpenJPA
comes out. I have found another post here asking about  OpenJPA 2.4.1
<http://karaf.922171.n3.nabble.com/openjpa-2-4-1-td4045020.html>   so I will
keep an eye on that.




--
View this message in context: http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982p4045041.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: How to solve bundle state GracePeriod

Posted by Christian Schneider <ch...@die-schneider.net>.
You can use the command "service:list NamespaceHandler". It will list all
namespace handlers in the attributes you can see the namespace they
support.

Does openjpa 2.2.2 work well with Aries JPA 2.x for you? The problem is
that openjpa is not jta 1.2 compatible. So it can not be used with the new
Aries transaction 2.0.0. As the old Aries transaction 1.3.0 is also
installed this might work but I never tested this combination.

I hope openjpa 2.4.1 will be out soon which works well with the newest
version of Aries JPA and Aries transaction as it supports jta 1.2.

Christian

2016-01-27 11:02 GMT+01:00 simon <si...@outlook.com>:

> Yes, I am mostly following the given example. As explained I did manage to
> make it work. However I am now trying to make it work with the default
> features that get installed for jpa and transaction.
>
> I have changed the blueprint headers as explained here:
> http://aries.apache.org/modules/jpaproject.html
>
> [code]
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>   xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0"
>   xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0">
> ...
> [/code]
> (i.e. - from xmlns:jpa version changed v1.1.0 to v2.0.0)
>
> I then installed the features using the following command
>
> > feature:install openjpa/2.2.2 jpa transaction
> > install -s mvn:org.apache.derby/derbyclient/10.8.1.2
>
> When I install the modified example I get the following in the logs:
> "Bundle jpa-only/1.0.0.SNAPSHOT is waiting for namespace handlers
> [http://aries.apache.org/xmlns/jpa/v2.0.0]"
>
> Rather than ask what the header must be I am MOSTLY interested to know how
> I
> can discover this myself through the installed bundles? Where do I have to
> look in the installed bundles to find what namespace handler to use?
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982p4045026.html
> Sent from the Karaf - User mailing list archive at Nabble.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>

Re: How to solve bundle state GracePeriod

Posted by simon <si...@outlook.com>.
Yes, I am mostly following the given example. As explained I did manage to
make it work. However I am now trying to make it work with the default
features that get installed for jpa and transaction.

I have changed the blueprint headers as explained here:
http://aries.apache.org/modules/jpaproject.html

[code]
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
  xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0"
  xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0">
...
[/code]
(i.e. - from xmlns:jpa version changed v1.1.0 to v2.0.0)

I then installed the features using the following command

> feature:install openjpa/2.2.2 jpa transaction
> install -s mvn:org.apache.derby/derbyclient/10.8.1.2

When I install the modified example I get the following in the logs:
"Bundle jpa-only/1.0.0.SNAPSHOT is waiting for namespace handlers
[http://aries.apache.org/xmlns/jpa/v2.0.0]"

Rather than ask what the header must be I am MOSTLY interested to know how I
can discover this myself through the installed bundles? Where do I have to
look in the installed bundles to find what namespace handler to use?




--
View this message in context: http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982p4045026.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: How to solve bundle state GracePeriod

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Simon,

I guess you use blueprint namespace (tx:* & jpa:*) right ?

Regards
JB

On 01/26/2016 03:59 PM, simon wrote:
> In case anyone wants to run the examples...
>
> Using the features I did not manage. I looked for the bundled the JPA and
> Transaction features use (feature:info) and then installed an older version
> of each one. The following should work.
>
> [/code]
> feature:install jndi
> install mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.0
> install mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint.aries/1.0.0
> install mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.0
> install
> mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.0
> feature:install openjpa/2.2.2
> install mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
> install
> mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/1.0.0
> install
> mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.0
> install -s mvn:org.apache.derby/derbyclient/10.8.1.2
> [/code]
>
> Note: I tried this on apache-karaf-3.0.5
>
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982p4044999.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: How to solve bundle state GracePeriod

Posted by simon <si...@outlook.com>.
In case anyone wants to run the examples...

Using the features I did not manage. I looked for the bundled the JPA and
Transaction features use (feature:info) and then installed an older version
of each one. The following should work.

[/code]
feature:install jndi
install mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/1.0.0
install mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint.aries/1.0.0
install mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/1.0.0
install
mvn:org.apache.aries.jpa/org.apache.aries.jpa.container.context/1.0.0
feature:install openjpa/2.2.2
install mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
install
mvn:org.apache.aries.transaction/org.apache.aries.transaction.blueprint/1.0.0
install
mvn:org.apache.aries.transaction/org.apache.aries.transaction.manager/1.0.0
install -s mvn:org.apache.derby/derbyclient/10.8.1.2
[/code]

Note: I tried this on apache-karaf-3.0.5






--
View this message in context: http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982p4044999.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: How to solve bundle state GracePeriod

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Simon,

bundle:diag should help you there.

Check if you don't have both jpa 1.x and jpa 2.x provider/API.

Regards
JB

On 01/24/2016 08:11 PM, simon wrote:
> Hello, I am trying to use Karaf with OpenJPA and Derby (Embedded). However my
> module state is always "GracePeriod". The sample I am trying to deploy is
> available here:
>
> https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter7/chapter7-recipe4
>
> I build the example with maven. I then open Karaf (please note I tried these
> steps with both apache-karaf-3.0.5 and apache-karaf-4.0.4). I then install
> the following features as explained in the book "Apache Karaf Cookbook":
>
> feature:install jpa
> feature:install openjpa/2.2.2
> feature:install transaction
> install -s mvn:org.apache.derby/derbyclient/10.8.1.2
> feature:install jndi
>
> (Note: for Karaf 4.0.4 I removed versions so latest is installed but when I
> try an install transaction I got java.lang.ClassNotFoundException:
> javax.transaction.SystemException not found by org.apache.openjpa so
> reverted to use 3.0.5!)
>
> Here I check and everything is nice and state is "Active". I then follow the
> last step, to deploy the compiled code:
>
> install -s mvn:com.packt/jpa-only/1.0.0-SNAPSHOT
>
> I check the state and "jpa-only" bundle is in state "GracePeriod"
>
> When I look in the logs I see the following error:
>
> [error]
> JPA-Only Demo Bundle starting...
> 2016-01-24 19:30:03,662 | INFO  | l for user karaf | BlueprintContainerImpl
> | 15 - org.apache.aries.blueprint.core - 1.4.4 | Bundle
> jpa-only/1.0.0.SNAPSHOT is waiting for dependencies
> [(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=recipe))(objectClass=javax.persistence.EntityManagerFactory))]
> 2016-01-24 19:30:03,678 | WARN  | l for user karaf | container
> | 70 - org.apache.aries.jpa.container - 1.0.2 | There are no providers
> available.
> Bundle ID: 95
> [/error]
>
> I have searched all over the Internet to find a solution but nothing seems
> to work. I found the following which suggest that the is related to Aries
> JPA update.
> https://issues.apache.org/jira/browse/KARAF-3244
>
> However if I try "feature:install jpa/1.0.1" as suggested I get "Can't
> install feature jpa/1.0.1".
>
> I found this:
> http://www.liquid-reality.de/display/liquid/2012/01/13/Apache+Karaf+Tutorial+Part+6+-+Database+Access
>
> This does not really suite me because it makes use of Hibernate not OpenJPA.
> However I tried it all the same.
>
> On a clean install of 3.0.5 I run the following:
>
> feature:install jdbc
> feature:repo-add mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.5.0/xml/features
> feature:install transaction jndi pax-jdbc-h2 pax-jdbc-config
> pax-jdbc-pool-dbcp2 jpa/2.1.0 hibernate/4.3.6.Final
> install -s mvn:net.lr.tutorial.karaf.db/db-examplejpa/1.0-SNAPSHOT
>
> This works. However on 4.0.4 I get the "GracePeriod" message as well.
>
> I wonder if anyone has a working Karaf + OpenJPA + Derby (Embedded) example?
> That would really help me out.
>
> I would like to use latest version of all but I read that Blueprint XML is
> no longer supported.
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/How-to-solve-bundle-state-GracePeriod-tp4044982.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com