Re: Apache Karaf 4.x JPA - Working example

2018-07-24 Thread Miroslav Beranič
Hi François,

thank you for in-depth explanation.

By Blueprint XML I mean:

datasource.xml:

http://www.osgi.org/xmlns/blueprint/v1.0.0;
   xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0;
   xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
https://osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>
















I see, I was looking at different feature name, I was referring to this
feature ( that defines datasource ):



osgi.jdbc.driver.class=org.h2.Driver
databaseName=booking;create=true
dataSourceName=booking


osgi.service;objectClass=javax.sql.DataSource;effective:=active;
osgi.jndi.service.name=booking



You've updated:

> Hi Miroslav,
>
> The changes are :
>
> - use the H2 drivers with class declaration
> - add jndi feature
> - add capabilities for Hibernate Persistence Provider
>
> The provider module emmebed the persistence.xml with the Persistence
> provider declaration inside so it require the Persistence provider.
>
> We have :
> - common feature : provide Hibernate Persistence capabilities
> - provider feature : require Hibernate Persistence capabilities
>
> About feature xml and blueprint DSL, this not the same. The feature XML is
> used to packaging bundles and bundles/feature  dependencies, the blueprint
> xml is used to manage your services instances and their services usage.
>
> Regards
>
> François
> Le 25 juil. 2018 00:14, Miroslav Beranič  a
> écrit :
>
> Hi,
>
> @Jean-Baptiste Onofré, François: I can confirm, issues is fixed now. I can
> get JPA example working. I see output in Karaf Shell.
>
> but :)
>
>
> What was the fix ( so I can understand what was wrong, for any future
> case, other projects ):
>
> I see examples/karaf-jpa-example/karaf-jpa-example-
> features/src/main/feature/feature.xml ( I guess this is most of the fix )
>
>   version="${project.version}">
>  transaction  transaction feature>
> +jndi
>  pax-jdbc-config
>  pax-jdbc-config
>  pax-jdbc-h2  pax-jdbc-h2 feature>
>  pax-jdbc-pool-dbcp2
>  pax-jdbc-pool-dbcp2
>  jdbc  jdbc
>  jpa   version="[2,3)">jpa
> -hibernate
> +hibernate
> +
> +osgi.service;objectClass=javax.persistence.spi.
> PersistenceProvider;effective:=active;javax.persistence.
> provider=org.hibernate.jpa.HibernatePersistenceProvider
> +
>
>
> So this three lines:
> +
> +osgi.service;objectClass=javax.persistence.spi.
> PersistenceProvider;effective:=active;javax.persistence.
> provider=org.hibernate.jpa.HibernatePersistenceProvider
> +
>
> I have similar Bundle structure, but I have dedicated Bundle for
> DataSource setup/configuration. How do I translate this "Feature DSL" to
> "Blueprint DSL" ==> How would this translate into Blueprint XML?
>
> So changes look they make sense but, this is first time I see this to be
> defined so explicit. This was my original complaint, as it always looked
> like this piece of code was missing ( also in other available online
> examples ).
>
> I also guess "effective:=active;" is important ( as I read the "I've
> explained it already three times" forum post ) ( FW:
> http://karaf.922171.n3.nabble.com/What-does-effective-active-mean-
> td4047770.html )
>
> Well, thank you both very much. Saved me tons of headache.
>
> Kind Regards,
> Miroslav
>
>
> 2018-07-24 20:51 GMT+02:00 Jean-Baptiste Onofré :
>
> Hi,
>
> François just fixed the JPA example of the DEV_GUIDE branch.
>
> I will add the corresponding examples itests tomorrow.
>
> Regards
> JB
>
> On 20/07/2018 16:17, Miroslav Beranič wrote:
> > Hi,
> >
> > I've upgraded my environment from ServiceMix 7.1.0-SNAPSHOT ( running
> > Karaf 4.0.9 ) to Karaf 4.1.x ( GitHub ) branch and later on I've
> > experimented with version 4.2.x.
> > I was using linked linkes from Karaf home page (
> > https://karaf.apache.org/documentation.html ) to GitHub Examples - for
> JPA.
> >
> > My main task is to get JPA 2 up and running, but I fail to do so.
> >
> > So on provided examples Github repository:
> > https://github.com/jbonofre/karaf/tree/DEV_GUIDE/examples/ka
> raf-jpa-example
> >
> > I've tested with Karaf 4.1.x and 4.2.x and in both version, Examples for
> > JPA do now work - for me.
> >
> > For Karaf 4.2.x I've created PasteBin outputs ( please see ):
> > 1.) https://pastebin.com/eJybVNhn
> > 2.) https://pastebin.com/W2UhihdR
> >
> > In examples, I've noted that there is a reference to Hibernate
> > 6.0.10.Final - this version is not released yet ( hibernate.org
> >  ), so I guess this is a wrong version, or ? as I
> > see Karaf has build-in support 

Re: Creating an JDBC

2018-07-24 Thread Jean-Baptiste Onofré
Hi Christian,

I thought we provide a GenericDataSourceFactory taking just a driver (as
we did with the generic datasource when we used blueprint).

I will check and add this if required: it should be easier for our end
users as they should be able to create a generic datasource without code.

Regards
JB

On 25/07/2018 07:11, Christian Schneider wrote:
> You need a DataSourceFactory for this to work. As ingres probably does
> not offer this you can create your own bundle with a class that
> implements DataSourceFactory and returns a DataSource. This class then
> must be published as a service with the above property.
> 
> Christian
> 
> Am Di., 24. Juli 2018 um 18:02 Uhr schrieb Paul Spencer
> mailto:pau...@apache.org>>:
> 
> Karaf 4.2
> 
> I am trying to create a JDBC datasource for a DBMS not natively
> supported by
> PAX-JDBC, specifically Ingres.   Below are the commands I am using to
> install the Ingres JDBC driver and create the datasource.  Based on
> the log
> files, the creation process is waiting on a service dependency.
> 
> karaf@root()> bundle:install wrap:mvn:com.ingres.jdbc/iijdbc/9.2-3.4.10
> karaf@root()> jdbc:ds-create -url jdbc:ingres://localhost/dbname -u
> user -p
> password -dc com.ingres.jdbc.IngresDataSource myDS
> karaf@root()> log:display
> 11:47:35.465 INFO [CM Configuration Updater (Update:
> pid=org.ops4j.datasource.b91f90b0-b399-49ab-9f55-9ab522d24833)]
> Waiting for
> service dependency:
> 
> (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.ingres.jdbc.IngresDataSource))
> 
> How to I create a JDBC datasource using
> com.ingres.jdbc.IngresDataSource?
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 
> 
> 
> -- 
> -- 
> Christian Schneider
> http://www.liquid-reality.de
> 
> Computer Scientist
> http://www.adobe.com
> 


Re: Creating an JDBC

2018-07-24 Thread Christian Schneider
You need a DataSourceFactory for this to work. As ingres probably does not
offer this you can create your own bundle with a class that implements
DataSourceFactory and returns a DataSource. This class then must be
published as a service with the above property.

Christian

Am Di., 24. Juli 2018 um 18:02 Uhr schrieb Paul Spencer :

> Karaf 4.2
>
> I am trying to create a JDBC datasource for a DBMS not natively supported
> by
> PAX-JDBC, specifically Ingres.   Below are the commands I am using to
> install the Ingres JDBC driver and create the datasource.  Based on the log
> files, the creation process is waiting on a service dependency.
>
> karaf@root()> bundle:install wrap:mvn:com.ingres.jdbc/iijdbc/9.2-3.4.10
> karaf@root()> jdbc:ds-create -url jdbc:ingres://localhost/dbname -u user
> -p
> password -dc com.ingres.jdbc.IngresDataSource myDS
> karaf@root()> log:display
> 11:47:35.465 INFO [CM Configuration Updater (Update:
> pid=org.ops4j.datasource.b91f90b0-b399-49ab-9f55-9ab522d24833)] Waiting for
> service dependency:
>
> (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.ingres.jdbc.IngresDataSource))
>
> How to I create a JDBC datasource using com.ingres.jdbc.IngresDataSource?
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com


Re: Apache Karaf 4.x JPA - Working example

2018-07-24 Thread Jean-Baptiste Onofré
Hi Miroslav,

we defined the JPA Engine (provider) as a capability in the feature. It
gives the indication about the engine we want to use.

However, this is a workaround as this capability should be provided
directly by the hibernate feature, not the end user feature.

I created KARAF-5850 for the tracking and I will fix that for Karaf 4.2.1.

As said, today, I will create the itests for the examples that will
allow us to test the examples and Karaf as part of our build (and Jenkins).

Regards
JB

On 24/07/2018 22:14, Miroslav Beranič wrote:
> Hi,
> 
> @Jean-Baptiste Onofré, François: I can confirm, issues is fixed now. I
> can get JPA example working. I see output in Karaf Shell.
> 
> but :)
> 
> 
> What was the fix ( so I can understand what was wrong, for any future
> case, other projects ):
> 
> I
> see 
> examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml
> ( I guess this is most of the fix )
> 
>      
>          transaction       
>  transaction
> +        jndi
>          pax-jdbc-config       
>  pax-jdbc-config
>          pax-jdbc-h2       
>  pax-jdbc-h2
>          pax-jdbc-pool-dbcp2       
>  pax-jdbc-pool-dbcp2
>          jdbc         jdbc
>          jpa          version="[2,3)">jpa
> -        hibernate
> +        hibernate
> +        
> +           
> osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
> +        
>           
> 
> So this three lines:
> +        
> +           
> osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
> +        
> 
> I have similar Bundle structure, but I have dedicated Bundle for
> DataSource setup/configuration. How do I translate this "Feature DSL" to
> "Blueprint DSL" ==> How would this translate into Blueprint XML?
> 
> So changes look they make sense but, this is first time I see this to be
> defined so explicit. This was my original complaint, as it always looked
> like this piece of code was missing ( also in other available online
> examples ).
> 
> I also guess "effective:=active;" is important ( as I read the "I've
> explained it already three times" forum post ) (
> FW: 
> http://karaf.922171.n3.nabble.com/What-does-effective-active-mean-td4047770.html
> )
> 
> Well, thank you both very much. Saved me tons of headache.
> 
> Kind Regards,
> Miroslav
> 
> 
> 2018-07-24 20:51 GMT+02:00 Jean-Baptiste Onofré  >:
> 
> Hi,
> 
> François just fixed the JPA example of the DEV_GUIDE branch.
> 
> I will add the corresponding examples itests tomorrow.
> 
> Regards
> JB
> 
> On 20/07/2018 16:17, Miroslav Beranič wrote:
> > Hi,
> > 
> > I've upgraded my environment from ServiceMix 7.1.0-SNAPSHOT ( running
> > Karaf 4.0.9 ) to Karaf 4.1.x ( GitHub ) branch and later on I've
> > experimented with version 4.2.x.
> > I was using linked linkes from Karaf home page (
> > https://karaf.apache.org/documentation.html
>  ) to GitHub Examples -
> for JPA.
> > 
> > My main task is to get JPA 2 up and running, but I fail to do so.
> > 
> > So on provided examples Github repository:
> > 
> https://github.com/jbonofre/karaf/tree/DEV_GUIDE/examples/karaf-jpa-example
> 
> 
> > 
> > I've tested with Karaf 4.1.x and 4.2.x and in both version, Examples for
> > JPA do now work - for me.
> > 
> > For Karaf 4.2.x I've created PasteBin outputs ( please see ):
> > 1.) https://pastebin.com/eJybVNhn
> > 2.) https://pastebin.com/W2UhihdR
> > 
> > In examples, I've noted that there is a reference to Hibernate
> > 6.0.10.Final - this version is not released yet ( hibernate.org 
> 
> >  ), so I guess this is a wrong version, or ?
> as I
> > see Karaf has build-in support for Hibernate 5.2.9.Final.
> >
> >
> 
> https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml
> 
> 
> >
> > For Hibernate version I am looking at:
> > https://github.com/apache/karaf/blob/master/pom.xml
> 
> > 5.2.9.Final
> >
> > So what I did was:
> >
> > 1.) checked out Karaf 4.1.x from Github
> > 2.) checked out Karaf Examples ( DEV_GUIDE branch from Github )
> >
> > 3.) Build Karaf with Maven: mvn -Pfastinstall and started Karaf with
> > ./bin/karaf debug
> > 4.) Build Karaf Examples ( changed version of Hibernate from
> > 

Re: Creating an JDBC

2018-07-24 Thread Jean-Baptiste Onofré
Hi,

As a workaround, you can try to use the bundle:dynamic-import command on
Pax JDBC bundles.

I will check later today if it makes sense to enable by default for
generic driver support.

Regards
JB

On 25/07/2018 04:43, Paul Spencer wrote:
> JB,
> I am not sure how to "enable dynamic import for Pax JDBC".  
> 
> Paul Spencer
> 
>> On Jul 24, 2018, at 1:03 PM, Jean-Baptiste Onofré  wrote:
>>
>> Hi Paul,
>>
>> can you try to enable dynamic import for Pax JDBC ?
>>
>> I will add this natively.
>>
>> Regards
>> JB
>>
>> On 24/07/2018 18:02, Paul Spencer wrote:
>>> Karaf 4.2
>>>
>>> I am trying to create a JDBC datasource for a DBMS not natively supported by
>>> PAX-JDBC, specifically Ingres.   Below are the commands I am using to
>>> install the Ingres JDBC driver and create the datasource.  Based on the log
>>> files, the creation process is waiting on a service dependency.
>>>
>>> karaf@root()> bundle:install wrap:mvn:com.ingres.jdbc/iijdbc/9.2-3.4.10
>>> karaf@root()> jdbc:ds-create -url jdbc:ingres://localhost/dbname -u user -p
>>> password -dc com.ingres.jdbc.IngresDataSource myDS
>>> karaf@root()> log:display
>>> 11:47:35.465 INFO [CM Configuration Updater (Update:
>>> pid=org.ops4j.datasource.b91f90b0-b399-49ab-9f55-9ab522d24833)] Waiting for
>>> service dependency:
>>> (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.ingres.jdbc.IngresDataSource))
>>>
>>> How to I create a JDBC datasource using com.ingres.jdbc.IngresDataSource?
>>>
>>>
>>>
>>> --
>>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>>>
> 


Re: Apache Karaf 4.x JPA - Working example

2018-07-24 Thread François Papon
Hi Miroslav,

The changes are :

- use the H2 drivers with class declaration
- add jndi feature
- add capabilities for Hibernate Persistence Provider

The provider module emmebed the persistence.xml with the Persistence provider 
declaration inside so it require the Persistence provider.

We have :
- common feature : provide Hibernate Persistence capabilities
- provider feature : require Hibernate Persistence capabilities

About feature xml and blueprint DSL, this not the same. The feature XML is used 
to packaging bundles and bundles/feature  dependencies, the blueprint xml is 
used to manage your services instances and their services usage.

Regards

François

Le 25 juil. 2018 00:14, Miroslav Beranič  a écrit :
>
> Hi,
>
> @Jean-Baptiste Onofré, François: I can confirm, issues is fixed now. I can 
> get JPA example working. I see output in Karaf Shell.
>
> but :)
>
>
> What was the fix ( so I can understand what was wrong, for any future case, 
> other projects ):
>
> I see 
> examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml
>  ( I guess this is most of the fix )
>
>      
>          transaction          
> transaction
> +        jndi
>          pax-jdbc-config          
> pax-jdbc-config
>          pax-jdbc-h2          
> pax-jdbc-h2
>          pax-jdbc-pool-dbcp2          
> pax-jdbc-pool-dbcp2
>          jdbc          jdbc
>          jpa           version="[2,3)">jpa
> -        hibernate
> +        hibernate
> +        
> +            
> osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
> +        
>            
>
> So this three lines:
> +        
> +            
> osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
> +        
>
> I have similar Bundle structure, but I have dedicated Bundle for DataSource 
> setup/configuration. How do I translate this "Feature DSL" to "Blueprint DSL" 
> ==> How would this translate into Blueprint XML?
>
> So changes look they make sense but, this is first time I see this to be 
> defined so explicit. This was my original complaint, as it always looked like 
> this piece of code was missing ( also in other available online examples ).
>
> I also guess "effective:=active;" is important ( as I read the "I've 
> explained it already three times" forum post ) ( FW: 
> http://karaf.922171.n3.nabble.com/What-does-effective-active-mean-td4047770.html
>  )
>
> Well, thank you both very much. Saved me tons of headache.
>
> Kind Regards,
> Miroslav
>
>
> 2018-07-24 20:51 GMT+02:00 Jean-Baptiste Onofré :
>>
>> Hi,
>>
>> François just fixed the JPA example of the DEV_GUIDE branch.
>>
>> I will add the corresponding examples itests tomorrow.
>>
>> Regards
>> JB
>>
>> On 20/07/2018 16:17, Miroslav Beranič wrote:
>> > Hi,
>> > 
>> > I've upgraded my environment from ServiceMix 7.1.0-SNAPSHOT ( running
>> > Karaf 4.0.9 ) to Karaf 4.1.x ( GitHub ) branch and later on I've
>> > experimented with version 4.2.x.
>> > I was using linked linkes from Karaf home page (
>> > https://karaf.apache.org/documentation.html ) to GitHub Examples - for JPA.
>> > 
>> > My main task is to get JPA 2 up and running, but I fail to do so.
>> > 
>> > So on provided examples Github repository:
>> > https://github.com/jbonofre/karaf/tree/DEV_GUIDE/examples/karaf-jpa-example
>> > 
>> > I've tested with Karaf 4.1.x and 4.2.x and in both version, Examples for
>> > JPA do now work - for me.
>> > 
>> > For Karaf 4.2.x I've created PasteBin outputs ( please see ):
>> > 1.) https://pastebin.com/eJybVNhn
>> > 2.) https://pastebin.com/W2UhihdR
>> > 
>> > In examples, I've noted that there is a reference to Hibernate
>> > 6.0.10.Final - this version is not released yet ( hibernate.org
>> >  ), so I guess this is a wrong version, or ? as I
>> > see Karaf has build-in support for Hibernate 5.2.9.Final.
>> > 
>> > https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml
>> > 
>> > For Hibernate version I am looking at:
>> > https://github.com/apache/karaf/blob/master/pom.xml
>> > 5.2.9.Final
>> > 
>> > So what I did was:
>> > 
>> > 1.) checked out Karaf 4.1.x from Github
>> > 2.) checked out Karaf Examples ( DEV_GUIDE branch from Github )
>> > 
>> > 3.) Build Karaf with Maven: mvn -Pfastinstall and started Karaf with
>> > ./bin/karaf debug
>> > 4.) Build Karaf Examples ( changed version of Hibernate from
>> > 6.0.10.Final to 5.2.9.Final )
>> > 
>> > Read instruction from:
>> > https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/karaf-jpa-example/README.md
>> > 
>> > 5.) feature:repo-add
>> > mvn:org.apache.karaf.examples/karaf-jpa-example-features/4.2.1-SNAPSHOT/xml
>> > 6.) feature:install karaf-jpa-example-datasource
>> > 7.) feature:install karaf-jpa-example-provider
>> 

Re: Creating an JDBC

2018-07-24 Thread Paul Spencer
JB,
I am not sure how to "enable dynamic import for Pax JDBC".  

Paul Spencer

> On Jul 24, 2018, at 1:03 PM, Jean-Baptiste Onofré  wrote:
> 
> Hi Paul,
> 
> can you try to enable dynamic import for Pax JDBC ?
> 
> I will add this natively.
> 
> Regards
> JB
> 
> On 24/07/2018 18:02, Paul Spencer wrote:
>> Karaf 4.2
>> 
>> I am trying to create a JDBC datasource for a DBMS not natively supported by
>> PAX-JDBC, specifically Ingres.   Below are the commands I am using to
>> install the Ingres JDBC driver and create the datasource.  Based on the log
>> files, the creation process is waiting on a service dependency.
>> 
>> karaf@root()> bundle:install wrap:mvn:com.ingres.jdbc/iijdbc/9.2-3.4.10
>> karaf@root()> jdbc:ds-create -url jdbc:ingres://localhost/dbname -u user -p
>> password -dc com.ingres.jdbc.IngresDataSource myDS
>> karaf@root()> log:display
>> 11:47:35.465 INFO [CM Configuration Updater (Update:
>> pid=org.ops4j.datasource.b91f90b0-b399-49ab-9f55-9ab522d24833)] Waiting for
>> service dependency:
>> (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.ingres.jdbc.IngresDataSource))
>> 
>> How to I create a JDBC datasource using com.ingres.jdbc.IngresDataSource?
>> 
>> 
>> 
>> --
>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>> 



Re: Apache Karaf 4.x JPA - Working example

2018-07-24 Thread Miroslav Beranič
Hi,

@Jean-Baptiste Onofré, François: I can confirm, issues is fixed now. I can
get JPA example working. I see output in Karaf Shell.

but :)


What was the fix ( so I can understand what was wrong, for any future case,
other projects ):

I
see 
examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml
( I guess this is most of the fix )

 
 transaction
 transaction
+jndi
 pax-jdbc-config
 pax-jdbc-config
 pax-jdbc-h2
 pax-jdbc-h2
 pax-jdbc-pool-dbcp2
 pax-jdbc-pool-dbcp2
 jdbc  jdbc
 jpa  jpa
-hibernate
+hibernate
+
+
osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
+
   

So this three lines:
+
+
osgi.service;objectClass=javax.persistence.spi.PersistenceProvider;effective:=active;javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider
+

I have similar Bundle structure, but I have dedicated Bundle for DataSource
setup/configuration. How do I translate this "Feature DSL" to "Blueprint
DSL" ==> How would this translate into Blueprint XML?

So changes look they make sense but, this is first time I see this to be
defined so explicit. This was my original complaint, as it always looked
like this piece of code was missing ( also in other available online
examples ).

I also guess "effective:=active;" is important ( as I read the "I've
explained it already three times" forum post ) ( FW:
http://karaf.922171.n3.nabble.com/What-does-effective-active-mean-td4047770.html
)

Well, thank you both very much. Saved me tons of headache.

Kind Regards,
Miroslav


2018-07-24 20:51 GMT+02:00 Jean-Baptiste Onofré :

> Hi,
>
> François just fixed the JPA example of the DEV_GUIDE branch.
>
> I will add the corresponding examples itests tomorrow.
>
> Regards
> JB
>
> On 20/07/2018 16:17, Miroslav Beranič wrote:
> > Hi,
> >
> > I've upgraded my environment from ServiceMix 7.1.0-SNAPSHOT ( running
> > Karaf 4.0.9 ) to Karaf 4.1.x ( GitHub ) branch and later on I've
> > experimented with version 4.2.x.
> > I was using linked linkes from Karaf home page (
> > https://karaf.apache.org/documentation.html ) to GitHub Examples - for
> JPA.
> >
> > My main task is to get JPA 2 up and running, but I fail to do so.
> >
> > So on provided examples Github repository:
> > https://github.com/jbonofre/karaf/tree/DEV_GUIDE/examples/
> karaf-jpa-example
> >
> > I've tested with Karaf 4.1.x and 4.2.x and in both version, Examples for
> > JPA do now work - for me.
> >
> > For Karaf 4.2.x I've created PasteBin outputs ( please see ):
> > 1.) https://pastebin.com/eJybVNhn
> > 2.) https://pastebin.com/W2UhihdR
> >
> > In examples, I've noted that there is a reference to Hibernate
> > 6.0.10.Final - this version is not released yet ( hibernate.org
> >  ), so I guess this is a wrong version, or ? as I
> > see Karaf has build-in support for Hibernate 5.2.9.Final.
> >
> > https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/
> karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml
> >
> > For Hibernate version I am looking at:
> > https://github.com/apache/karaf/blob/master/pom.xml
> > 5.2.9.Final
> >
> > So what I did was:
> >
> > 1.) checked out Karaf 4.1.x from Github
> > 2.) checked out Karaf Examples ( DEV_GUIDE branch from Github )
> >
> > 3.) Build Karaf with Maven: mvn -Pfastinstall and started Karaf with
> > ./bin/karaf debug
> > 4.) Build Karaf Examples ( changed version of Hibernate from
> > 6.0.10.Final to 5.2.9.Final )
> >
> > Read instruction from:
> > https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/
> karaf-jpa-example/README.md
> >
> > 5.) feature:repo-add
> > mvn:org.apache.karaf.examples/karaf-jpa-example-features/4.
> 2.1-SNAPSHOT/xml
> > 6.) feature:install karaf-jpa-example-datasource
> > 7.) feature:install karaf-jpa-example-provider
> >
> > Fail:
> >
> > Error executing command: Unable to resolve root: missing requirement
> > [root] osgi.identity; osgi.identity=karaf-jpa-example-provider;
> > type=karaf.feature; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
> > filter:="(&(osgi.identity=karaf-jpa-example-provider)(
> type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))"
> > [caused by: Unable to resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT:
> > missing requirement [karaf-jpa-example-provider/4.2.1.SNAPSHOT]
> > osgi.identity;
> > osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
> > type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
> > resolution:=mandatory [caused by: Unable to resolve
> > org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
> > missing requirement
> > [org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
> > osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
> > 

RE: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Leschke, Scott
Hi Oleg,

I’m the person who originally reported the issue that JB is referring to.  In 
my case on Windows, Karaf appears to work fine as well but there is that error 
in the log that only occurs when you start Karaf using the service wrapper.

Regards,
Scott

From: Oleg Cohen [mailto:oleg.co...@assurebridge.com]
Sent: Tuesday, July 24, 2018 2:01 PM
To: user@karaf.apache.org
Subject: Re: java.lang.NoClassDefFoundError: 
org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

Hi JB,

I am using the wrapper. bin/karaf works fine.

Thank you!
Oleg


On Jul 24, 2018, at 2:58 PM, Jean-Baptiste Onofré 
mailto:j...@nanthrax.net>> wrote:

Maybe it's related to:

https://issues.apache.org/jira/browse/KARAF-5840 (I already have a fix
on a local branch)

The problem only occurs when using the wrapper.

@Oleg/Miroslav: do you use wrapper to start Karaf instead of bin/karaf ?

Regards
JB

On 24/07/2018 20:54, Francois Papon wrote:

Hi,

It's weird because I downloaded the binary and after extract it, I can
see the org.apache.karaf.specs.locator-4.2.0.jar in the lib/endorsed
directory.

regards,

François Papon
fpa...@apache.org

Le 24/07/2018 à 22:31, Oleg Cohen a écrit :

Hi Miroslav,

I think I found the issue. You are right a JAR is missing.

I built org.apache.karaf.specs.locator-4.2.0.jar and added it to the
boot/lib folder and the exception is now gone.

Thank you!
Oleg



On Jul 24, 2018, at 11:45 AM, Miroslav Beranič
mailto:miroslav.bera...@mibesis.si> 
> wrote:

Hi Oleg,

I've just downloaded package from:

http://karaf.apache.org/download.html
Binary Distribution : tar.gz [PGP] [SHA512]

I've downloaded to /opt/ folder and unpacked the package.

I am using RHEL 7.5, Oracle Java 8 ( 1.8.0.172 )

Next I've started Karf with:

[root@framework apache-karaf-4.2.0]# ls -al
total 424
drwxr-xr-x. 9 root root156 jul 24 17:35 .
drwxr-xr-x. 4 root root110 jul 24 17:35 ..
drwxr-xr-x. 3 root root282 apr  5 06:29 bin
drwxr-xr-x. 3 root root 17 apr  5 06:29 data
drwxr-xr-x. 9 root root123 apr  5 06:29 demos
drwxr-xr-x. 2 root root 20 apr  5 06:29 deploy
drwxr-xr-x. 3 root root   4096 apr  5 06:29 etc
drwxr-xr-x. 5 root root 59 apr  5 06:29 lib
-rw-r--r--. 1 root root  27754 apr  5 06:29 LICENSE
-rw-r--r--. 1 root root   1829 apr  5 06:29 NOTICE
-rw-r--r--. 1 root root   4025 apr  5 06:29 README
-rw-r--r--. 1 root root 390829 apr  5 06:29 RELEASE-NOTES
drwxr-xr-x. 3 root root 31 apr  5 06:29 system
[root@framework apache-karaf-4.2.0]# JAVA_HOME=/opt/jdk ./bin/karaf debug
Listening for transport dt_socket at address: 5005
__ __  
   / //_/ __ _/ __/
  / ,<  / __ `/ ___/ __ `/ /_
 / /| |/ /_/ / /  / /_/ / __/
/_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (4.2.0)

Hit '' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()> feature:install
service-wrapper

karaf@root()> wrapper:install
Creating file: /opt/apache-karaf-4.2.0/bin/karaf-wrapper
Creating file: /opt/apache-karaf-4.2.0/bin/karaf-service
Creating file: /opt/apache-karaf-4.2.0/bin/karaf.service
Creating file: /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
Creating missing directory: /opt/apache-karaf-4.2.0/lib/wrapper
Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/libwrapper.so
Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper.jar
Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper-main.jar

Setup complete.  You may wish to tweak the JVM properties in the
wrapper configuration file:
/opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
before installing and starting the service.


RedHat/Fedora/CentOS Linux system detected (SystemV):
  To install the service:
$ ln -s /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
$ chkconfig karaf-service --add

  To start the service when the machine is rebooted:
$ chkconfig karaf-service on

  To disable starting the service when the machine is rebooted:
$ chkconfig karaf-service off

  To start the service:
$ service karaf-service start

  To stop the service:
$ service karaf-service stop

  To uninstall the service :
$ chkconfig karaf-service --del
$ rm /etc/init.d/karaf-service

For systemd compliant Linux:
  To install the service (and enable at system boot):
   $ systemctl enable /opt/apache-karaf-4.2.0/bin/karaf.service

  To start the service:
   $ systemctl start karaf

  To stop the service:
   $ systemctl stop karaf

  To check the current service status:
   $ systemctl status karaf

  To see service activity journal:
   $ journalctl -u karaf

  To uninstall the service (and disable at system boot):
   $ systemctl disable karaf
karaf@root()>

karaf@root()>


I've exited Karaf shell here ( with Ctrl + D )


[root@framework apache-karaf-4.2.0]# ^C
[root@framework 

Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Oleg Cohen
Hi JB,

I am using the wrapper. bin/karaf works fine.

Thank you!
Oleg

> On Jul 24, 2018, at 2:58 PM, Jean-Baptiste Onofré  wrote:
> 
> Maybe it's related to:
> 
> https://issues.apache.org/jira/browse/KARAF-5840 
>  (I already have a fix
> on a local branch)
> 
> The problem only occurs when using the wrapper.
> 
> @Oleg/Miroslav: do you use wrapper to start Karaf instead of bin/karaf ?
> 
> Regards
> JB
> 
> On 24/07/2018 20:54, Francois Papon wrote:
>> Hi,
>> 
>> It's weird because I downloaded the binary and after extract it, I can
>> see the org.apache.karaf.specs.locator-4.2.0.jar in the lib/endorsed
>> directory.
>> 
>> regards,
>> 
>> François Papon
>> fpa...@apache.org
>> 
>> Le 24/07/2018 à 22:31, Oleg Cohen a écrit :
>>> Hi Miroslav,
>>> 
>>> I think I found the issue. You are right a JAR is missing.
>>> 
>>> I built org.apache.karaf.specs.locator-4.2.0.jar and added it to the
>>> boot/lib folder and the exception is now gone.
>>> 
>>> Thank you!
>>> Oleg
>>> 
>>> 
 On Jul 24, 2018, at 11:45 AM, Miroslav Beranič
 mailto:miroslav.bera...@mibesis.si> 
 >> 
 wrote:
 
 Hi Oleg,
 
 I've just downloaded package from:
 
 http://karaf.apache.org/download.html 
 
 Binary Distribution : tar.gz [PGP] [SHA512]
 
 I've downloaded to /opt/ folder and unpacked the package.
 
 I am using RHEL 7.5, Oracle Java 8 ( 1.8.0.172 )
 
 Next I've started Karf with:
 
 [root@framework apache-karaf-4.2.0]# ls -al
 total 424
 drwxr-xr-x. 9 root root156 jul 24 17:35 .
 drwxr-xr-x. 4 root root110 jul 24 17:35 ..
 drwxr-xr-x. 3 root root282 apr  5 06:29 bin
 drwxr-xr-x. 3 root root 17 apr  5 06:29 data
 drwxr-xr-x. 9 root root123 apr  5 06:29 demos
 drwxr-xr-x. 2 root root 20 apr  5 06:29 deploy
 drwxr-xr-x. 3 root root   4096 apr  5 06:29 etc
 drwxr-xr-x. 5 root root 59 apr  5 06:29 lib
 -rw-r--r--. 1 root root  27754 apr  5 06:29 LICENSE
 -rw-r--r--. 1 root root   1829 apr  5 06:29 NOTICE
 -rw-r--r--. 1 root root   4025 apr  5 06:29 README
 -rw-r--r--. 1 root root 390829 apr  5 06:29 RELEASE-NOTES
 drwxr-xr-x. 3 root root 31 apr  5 06:29 system
 [root@framework apache-karaf-4.2.0]# JAVA_HOME=/opt/jdk ./bin/karaf debug
 Listening for transport dt_socket at address: 5005
 __ __    
/ //_/ __ _/ __/  
   / ,<  / __ `/ ___/ __ `/ /_
  / /| |/ /_/ / /  / /_/ / __/
 /_/ |_|\__,_/_/   \__,_/_/ 
 
   Apache Karaf (4.2.0)
 
 Hit '' for a list of available commands
 and '[cmd] --help' for help on a specific command.
 Hit '' or type 'system:shutdown' or 'logout' to shutdown Karaf.
 
 karaf@root()> feature:install
 service-wrapper

   
  
 karaf@root()> wrapper:install
 Creating file: /opt/apache-karaf-4.2.0/bin/karaf-wrapper
 Creating file: /opt/apache-karaf-4.2.0/bin/karaf-service
 Creating file: /opt/apache-karaf-4.2.0/bin/karaf.service
 Creating file: /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
 Creating missing directory: /opt/apache-karaf-4.2.0/lib/wrapper
 Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/libwrapper.so
 Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper.jar
 Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper-main.jar
 
 Setup complete.  You may wish to tweak the JVM properties in the
 wrapper configuration file:
 /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
 before installing and starting the service.
 
 
 RedHat/Fedora/CentOS Linux system detected (SystemV):
   To install the service:
 $ ln -s /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
 $ chkconfig karaf-service --add
 
   To start the service when the machine is rebooted:
 $ chkconfig karaf-service on
 
   To disable starting the service when the machine is rebooted:
 $ chkconfig karaf-service off
 
   To start the service:
 $ service karaf-service start
 
   To stop the service:
 $ service karaf-service stop
 
   To uninstall the service :
 $ chkconfig karaf-service --del
 $ rm /etc/init.d/karaf-service
 
 For systemd compliant Linux:
   To install the service (and enable at system boot):
$ systemctl enable /opt/apache-karaf-4.2.0/bin/karaf.service
 
   To start the service:
$ systemctl start karaf
 
   To stop the service:
$ systemctl 

Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Miroslav Beranič
Hi,

first I've started Karaf with ./bin/karaf debug, and from Karaf Shell
installed service with wrapper. Rebooted RHEL and logged into Karaf over
ssh.

It worked for me without any problem.

Rgds,
Miroslav


V tor., 24. jul. 2018 20:58 je oseba Jean-Baptiste Onofré 
napisala:

> Maybe it's related to:
>
> https://issues.apache.org/jira/browse/KARAF-5840 (I already have a fix
> on a local branch)
>
> The problem only occurs when using the wrapper.
>
> @Oleg/Miroslav: do you use wrapper to start Karaf instead of bin/karaf ?
>
> Regards
> JB
>
> On 24/07/2018 20:54, Francois Papon wrote:
> > Hi,
> >
> > It's weird because I downloaded the binary and after extract it, I can
> > see the org.apache.karaf.specs.locator-4.2.0.jar in the lib/endorsed
> > directory.
> >
> > regards,
> >
> > François Papon
> > fpa...@apache.org
> >
> > Le 24/07/2018 à 22:31, Oleg Cohen a écrit :
> >> Hi Miroslav,
> >>
> >> I think I found the issue. You are right a JAR is missing.
> >>
> >> I built org.apache.karaf.specs.locator-4.2.0.jar and added it to the
> >> boot/lib folder and the exception is now gone.
> >>
> >> Thank you!
> >> Oleg
> >>
> >>
> >>> On Jul 24, 2018, at 11:45 AM, Miroslav Beranič
> >>> mailto:miroslav.bera...@mibesis.si>>
> wrote:
> >>>
> >>> Hi Oleg,
> >>>
> >>> I've just downloaded package from:
> >>>
> >>> http://karaf.apache.org/download.html
> >>> Binary Distribution : tar.gz [PGP] [SHA512]
> >>>
> >>> I've downloaded to /opt/ folder and unpacked the package.
> >>>
> >>> I am using RHEL 7.5, Oracle Java 8 ( 1.8.0.172 )
> >>>
> >>> Next I've started Karf with:
> >>>
> >>> [root@framework apache-karaf-4.2.0]# ls -al
> >>> total 424
> >>> drwxr-xr-x. 9 root root156 jul 24 17:35 .
> >>> drwxr-xr-x. 4 root root110 jul 24 17:35 ..
> >>> drwxr-xr-x. 3 root root282 apr  5 06:29 bin
> >>> drwxr-xr-x. 3 root root 17 apr  5 06:29 data
> >>> drwxr-xr-x. 9 root root123 apr  5 06:29 demos
> >>> drwxr-xr-x. 2 root root 20 apr  5 06:29 deploy
> >>> drwxr-xr-x. 3 root root   4096 apr  5 06:29 etc
> >>> drwxr-xr-x. 5 root root 59 apr  5 06:29 lib
> >>> -rw-r--r--. 1 root root  27754 apr  5 06:29 LICENSE
> >>> -rw-r--r--. 1 root root   1829 apr  5 06:29 NOTICE
> >>> -rw-r--r--. 1 root root   4025 apr  5 06:29 README
> >>> -rw-r--r--. 1 root root 390829 apr  5 06:29 RELEASE-NOTES
> >>> drwxr-xr-x. 3 root root 31 apr  5 06:29 system
> >>> [root@framework apache-karaf-4.2.0]# JAVA_HOME=/opt/jdk ./bin/karaf
> debug
> >>> Listening for transport dt_socket at address: 5005
> >>> __ __  
> >>>/ //_/ __ _/ __/
> >>>   / ,<  / __ `/ ___/ __ `/ /_
> >>>  / /| |/ /_/ / /  / /_/ / __/
> >>> /_/ |_|\__,_/_/   \__,_/_/
> >>>
> >>>   Apache Karaf (4.2.0)
> >>>
> >>> Hit '' for a list of available commands
> >>> and '[cmd] --help' for help on a specific command.
> >>> Hit '' or type 'system:shutdown' or 'logout' to shutdown Karaf.
> >>>
> >>> karaf@root()> feature:install
> >>>
> service-wrapper
> >>>
> >>> karaf@root()> wrapper:install
> >>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf-wrapper
> >>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf-service
> >>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf.service
> >>> Creating file: /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
> >>> Creating missing directory: /opt/apache-karaf-4.2.0/lib/wrapper
> >>> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/libwrapper.so
> >>> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper.jar
> >>> Creating file:
> /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper-main.jar
> >>>
> >>> Setup complete.  You may wish to tweak the JVM properties in the
> >>> wrapper configuration file:
> >>> /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
> >>> before installing and starting the service.
> >>>
> >>>
> >>> RedHat/Fedora/CentOS Linux system detected (SystemV):
> >>>   To install the service:
> >>> $ ln -s /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
> >>> $ chkconfig karaf-service --add
> >>>
> >>>   To start the service when the machine is rebooted:
> >>> $ chkconfig karaf-service on
> >>>
> >>>   To disable starting the service when the machine is rebooted:
> >>> $ chkconfig karaf-service off
> >>>
> >>>   To start the service:
> >>> $ service karaf-service start
> >>>
> >>>   To stop the service:
> >>> $ service karaf-service stop
> >>>
> >>>   To uninstall the service :
> >>> $ chkconfig karaf-service --del
> >>> $ rm /etc/init.d/karaf-service
> >>>
> >>> For systemd compliant Linux:
> >>>   To install the service (and enable at system boot):
> >>>$ systemctl enable /opt/apache-karaf-4.2.0/bin/karaf.service
> >>>
> >>>   To start the service:
> >>>$ systemctl start karaf
> >>>
> >>>   To stop the service:
> >>>$ systemctl stop karaf
> >>>
> >>>   To check the current service status:
> >>>$ systemctl status karaf
> >>>
> >>>   To see service activity journal:
> >>>$ journalctl -u 

Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Jean-Baptiste Onofré
Maybe it's related to:

https://issues.apache.org/jira/browse/KARAF-5840 (I already have a fix
on a local branch)

The problem only occurs when using the wrapper.

@Oleg/Miroslav: do you use wrapper to start Karaf instead of bin/karaf ?

Regards
JB

On 24/07/2018 20:54, Francois Papon wrote:
> Hi,
> 
> It's weird because I downloaded the binary and after extract it, I can
> see the org.apache.karaf.specs.locator-4.2.0.jar in the lib/endorsed
> directory.
> 
> regards,
> 
> François Papon
> fpa...@apache.org
> 
> Le 24/07/2018 à 22:31, Oleg Cohen a écrit :
>> Hi Miroslav,
>>
>> I think I found the issue. You are right a JAR is missing.
>>
>> I built org.apache.karaf.specs.locator-4.2.0.jar and added it to the
>> boot/lib folder and the exception is now gone.
>>
>> Thank you!
>> Oleg
>>
>>
>>> On Jul 24, 2018, at 11:45 AM, Miroslav Beranič
>>> mailto:miroslav.bera...@mibesis.si>> wrote:
>>>
>>> Hi Oleg,
>>>
>>> I've just downloaded package from:
>>>
>>> http://karaf.apache.org/download.html
>>> Binary Distribution : tar.gz [PGP] [SHA512]
>>>
>>> I've downloaded to /opt/ folder and unpacked the package.
>>>
>>> I am using RHEL 7.5, Oracle Java 8 ( 1.8.0.172 )
>>>
>>> Next I've started Karf with:
>>>
>>> [root@framework apache-karaf-4.2.0]# ls -al
>>> total 424
>>> drwxr-xr-x. 9 root root    156 jul 24 17:35 .
>>> drwxr-xr-x. 4 root root    110 jul 24 17:35 ..
>>> drwxr-xr-x. 3 root root    282 apr  5 06:29 bin
>>> drwxr-xr-x. 3 root root 17 apr  5 06:29 data
>>> drwxr-xr-x. 9 root root    123 apr  5 06:29 demos
>>> drwxr-xr-x. 2 root root 20 apr  5 06:29 deploy
>>> drwxr-xr-x. 3 root root   4096 apr  5 06:29 etc
>>> drwxr-xr-x. 5 root root 59 apr  5 06:29 lib
>>> -rw-r--r--. 1 root root  27754 apr  5 06:29 LICENSE
>>> -rw-r--r--. 1 root root   1829 apr  5 06:29 NOTICE
>>> -rw-r--r--. 1 root root   4025 apr  5 06:29 README
>>> -rw-r--r--. 1 root root 390829 apr  5 06:29 RELEASE-NOTES
>>> drwxr-xr-x. 3 root root 31 apr  5 06:29 system
>>> [root@framework apache-karaf-4.2.0]# JAVA_HOME=/opt/jdk ./bin/karaf debug
>>> Listening for transport dt_socket at address: 5005
>>>     __ __    
>>>    / //_/ __ _/ __/  
>>>   / ,<  / __ `/ ___/ __ `/ /_    
>>>  / /| |/ /_/ / /  / /_/ / __/    
>>>     /_/ |_|\__,_/_/   \__,_/_/     
>>>
>>>   Apache Karaf (4.2.0)
>>>
>>> Hit '' for a list of available commands
>>> and '[cmd] --help' for help on a specific command.
>>> Hit '' or type 'system:shutdown' or 'logout' to shutdown Karaf.
>>>
>>> karaf@root()> feature:install
>>> service-wrapper 
>>> 
>>> 
>>>  
>>> karaf@root()> wrapper:install
>>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf-wrapper
>>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf-service
>>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf.service
>>> Creating file: /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
>>> Creating missing directory: /opt/apache-karaf-4.2.0/lib/wrapper
>>> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/libwrapper.so
>>> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper.jar
>>> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper-main.jar
>>>
>>> Setup complete.  You may wish to tweak the JVM properties in the
>>> wrapper configuration file:
>>>     /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
>>> before installing and starting the service.
>>>
>>>
>>> RedHat/Fedora/CentOS Linux system detected (SystemV):
>>>   To install the service:
>>>     $ ln -s /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
>>>     $ chkconfig karaf-service --add
>>>
>>>   To start the service when the machine is rebooted:
>>>     $ chkconfig karaf-service on
>>>
>>>   To disable starting the service when the machine is rebooted:
>>>     $ chkconfig karaf-service off
>>>
>>>   To start the service:
>>>     $ service karaf-service start
>>>
>>>   To stop the service:
>>>     $ service karaf-service stop
>>>
>>>   To uninstall the service :
>>>     $ chkconfig karaf-service --del
>>>     $ rm /etc/init.d/karaf-service
>>>
>>> For systemd compliant Linux:
>>>   To install the service (and enable at system boot):
>>>    $ systemctl enable /opt/apache-karaf-4.2.0/bin/karaf.service
>>>
>>>   To start the service:
>>>    $ systemctl start karaf
>>>
>>>   To stop the service:
>>>    $ systemctl stop karaf
>>>
>>>   To check the current service status:
>>>    $ systemctl status karaf
>>>
>>>   To see service activity journal:
>>>    $ journalctl -u karaf
>>>
>>>   To uninstall the service (and disable at system boot):
>>>    $ systemctl disable karaf
>>> karaf@root()>   
>>> 
>>>   
>>>  

Re: Apache Karaf 4.x JPA - Working example

2018-07-24 Thread Jean-Baptiste Onofré
Hi,

François just fixed the JPA example of the DEV_GUIDE branch.

I will add the corresponding examples itests tomorrow.

Regards
JB

On 20/07/2018 16:17, Miroslav Beranič wrote:
> Hi,
> 
> I've upgraded my environment from ServiceMix 7.1.0-SNAPSHOT ( running
> Karaf 4.0.9 ) to Karaf 4.1.x ( GitHub ) branch and later on I've
> experimented with version 4.2.x.
> I was using linked linkes from Karaf home page (
> https://karaf.apache.org/documentation.html ) to GitHub Examples - for JPA.
> 
> My main task is to get JPA 2 up and running, but I fail to do so.
> 
> So on provided examples Github repository:
> https://github.com/jbonofre/karaf/tree/DEV_GUIDE/examples/karaf-jpa-example
> 
> I've tested with Karaf 4.1.x and 4.2.x and in both version, Examples for
> JPA do now work - for me.
> 
> For Karaf 4.2.x I've created PasteBin outputs ( please see ):
> 1.) https://pastebin.com/eJybVNhn
> 2.) https://pastebin.com/W2UhihdR
> 
> In examples, I've noted that there is a reference to Hibernate
> 6.0.10.Final - this version is not released yet ( hibernate.org
>  ), so I guess this is a wrong version, or ? as I
> see Karaf has build-in support for Hibernate 5.2.9.Final.
> 
> https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml
> 
> For Hibernate version I am looking at:
> https://github.com/apache/karaf/blob/master/pom.xml
> 5.2.9.Final
> 
> So what I did was:
> 
> 1.) checked out Karaf 4.1.x from Github
> 2.) checked out Karaf Examples ( DEV_GUIDE branch from Github )
> 
> 3.) Build Karaf with Maven: mvn -Pfastinstall and started Karaf with
> ./bin/karaf debug
> 4.) Build Karaf Examples ( changed version of Hibernate from
> 6.0.10.Final to 5.2.9.Final )
> 
> Read instruction from:
> https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/karaf-jpa-example/README.md
> 
> 5.) feature:repo-add
> mvn:org.apache.karaf.examples/karaf-jpa-example-features/4.2.1-SNAPSHOT/xml
> 6.) feature:install karaf-jpa-example-datasource
> 7.) feature:install karaf-jpa-example-provider
> 
> Fail:
> 
> Error executing command: Unable to resolve root: missing requirement
> [root] osgi.identity; osgi.identity=karaf-jpa-example-provider;
> type=karaf.feature; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
> filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))"
> [caused by: Unable to resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT:
> missing requirement [karaf-jpa-example-provider/4.2.1.SNAPSHOT]
> osgi.identity;
> osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
> type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
> resolution:=mandatory [caused by: Unable to resolve
> org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
> missing requirement
> [org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
> osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
> javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
> effective:=active]]
> 
> I am using Linux x64, Oracle Java 8 172 x64.
> 
> What I am doing wrong. I've mixed different version of Hibernate, Karaf,
> ... and noting. Always some more or less strange error.
> 
> Plus there is an issue: what version of maven-bundle-plugin should/must
> be used? I've tried 3.01 and 3.2.0. When I use 3.0.1 I have to update
>  if I use 3.2.0 I get error that javassist is not resolved:
> 
> Error executing command: Unable to resolve root: missing requirement
> [root] osgi.identity; osgi.identity=. ... osgi.wiring.package;
> filter:="(&(osgi.wiring.package=javassist.util.proxy)(version>=3.22.0)(!(version>=4.0.0)))"]]]
> 
> 
> 
> So all in all I can not and did not find and singe point of truth what
> is valid example or way of doing JPA 2 with Hibernate. I guess I am
> doing something wrong as all examples make it so simple but ... no luck.
> All I did is clean ( new computer - virtual ) checkout from git, build
> and deploy - and fail.
> 
> I would like to migrate existing code using JPA 1 to JPA 2 ( 2.2 ? ) but
> ... this is difficult task to complete ( this is after one week of pain
> and frustration ).
> 
> I've done examples from https://github.com/cschneider/Karaf-Tutorial
> also, but no luck. More-or-less same problems.
> 
> 
> 1.) What versions of Maven plugins should I use?
> 2.) What versions of JPA?
> 3.) What versions of Hibernate?
> 4.) What example should I follow ( URL / Git and branch ) ?
> 
> 
> This are my top questions.
> 
> 
> Kind Regards,
> Miroslav
> 
> 
> 
> -- 
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> miroslav.bera...@mibesis.si 
> http://www.mibesis.si


Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Oleg Cohen
Hi Miroslav,

I think I found the issue. You are right a JAR is missing.

I built org.apache.karaf.specs.locator-4.2.0.jar and added it to the boot/lib 
folder and the exception is now gone.

Thank you!
Oleg


> On Jul 24, 2018, at 11:45 AM, Miroslav Beranič  
> wrote:
> 
> Hi Oleg,
> 
> I've just downloaded package from:
> 
> http://karaf.apache.org/download.html 
> Binary Distribution : tar.gz [PGP] [SHA512]
> 
> I've downloaded to /opt/ folder and unpacked the package.
> 
> I am using RHEL 7.5, Oracle Java 8 ( 1.8.0.172 )
> 
> Next I've started Karf with:
> 
> [root@framework apache-karaf-4.2.0]# ls -al
> total 424
> drwxr-xr-x. 9 root root156 jul 24 17:35 .
> drwxr-xr-x. 4 root root110 jul 24 17:35 ..
> drwxr-xr-x. 3 root root282 apr  5 06:29 bin
> drwxr-xr-x. 3 root root 17 apr  5 06:29 data
> drwxr-xr-x. 9 root root123 apr  5 06:29 demos
> drwxr-xr-x. 2 root root 20 apr  5 06:29 deploy
> drwxr-xr-x. 3 root root   4096 apr  5 06:29 etc
> drwxr-xr-x. 5 root root 59 apr  5 06:29 lib
> -rw-r--r--. 1 root root  27754 apr  5 06:29 LICENSE
> -rw-r--r--. 1 root root   1829 apr  5 06:29 NOTICE
> -rw-r--r--. 1 root root   4025 apr  5 06:29 README
> -rw-r--r--. 1 root root 390829 apr  5 06:29 RELEASE-NOTES
> drwxr-xr-x. 3 root root 31 apr  5 06:29 system
> [root@framework apache-karaf-4.2.0]# JAVA_HOME=/opt/jdk ./bin/karaf debug
> Listening for transport dt_socket at address: 5005
> __ __    
>/ //_/ __ _/ __/  
>   / ,<  / __ `/ ___/ __ `/ /_
>  / /| |/ /_/ / /  / /_/ / __/
> /_/ |_|\__,_/_/   \__,_/_/ 
> 
>   Apache Karaf (4.2.0)
> 
> Hit '' for a list of available commands
> and '[cmd] --help' for help on a specific command.
> Hit '' or type 'system:shutdown' or 'logout' to shutdown Karaf.
> 
> karaf@root()> feature:install service-wrapper 
>   
> 
> karaf@root()> wrapper:install
> Creating file: /opt/apache-karaf-4.2.0/bin/karaf-wrapper
> Creating file: /opt/apache-karaf-4.2.0/bin/karaf-service
> Creating file: /opt/apache-karaf-4.2.0/bin/karaf.service
> Creating file: /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
> Creating missing directory: /opt/apache-karaf-4.2.0/lib/wrapper
> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/libwrapper.so
> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper.jar
> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper-main.jar
> 
> Setup complete.  You may wish to tweak the JVM properties in the wrapper 
> configuration file:
> /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
> before installing and starting the service.
> 
> 
> RedHat/Fedora/CentOS Linux system detected (SystemV):
>   To install the service:
> $ ln -s /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
> $ chkconfig karaf-service --add
> 
>   To start the service when the machine is rebooted:
> $ chkconfig karaf-service on
> 
>   To disable starting the service when the machine is rebooted:
> $ chkconfig karaf-service off
> 
>   To start the service:
> $ service karaf-service start
> 
>   To stop the service:
> $ service karaf-service stop
> 
>   To uninstall the service :
> $ chkconfig karaf-service --del
> $ rm /etc/init.d/karaf-service
> 
> For systemd compliant Linux: 
>   To install the service (and enable at system boot):
>$ systemctl enable /opt/apache-karaf-4.2.0/bin/karaf.service
> 
>   To start the service:
>$ systemctl start karaf
> 
>   To stop the service:
>$ systemctl stop karaf
> 
>   To check the current service status:
>$ systemctl status karaf
> 
>   To see service activity journal:
>$ journalctl -u karaf
> 
>   To uninstall the service (and disable at system boot):
>$ systemctl disable karaf
> karaf@root()> 
>   
> 
> karaf@root()> 
>   
> 
> 
> I've exited Karaf shell here ( with Ctrl + D )
> 
> 
> [root@framework apache-karaf-4.2.0]# ^C
> [root@framework apache-karaf-4.2.0]# ln -s 
> /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
> [root@framework apache-karaf-4.2.0]# chkconfig karaf-service --add
> [root@framework apache-karaf-4.2.0]# chkconfig karaf-service on
> [root@framework apache-karaf-4.2.0]# service karaf-service start
> Starting karaf...
> [root@framework apache-karaf-4.2.0]# reboot
> 
> Now you can go back to terminal or connect over ssh --- I use SSH :
> 
> so now I ssh 

Re: Examples of using Jersey with pax web whiteboard extender?

2018-07-24 Thread Tim Ward


> On 24 Jul 2018, at 17:00, Steinar Bang  wrote:
> 
>> Tim Ward :
> 
>> Would it not be easier to:
>> Use the Http Service Whiteboard support for resource serving, rather than 
>> having the ReactServlet? That’s a big bit of boilerplate for serving some 
>> static content. It should be much simpler using component 
>> properties/annotations - see 
>> https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121459
>>  
>> 
> 
> Yes it might be...  There are after all, just two files that needs to be
> served: the initial index.html file and the bundle.js file it references
> (the react app and everything is needs, CSS, fonts, images etc. are
> packed into bundle.js using webpack).
> 
> However, there is a bit of special-casing, such as this:
> https://github.com/steinarb/ukelonn/blob/using-react/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/UkelonnServlet.java#L48
> that needs to match this
> https://github.com/steinarb/ukelonn/blob/using-react/ukelonn.bundle/src/main/frontend/components/App.js#L30
> so that it is actually possible to enter or reload the URLs created by
> the react router into a browser and not get 404.
> 
> I haven't found any way to achive single point of change for these
> values, and react needs to include the servlet context (in this case,
> "/ukelonn") while the servlets' URLs, are relative to the servlet
> context.

That is a little bit yucky, and does mean that you probably can’t do it without 
code :(. I do think that it would be better to solve it with a 
ServletContextHelper than in the servlet though. See 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard.servletcontext
 


This would move your mime-type handling and routing out of the servlet, and you 
could put the resource properties on the same component so that the whole thing 
is encapsulated You could force the servlet to require the context by using the 
context selection property (see 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard.common.properties
 
)
 if you wanted. This separation would be quite a lot cleaner, even if it isn’t 
smaller.

> 
>> Use the JAX-RS whiteboard to directly register a JAX-RS resource, avoiding 
>> the need to teach people about launching Jersey (something that they 
>> probably care very little about). It’s really very simple to do - see 
>> https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#service.jaxrs.resource.services
>>  
>> 
>>  
> 
> Hm... is this available in some form in OSGi 6 as well?  Or is this OSGi
> 7 only?

The specification is part of R7, but the implementation will run on R6. There 
should be no issue deploying it on Karaf, assuming that the PAX Web whiteboard 
support has the correct capabilities advertised for the Http Service Whiteboard 
(V 1.0 from R6 is sufficient).

> 
> As I've mentioned elsewhere in this thread I ran into some strange
> issues when I tried karaf 4.2.0, and I haven't spent time figuring them
> out yet.
> 
>> Using those features should be able to make the example more concise and 
>> compelling.
> 
> Indeed.
> 
> Seems like there is lots of interesting stuff in OSGi 7, so I should
> probably get there as soon as possible.

It’s awesome - once you’ve tried using Component Property Annotations and 
Bundle annotations you will never want to go back!

> 



Re: Creating an JDBC

2018-07-24 Thread Jean-Baptiste Onofré
Hi Paul,

can you try to enable dynamic import for Pax JDBC ?

I will add this natively.

Regards
JB

On 24/07/2018 18:02, Paul Spencer wrote:
> Karaf 4.2
> 
> I am trying to create a JDBC datasource for a DBMS not natively supported by
> PAX-JDBC, specifically Ingres.   Below are the commands I am using to
> install the Ingres JDBC driver and create the datasource.  Based on the log
> files, the creation process is waiting on a service dependency.
> 
> karaf@root()> bundle:install wrap:mvn:com.ingres.jdbc/iijdbc/9.2-3.4.10
> karaf@root()> jdbc:ds-create -url jdbc:ingres://localhost/dbname -u user -p
> password -dc com.ingres.jdbc.IngresDataSource myDS
> karaf@root()> log:display
> 11:47:35.465 INFO [CM Configuration Updater (Update:
> pid=org.ops4j.datasource.b91f90b0-b399-49ab-9f55-9ab522d24833)] Waiting for
> service dependency:
> (&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.ingres.jdbc.IngresDataSource))
> 
> How to I create a JDBC datasource using com.ingres.jdbc.IngresDataSource?
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 


Creating an JDBC

2018-07-24 Thread Paul Spencer
Karaf 4.2

I am trying to create a JDBC datasource for a DBMS not natively supported by
PAX-JDBC, specifically Ingres.   Below are the commands I am using to
install the Ingres JDBC driver and create the datasource.  Based on the log
files, the creation process is waiting on a service dependency.

karaf@root()> bundle:install wrap:mvn:com.ingres.jdbc/iijdbc/9.2-3.4.10
karaf@root()> jdbc:ds-create -url jdbc:ingres://localhost/dbname -u user -p
password -dc com.ingres.jdbc.IngresDataSource myDS
karaf@root()> log:display
11:47:35.465 INFO [CM Configuration Updater (Update:
pid=org.ops4j.datasource.b91f90b0-b399-49ab-9f55-9ab522d24833)] Waiting for
service dependency:
(&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.ingres.jdbc.IngresDataSource))

How to I create a JDBC datasource using com.ingres.jdbc.IngresDataSource?



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html


Re: Examples of using Jersey with pax web whiteboard extender?

2018-07-24 Thread Steinar Bang
> Tim Ward :

> Would it not be easier to:
> Use the Http Service Whiteboard support for resource serving, rather than 
> having the ReactServlet? That’s a big bit of boilerplate for serving some 
> static content. It should be much simpler using component 
> properties/annotations - see 
> https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121459
>  
> 

Yes it might be...  There are after all, just two files that needs to be
served: the initial index.html file and the bundle.js file it references
(the react app and everything is needs, CSS, fonts, images etc. are
packed into bundle.js using webpack).

However, there is a bit of special-casing, such as this:
 
https://github.com/steinarb/ukelonn/blob/using-react/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/UkelonnServlet.java#L48
that needs to match this
 
https://github.com/steinarb/ukelonn/blob/using-react/ukelonn.bundle/src/main/frontend/components/App.js#L30
so that it is actually possible to enter or reload the URLs created by
the react router into a browser and not get 404.

I haven't found any way to achive single point of change for these
values, and react needs to include the servlet context (in this case,
"/ukelonn") while the servlets' URLs, are relative to the servlet
context.

> Use the JAX-RS whiteboard to directly register a JAX-RS resource, avoiding 
> the need to teach people about launching Jersey (something that they probably 
> care very little about). It’s really very simple to do - see 
> https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#service.jaxrs.resource.services
>  
> 
>  

Hm... is this available in some form in OSGi 6 as well?  Or is this OSGi
7 only?

As I've mentioned elsewhere in this thread I ran into some strange
issues when I tried karaf 4.2.0, and I haven't spent time figuring them
out yet.

> Using those features should be able to make the example more concise and 
> compelling.

Indeed.

Seems like there is lots of interesting stuff in OSGi 7, so I should
probably get there as soon as possible.



Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Miroslav Beranič
Hi Oleg,

I've just downloaded package from:

http://karaf.apache.org/download.html
Binary Distribution : tar.gz [PGP] [SHA512]

I've downloaded to /opt/ folder and unpacked the package.

I am using RHEL 7.5, Oracle Java 8 ( 1.8.0.172 )

Next I've started Karf with:

[root@framework apache-karaf-4.2.0]# ls -al
total 424
drwxr-xr-x. 9 root root156 jul 24 17:35 .
drwxr-xr-x. 4 root root110 jul 24 17:35 ..
drwxr-xr-x. 3 root root282 apr  5 06:29 bin
drwxr-xr-x. 3 root root 17 apr  5 06:29 data
drwxr-xr-x. 9 root root123 apr  5 06:29 demos
drwxr-xr-x. 2 root root 20 apr  5 06:29 deploy
drwxr-xr-x. 3 root root   4096 apr  5 06:29 etc
drwxr-xr-x. 5 root root 59 apr  5 06:29 lib
-rw-r--r--. 1 root root  27754 apr  5 06:29 LICENSE
-rw-r--r--. 1 root root   1829 apr  5 06:29 NOTICE
-rw-r--r--. 1 root root   4025 apr  5 06:29 README
-rw-r--r--. 1 root root 390829 apr  5 06:29 RELEASE-NOTES
drwxr-xr-x. 3 root root 31 apr  5 06:29 system
[root@framework apache-karaf-4.2.0]# JAVA_HOME=/opt/jdk ./bin/karaf debug
Listening for transport dt_socket at address: 5005
__ __  
   / //_/ __ _/ __/
  / ,<  / __ `/ ___/ __ `/ /_
 / /| |/ /_/ / /  / /_/ / __/
/_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (4.2.0)

Hit '' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()> feature:install
service-wrapper

karaf@root()> wrapper:install
Creating file: /opt/apache-karaf-4.2.0/bin/karaf-wrapper
Creating file: /opt/apache-karaf-4.2.0/bin/karaf-service
Creating file: /opt/apache-karaf-4.2.0/bin/karaf.service
Creating file: /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
Creating missing directory: /opt/apache-karaf-4.2.0/lib/wrapper
Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/libwrapper.so
Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper.jar
Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper-main.jar

Setup complete.  You may wish to tweak the JVM properties in the wrapper
configuration file:
/opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
before installing and starting the service.


RedHat/Fedora/CentOS Linux system detected (SystemV):
  To install the service:
$ ln -s /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
$ chkconfig karaf-service --add

  To start the service when the machine is rebooted:
$ chkconfig karaf-service on

  To disable starting the service when the machine is rebooted:
$ chkconfig karaf-service off

  To start the service:
$ service karaf-service start

  To stop the service:
$ service karaf-service stop

  To uninstall the service :
$ chkconfig karaf-service --del
$ rm /etc/init.d/karaf-service

For systemd compliant Linux:
  To install the service (and enable at system boot):
   $ systemctl enable /opt/apache-karaf-4.2.0/bin/karaf.service

  To start the service:
   $ systemctl start karaf

  To stop the service:
   $ systemctl stop karaf

  To check the current service status:
   $ systemctl status karaf

  To see service activity journal:
   $ journalctl -u karaf

  To uninstall the service (and disable at system boot):
   $ systemctl disable karaf
karaf@root()>

karaf@root()>


I've exited Karaf shell here ( with Ctrl + D )


[root@framework apache-karaf-4.2.0]# ^C
[root@framework apache-karaf-4.2.0]# ln -s
/opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
[root@framework apache-karaf-4.2.0]# chkconfig karaf-service --add
[root@framework apache-karaf-4.2.0]# chkconfig karaf-service on
[root@framework apache-karaf-4.2.0]# service karaf-service start
Starting karaf...
[root@framework apache-karaf-4.2.0]# reboot

Now you can go back to terminal or connect over ssh --- I use SSH :

so now I ssh to Karaf with:

# ssh -p 8101 karaf@framework
The authenticity of host '[localhost]:8101 ([::1]:8101)' can't be
established.
RSA key fingerprint is SHA256:g
RSA key fingerprint is MD5:fc:b5:ed:9
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:8101' (RSA) to the list of known
hosts.
Password authentication
Password:
__ __  
   / //_/ __ _/ __/
  / ,<  / __ `/ ___/ __ `/ /_
 / /| |/ /_/ / /  / /_/ / __/
/_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (4.2.0)

Hit '' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit 'system:shutdown' to shutdown Karaf.
Hit '' or type 'logout' to disconnect shell from current session.

karaf@root()> log:tail
17:39:21.456 INFO [activator-1-thread-2] Registering commands for bundle
org.apache.karaf.log.core/4.2.0



I hope this is of any help.

Kind Regards,
Miroslav



2018-07-24 17:34 GMT+02:00 Oleg Cohen :

> Hi Miroslav,
>
> Java is version 1.8
>
> ava version "1.8.0_172"
> Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
> Java HotSpot(TM) 64-Bit Server VM (build 

Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Oleg Cohen
Hi Miroslav,

Java is version 1.8

ava version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

Thank you!
Oleg


> On Jul 24, 2018, at 11:30 AM, Miroslav Beranič  
> wrote:
> 
> Hi Oleg,
> 
> one more question - what version of Java do you use?
> 
> Kind Regards,
> Miroslav
> 
> 
> 2018-07-24 17:28 GMT+02:00 Miroslav Beranič  >:
> Hi Oleg,
> 
> well, I've never installed from here ( I did not even looked before).
> Will try it for my self also. In Git repository I used 4.1.x and 4.2.x.
> 
> I guess 4.1.x is more "stable" for production. I've just started using 4.2. I 
> was on 4.0.9 till previous week. I am doing upgrade across nodes.
> 
> 
> Kind Regards,
> Miroslav
> 
> 
> 2018-07-24 17:21 GMT+02:00 Oleg Cohen  >:
> Hi Miroslav,
> 
> I got apache-karaf-4.2.0.tar.gz binary distribution from here 
> http://karaf.apache.org/download.html 
> 
> I can definitely try building from Git. Let me try …
> 
> Thank you!
> Oleg
> 
>> On Jul 24, 2018, at 11:17 AM, Miroslav Beranič > > wrote:
>> 
>> Hi Oleg,
>> 
>> where from did you deployed Karaf? You build it from the source or some 
>> pre-compiled package/distribution?
>> 
>> In general this is saying you are missing JAR ( but I guess you know already 
>> this ).
>> 
>> ( I've deployed multiple times - in past week - Karaf on RHEL 7.5 and I had 
>> no such problem - but I was building from the GitHub git repository )
>> 
>> Kind Regards,
>> Miroslav
>> 
>> 
>> 2018-07-24 17:11 GMT+02:00 Oleg Cohen > >:
>> Greetings,
>> 
>> I have deployed Karaf v4.2.0 into a Linux RH 7.5 server.
>> 
>> When I run Karaf as a service I get the following error in the log multiple 
>> times:
>> 
>> 
>> 2018-07-24T11:07:12,176 | ERROR | features-3-thread-1 | Felix
>> |  -  -  | Bundle org.apache.felix.framework [0] 
>> EventDispatcher: Error during dispatch. (java.lang.NoClassDefFoundError: 
>> org/apache/karaf/specs/locator/OsgiLocator)
>> java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
>>  at 
>> org.apache.karaf.specs.activator.Activator.register(Activator.java:124) 
>> ~[?:?]
>>  at 
>> org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96) 
>> ~[?:?]
>>  at 
>> org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>>  ~[?:?]
>>  at 
>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>>  ~[?:?]
>>  at 
>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>>  ~[?:?]
>>  at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) 
>> ~[?:?]
>>  at 
>> org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
>>  ~[?:?]
>>  at 
>> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
>>  ~[?:?]
>>  at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108) 
>> ~[?:?]
>>  at 
>> org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
>>  ~[?:?]
>>  at 
>> org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:240)
>>  ~[?:?]
>>  at 
>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1131)
>>  ~[?:?]
>>  at 
>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:982)
>>  ~[?:?]
>>  at 
>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
>>  ~[?:?]
>>  at 
>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
>>  ~[?:?]
>>  at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
>>  at 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>  [?:?]
>>  at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>  [?:?]
>>  at java.lang.Thread.run(Thread.java:748) [?:?]
>> 
>> I would appreciate help with fixing this problem of finding a workaround!
>> 
>> Best,
>> Oleg
>> 
>> 
>> 
>> -- 
>> Miroslav Beranič
>> MIBESIS
>> +386(0)40/814-843
>> miroslav.bera...@mibesis.si 
>> http://www.mibesis.si 
> 
> 
> 
> -- 
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> miroslav.bera...@mibesis.si 
> http://www.mibesis.si 
> 
> 
> -- 
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> miroslav.bera...@mibesis.si 
> http://www.mibesis.si 


Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Miroslav Beranič
Hi Oleg,

one more question - what version of Java do you use?

Kind Regards,
Miroslav


2018-07-24 17:28 GMT+02:00 Miroslav Beranič :

> Hi Oleg,
>
> well, I've never installed from here ( I did not even looked before).
> Will try it for my self also. In Git repository I used 4.1.x and 4.2.x.
>
> I guess 4.1.x is more "stable" for production. I've just started using
> 4.2. I was on 4.0.9 till previous week. I am doing upgrade across nodes.
>
>
> Kind Regards,
> Miroslav
>
>
> 2018-07-24 17:21 GMT+02:00 Oleg Cohen :
>
>> Hi Miroslav,
>>
>> I got apache-karaf-4.2.0.tar.gz binary distribution from here
>> http://karaf.apache.org/download.html
>>
>> I can definitely try building from Git. Let me try …
>>
>> Thank you!
>> Oleg
>>
>> On Jul 24, 2018, at 11:17 AM, Miroslav Beranič <
>> miroslav.bera...@mibesis.si> wrote:
>>
>> Hi Oleg,
>>
>> where from did you deployed Karaf? You build it from the source or some
>> pre-compiled package/distribution?
>>
>> In general this is saying you are missing JAR ( but I guess you know
>> already this ).
>>
>> ( I've deployed multiple times - in past week - Karaf on RHEL 7.5 and I
>> had no such problem - but I was building from the GitHub git repository )
>>
>> Kind Regards,
>> Miroslav
>>
>>
>> 2018-07-24 17:11 GMT+02:00 Oleg Cohen :
>>
>>> Greetings,
>>>
>>> I have deployed Karaf v4.2.0 into a Linux RH 7.5 server.
>>>
>>> When I run Karaf as a service I get the following error in the log
>>> multiple times:
>>>
>>>
>>> 2018-07-24T11:07:12,176 | ERROR | features-3-thread-1 | Felix
>>>  |  -  -  | Bundle org.apache.felix.framework [0]
>>> EventDispatcher: Error during dispatch. (*java.lang.NoClassDefFoundError:
>>> org/apache/karaf/specs/locator/OsgiLocator*)
>>> java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator
>>> /OsgiLocator
>>> at org.apache.karaf.specs.activator.Activator.register(Activator.java:124)
>>> ~[?:?]
>>> at 
>>> org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96)
>>> ~[?:?]
>>> at org.apache.felix.framework.EventDispatcher.invokeBundleListe
>>> nerCallback(EventDispatcher.java:915) ~[?:?]
>>> at 
>>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>>> ~[?:?]
>>> at 
>>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>>> ~[?:?]
>>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
>>> ~[?:?]
>>> at 
>>> org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
>>> ~[?:?]
>>> at 
>>> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
>>> ~[?:?]
>>> at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108)
>>> ~[?:?]
>>> at org.apache.felix.framework.FrameworkWiringImpl.resolveBundle
>>> s(FrameworkWiringImpl.java:133) ~[?:?]
>>> at org.apache.karaf.features.internal.service.BundleInstallSupp
>>> ortImpl.resolveBundles(BundleInstallSupportImpl.java:240) ~[?:?]
>>> at org.apache.karaf.features.internal.service.FeaturesServiceIm
>>> pl.resolveBundles(FeaturesServiceImpl.java:1131) ~[?:?]
>>> at 
>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:982)
>>> ~[?:?]
>>> at org.apache.karaf.features.internal.service.FeaturesServiceIm
>>> pl.doProvision(FeaturesServiceImpl.java:1025) ~[?:?]
>>> at org.apache.karaf.features.internal.service.FeaturesServiceIm
>>> pl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964) ~[?:?]
>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
>>> at 
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>> [?:?]
>>> at 
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>> [?:?]
>>> at java.lang.Thread.run(Thread.java:748) [?:?]
>>>
>>> I would appreciate help with fixing this problem of finding a workaround!
>>>
>>> Best,
>>> Oleg
>>>
>>
>>
>>
>> --
>> Miroslav Beranič
>> MIBESIS
>> +386(0)40/814-843
>> miroslav.bera...@mibesis.si
>> http://www.mibesis.si
>>
>>
>>
>
>
> --
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> miroslav.bera...@mibesis.si
> http://www.mibesis.si
>



-- 
Miroslav Beranič
MIBESIS
+386(0)40/814-843
miroslav.bera...@mibesis.si
http://www.mibesis.si


Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Miroslav Beranič
Hi Oleg,

well, I've never installed from here ( I did not even looked before).
Will try it for my self also. In Git repository I used 4.1.x and 4.2.x.

I guess 4.1.x is more "stable" for production. I've just started using 4.2.
I was on 4.0.9 till previous week. I am doing upgrade across nodes.


Kind Regards,
Miroslav


2018-07-24 17:21 GMT+02:00 Oleg Cohen :

> Hi Miroslav,
>
> I got apache-karaf-4.2.0.tar.gz binary distribution from here
> http://karaf.apache.org/download.html
>
> I can definitely try building from Git. Let me try …
>
> Thank you!
> Oleg
>
> On Jul 24, 2018, at 11:17 AM, Miroslav Beranič <
> miroslav.bera...@mibesis.si> wrote:
>
> Hi Oleg,
>
> where from did you deployed Karaf? You build it from the source or some
> pre-compiled package/distribution?
>
> In general this is saying you are missing JAR ( but I guess you know
> already this ).
>
> ( I've deployed multiple times - in past week - Karaf on RHEL 7.5 and I
> had no such problem - but I was building from the GitHub git repository )
>
> Kind Regards,
> Miroslav
>
>
> 2018-07-24 17:11 GMT+02:00 Oleg Cohen :
>
>> Greetings,
>>
>> I have deployed Karaf v4.2.0 into a Linux RH 7.5 server.
>>
>> When I run Karaf as a service I get the following error in the log
>> multiple times:
>>
>>
>> 2018-07-24T11:07:12,176 | ERROR | features-3-thread-1 | Felix
>>|  -  -  | Bundle org.apache.felix.framework [0]
>> EventDispatcher: Error during dispatch. (*java.lang.NoClassDefFoundError:
>> org/apache/karaf/specs/locator/OsgiLocator*)
>> java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator
>> /OsgiLocator
>> at org.apache.karaf.specs.activator.Activator.register(Activator.java:124)
>> ~[?:?]
>> at 
>> org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96)
>> ~[?:?]
>> at org.apache.felix.framework.EventDispatcher.invokeBundleListe
>> nerCallback(EventDispatcher.java:915) ~[?:?]
>> at 
>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>> ~[?:?]
>> at 
>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>> ~[?:?]
>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
>> ~[?:?]
>> at 
>> org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
>> ~[?:?]
>> at 
>> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
>> ~[?:?]
>> at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108)
>> ~[?:?]
>> at org.apache.felix.framework.FrameworkWiringImpl.resolveBundle
>> s(FrameworkWiringImpl.java:133) ~[?:?]
>> at org.apache.karaf.features.internal.service.BundleInstallSupp
>> ortImpl.resolveBundles(BundleInstallSupportImpl.java:240) ~[?:?]
>> at org.apache.karaf.features.internal.service.FeaturesServiceIm
>> pl.resolveBundles(FeaturesServiceImpl.java:1131) ~[?:?]
>> at 
>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:982)
>> ~[?:?]
>> at org.apache.karaf.features.internal.service.FeaturesServiceIm
>> pl.doProvision(FeaturesServiceImpl.java:1025) ~[?:?]
>> at org.apache.karaf.features.internal.service.FeaturesServiceIm
>> pl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964) ~[?:?]
>> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
>> at 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>> [?:?]
>> at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>> [?:?]
>> at java.lang.Thread.run(Thread.java:748) [?:?]
>>
>> I would appreciate help with fixing this problem of finding a workaround!
>>
>> Best,
>> Oleg
>>
>
>
>
> --
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> miroslav.bera...@mibesis.si
> http://www.mibesis.si
>
>
>


-- 
Miroslav Beranič
MIBESIS
+386(0)40/814-843
miroslav.bera...@mibesis.si
http://www.mibesis.si


Add descriptors & features to the features-maven-plugin in goal add-features-to-repo

2018-07-24 Thread fbergandi
Hello there !

My problem is that I have to deploy a kar file in a servicemix wich is in an
offline server.

To do that, I need to put all the needed features in a local repo in the
server to avoid downloading them. I want to use the features-maven-plugin
with the goal add-features-to-repo to acheive that.

The thing is that I need to specify descriptor that matches my feature and
I'm unable to find them. This is my actual config in the pom.xml of my
project :


org.apache.karaf.tooling
features-maven-plugin
${plugin.maven.feature}


add-features-to-repo
generate-resources

add-features-to-repo




mvn:org.ops4j.pax.jdbc/pax-jdbc-features/1.0.1/xml/features

mvn:org.apache.karaf.features/standard/4.0.9/xml/features

mvn:org.apache.karaf.features/enterprise/4.0.9/xml/features

mvn:org.apache.karaf.features/framework/4.0.9/xml/features
 

mvn:org.apache.karaf.features/spring/4.0.9/xml/features


mvn:org.apache.karaf.features/static/4.0.9/xml/features


jndi
pax-jdbc
pax-jdbc-spec
pax-jdbc-oracle
pax-jdbc-config
pax-jdbc-pool-dbcp2
jpa
transaction
jdbc
hibernate

target/features-repo





I can build without errors my project, but when I put the .kar in the deploy
directory of servicemix and change the property
org.ops4j.pax.url.mvn.localRepository to my features-repo in the file
org.ops4j.pax.url.mvn.cfg in etc directory, I get this error :

org.apache.karaf.features.internal.util.MultiException: Error
at
org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.(MavenDownloadManager.java:84)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:72)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:363)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:360)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:187)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:259)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)[8:org.apache.karaf.features.core:4.0.9]
at
java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_151]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_151]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_151]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_151]
Caused by: java.util.zip.ZipException: invalid code lengths set
at
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)[:1.8.0_151]
at
java.util.zip.ZipInputStream.read(ZipInputStream.java:194)[:1.8.0_151]
at
java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:140)[:1.8.0_151]
at
java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:118)[:1.8.0_151]
at
org.apache.karaf.features.internal.region.Subsystem.getMetadata(Subsystem.java:526)[8:org.apache.karaf.features.core:4.0.9]
at
org.apache.karaf.features.internal.region.Subsystem$1.downloaded(Subsystem.java:390)[8:org.apache.karaf.features.core:4.0.9]
at

Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Oleg Cohen
Hi Miroslav,

I got apache-karaf-4.2.0.tar.gz binary distribution from here 
http://karaf.apache.org/download.html 

I can definitely try building from Git. Let me try …

Thank you!
Oleg

> On Jul 24, 2018, at 11:17 AM, Miroslav Beranič  
> wrote:
> 
> Hi Oleg,
> 
> where from did you deployed Karaf? You build it from the source or some 
> pre-compiled package/distribution?
> 
> In general this is saying you are missing JAR ( but I guess you know already 
> this ).
> 
> ( I've deployed multiple times - in past week - Karaf on RHEL 7.5 and I had 
> no such problem - but I was building from the GitHub git repository )
> 
> Kind Regards,
> Miroslav
> 
> 
> 2018-07-24 17:11 GMT+02:00 Oleg Cohen  >:
> Greetings,
> 
> I have deployed Karaf v4.2.0 into a Linux RH 7.5 server.
> 
> When I run Karaf as a service I get the following error in the log multiple 
> times:
> 
> 
> 2018-07-24T11:07:12,176 | ERROR | features-3-thread-1 | Felix 
>|  -  -  | Bundle org.apache.felix.framework [0] EventDispatcher: 
> Error during dispatch. (java.lang.NoClassDefFoundError: 
> org/apache/karaf/specs/locator/OsgiLocator)
> java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
>   at 
> org.apache.karaf.specs.activator.Activator.register(Activator.java:124) ~[?:?]
>   at 
> org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96) 
> ~[?:?]
>   at 
> org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>  ~[?:?]
>   at 
> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>  ~[?:?]
>   at 
> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>  ~[?:?]
>   at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) 
> ~[?:?]
>   at 
> org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
>  ~[?:?]
>   at 
> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
>  ~[?:?]
>   at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108) 
> ~[?:?]
>   at 
> org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
>  ~[?:?]
>   at 
> org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:240)
>  ~[?:?]
>   at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1131)
>  ~[?:?]
>   at 
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:982) 
> ~[?:?]
>   at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
>  ~[?:?]
>   at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
>  ~[?:?]
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  [?:?]
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  [?:?]
>   at java.lang.Thread.run(Thread.java:748) [?:?]
> 
> I would appreciate help with fixing this problem of finding a workaround!
> 
> Best,
> Oleg
> 
> 
> 
> -- 
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> miroslav.bera...@mibesis.si 
> http://www.mibesis.si 


Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Miroslav Beranič
Hi Oleg,

where from did you deployed Karaf? You build it from the source or some
pre-compiled package/distribution?

In general this is saying you are missing JAR ( but I guess you know
already this ).

( I've deployed multiple times - in past week - Karaf on RHEL 7.5 and I had
no such problem - but I was building from the GitHub git repository )

Kind Regards,
Miroslav


2018-07-24 17:11 GMT+02:00 Oleg Cohen :

> Greetings,
>
> I have deployed Karaf v4.2.0 into a Linux RH 7.5 server.
>
> When I run Karaf as a service I get the following error in the log
> multiple times:
>
>
> 2018-07-24T11:07:12,176 | ERROR | features-3-thread-1 | Felix
>|  -  -  | Bundle org.apache.felix.framework [0]
> EventDispatcher: Error during dispatch. (*java.lang.NoClassDefFoundError:
> org/apache/karaf/specs/locator/OsgiLocator*)
> java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
> at org.apache.karaf.specs.activator.Activator.register(Activator.java:124)
> ~[?:?]
> at org.apache.karaf.specs.activator.Activator.
> bundleChanged(Activator.java:96) ~[?:?]
> at org.apache.felix.framework.EventDispatcher.
> invokeBundleListenerCallback(EventDispatcher.java:915) ~[?:?]
> at 
> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
> ~[?:?]
> at 
> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
> ~[?:?]
> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
> ~[?:?]
> at 
> org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
> ~[?:?]
> at 
> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
> ~[?:?]
> at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108) ~[?:?]
> at 
> org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
> ~[?:?]
> at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.
> resolveBundles(BundleInstallSupportImpl.java:240) ~[?:?]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> resolveBundles(FeaturesServiceImpl.java:1131) ~[?:?]
> at 
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:982)
> ~[?:?]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl.
> doProvision(FeaturesServiceImpl.java:1025) ~[?:?]
> at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$
> doProvisionInThread$13(FeaturesServiceImpl.java:964) ~[?:?]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
> at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:?]
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:?]
> at java.lang.Thread.run(Thread.java:748) [?:?]
>
> I would appreciate help with fixing this problem of finding a workaround!
>
> Best,
> Oleg
>



-- 
Miroslav Beranič
MIBESIS
+386(0)40/814-843
miroslav.bera...@mibesis.si
http://www.mibesis.si


java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

2018-07-24 Thread Oleg Cohen
Greetings,

I have deployed Karaf v4.2.0 into a Linux RH 7.5 server.

When I run Karaf as a service I get the following error in the log multiple 
times:


2018-07-24T11:07:12,176 | ERROR | features-3-thread-1 | Felix   
 |  -  -  | Bundle org.apache.felix.framework [0] EventDispatcher: 
Error during dispatch. (java.lang.NoClassDefFoundError: 
org/apache/karaf/specs/locator/OsgiLocator)
java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
at 
org.apache.karaf.specs.activator.Activator.register(Activator.java:124) ~[?:?]
at 
org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96) 
~[?:?]
at 
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
 ~[?:?]
at 
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
 ~[?:?]
at 
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
 ~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) 
~[?:?]
at 
org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
 ~[?:?]
at 
org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512) 
~[?:?]
at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108) 
~[?:?]
at 
org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
 ~[?:?]
at 
org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:240)
 ~[?:?]
at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1131)
 ~[?:?]
at 
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:982) 
~[?:?]
at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
 ~[?:?]
at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
 ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
[?:?]
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

I would appreciate help with fixing this problem of finding a workaround!

Best,
Oleg

Re: Examples of using Jersey with pax web whiteboard extender?

2018-07-24 Thread Tim Ward
Would it not be easier to:

Use the Http Service Whiteboard support for resource serving, rather than 
having the ReactServlet? That’s a big bit of boilerplate for serving some 
static content. It should be much simpler using component 
properties/annotations - see 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121459
 

Use the JAX-RS whiteboard to directly register a JAX-RS resource, avoiding the 
need to teach people about launching Jersey (something that they probably care 
very little about). It’s really very simple to do - see 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#service.jaxrs.resource.services
 

 

Using those features should be able to make the example more concise and 
compelling.

Best Regards,

Tim

> On 23 Jul 2018, at 20:19, Steinar Bang  wrote:
> 
>> Jean-Baptiste Onofré :
> 
>> Not using Jersey but cxfrs.
>> I can add this new example using jersey.
> 
> If you want, and tell me where to put it, I can whip up an example and
> provide a pull request?
> 
> Basically this Counter example with Jersey instead of implementing the
> REST service directly in a servlet (and the packages switched to
> something appropriate for karaf examples):
> https://github.com/steinarb/frontend-karaf-demo
> 
> That would demonstrate in addition to Jersey:
> - http whiteboard with DS
> - serving a react.js application from a DS component karaf, packaged
>   with webpack into a bundle.js file
> 
> Alternatively this one with the REST service implemented in a servlet
> replaced with a Jersey resource?
> https://github.com/steinarb/whiteboard-web-and-api-karaf-demo
> 
> The latter example has a very simple plain javascript app embdedded in
> an index.html file.  This can easily be replaced by a webpack'd react.js
> application if of interest.
> 
> The latter example is already split into two separate bundles.  To make
> things really interesting it would be good to delegate the actual
> counting into an OSGi service that can be injected into the Jersey
> resources, making it have a total of 4 bundles (an API bundle defining
> the service, a bundle implementing the service in a DS component, a
> webapi bundle using Jersey and injecting the service from the DS
> component into Jersey resources, and a webgui bundle (that can be
> changed into a react.js app).
> 



Re: Apache Karaf 4.x JPA - Working example

2018-07-24 Thread Miroslav Beranič
Hi,

so in the log ( log:tail ) I've seen this:

ERROR [Karaf local console user karaf] Exception caught while executing
command
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root:
missing requirement [root] osgi.identity;
osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))"
[caused by: Unable to resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT:
missing requirement [karaf-jpa-example-provider/4.2.1.SNAPSHOT]
osgi.identity; osgi.identity=karaf-jpa-example-common; type=karaf.feature;
version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]" [caused by: Unable to resolve
karaf-jpa-example-common/4.2.1.SNAPSHOT: missing requirement
[karaf-jpa-example-common/4.2.1.SNAPSHOT] osgi.identity;
osgi.identity=hibernate; type=karaf.feature;
version="[6.0.10.Final,6.0.10.Final]"]]
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
~[?:?]
at
org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392)
~[?:?]
at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378) ~[?:?]
at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332) ~[?:?]
at
org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
~[?:?]
at
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
~[?:?]
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
~[?:?]
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
~[?:?]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT: missing requirement
[karaf-jpa-example-provider/4.2.1.SNAPSHOT] osgi.identity;
osgi.identity=karaf-jpa-example-common; type=karaf.feature;
version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]" [caused by: Unable to resolve
karaf-jpa-example-common/4.2.1.SNAPSHOT: missing requirement
[karaf-jpa-example-common/4.2.1.SNAPSHOT] osgi.identity;
osgi.identity=hibernate; type=karaf.feature;
version="[6.0.10.Final,6.0.10.Final]"]
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
~[?:?]
... 12 more
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
resolve karaf-jpa-example-common/4.2.1.SNAPSHOT: missing requirement
[karaf-jpa-example-common/4.2.1.SNAPSHOT] osgi.identity;
osgi.identity=hibernate; type=karaf.feature;
version="[6.0.10.Final,6.0.10.Final]"
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
~[?:?]
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
~[?:?]
... 12 more

What it says is ( how I understand it ) : Hibernate 6.0.10.Final is missing
( as I said in first email ) This version of Hibernate does not exists - it
is not release yet, as the latest version released is 5.3.2.Final . It is
the Hibernate Validator, that is of version 6.0.10.Final  ( release date of
2018-05-15 ) ( please see: http://hibernate.org/validator/releases/6.0/ ).


Hibernate 6 is made reference in file:
https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml

as hibernate

I guess, this is wrong.

OK, so I changed to hibernate . Maven
clean install ( inside examples folder ) and started Karaf again with:

$ JAVA_HOME=/opt/jdk ./bin/karaf clean debug


And after this change I get this error :

ERROR [Karaf local console user karaf] Exception caught while executing
command
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root:
missing requirement [root] osgi.identity;
osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))"
[caused by: Unable to resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT:
missing requirement [karaf-jpa-example-provider/4.2.1.SNAPSHOT]
osgi.identity;
osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve
org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
missing requirement
[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
osgi.service; 

Re: Apache Karaf 4.x JPA - Working example

2018-07-24 Thread Jean-Baptiste Onofré
Thanks for the report.

Let me double check.

Regards
JB

Le 24 juil. 2018 à 09:42, à 09:42, "Miroslav Beranič" 
 a écrit:
>Hi,
>
>dear Jean-Baptiste Onofré. I am talking about this repository. It does
>not
>work.
>
>I've checked out https://github.com/jbonofre/karaf/tree/DEV_GUIDE
>
>$ git clone -b DEV_GUIDE
>https://github.com/jbonofre/karaf/tree/DEV_GUIDE
>karaf_dev_guide
>
>Build it with maven:
>
>$ mvn -DskipTests -Pfastinstall clean install
>
>Went to the distribution/assembly:
>
>$ cd assemblies/apache-karaf/target/assembly/
>
>and started Karaf from here:
>
>$ JAVA_HOME=/opt/jdk ./bin/karaf debug
>Listening for transport dt_socket at address: 5005
>__ __  
>   / //_/ __ _/ __/
>  / ,<  / __ `/ ___/ __ `/ /_
> / /| |/ /_/ / /  / /_/ / __/
>/_/ |_|\__,_/_/   \__,_/_/
>
>  Apache Karaf (4.2.1-SNAPSHOT)
>
>From here, first and only thing I do is:
>
>karaf@root()> feature:repo-add
>mvn:org.apache.karaf.examples/karaf-jpa-example-features/4.2.1-SNAPSHOT/xml
>karaf@root()> feature:install
>karaf-jpa-example-datasource
>
>karaf@root()> feature:install karaf-jpa-example-provider
>org.apache.felix.resolver.reason.ReasonException: Unable to resolve
>root:
>missing requirement [root] osgi.identity;
>osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
>version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
>filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))"
>[caused by: Unable to resolve
>karaf-jpa-example-provider/4.2.1.SNAPSHOT:
>missing requirement [karaf-jpa-example-provider/4.2.1.SNAPSHOT]
>osgi.identity;
>osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
>type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
>resolution:=mandatory [caused by: Unable to resolve
>org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
>missing requirement
>[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
>osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
>javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
>effective:=active]]
>at
>org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
>at
>org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392)
>at
>org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378)
>at
>org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332)
>at
>org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
>at
>org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
>at
>org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
>at
>org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
>at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>at
>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>at
>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>at java.lang.Thread.run(Thread.java:748)
>Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
>resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT: missing requirement
>[karaf-jpa-example-provider/4.2.1.SNAPSHOT] osgi.identity;
>osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
>type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
>resolution:=mandatory [caused by: Unable to resolve
>org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
>missing requirement
>[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
>osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
>javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
>effective:=active]
>at
>org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
>... 12 more
>Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
>resolve
>org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
>missing requirement
>[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
>osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
>javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
>effective:=active
>at
>org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
>... 13 more
>Error executing command: Unable to resolve root: missing requirement
>[root]
>osgi.identity; osgi.identity=karaf-jpa-example-provider;
>type=karaf.feature; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
>filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))"
>[caused by: Unable to resolve

Re: Apache Karaf 4.x JPA - Working example

2018-07-24 Thread Miroslav Beranič
Hi,

dear Jean-Baptiste Onofré. I am talking about this repository. It does not
work.

I've checked out https://github.com/jbonofre/karaf/tree/DEV_GUIDE

$ git clone -b DEV_GUIDE https://github.com/jbonofre/karaf/tree/DEV_GUIDE
karaf_dev_guide

Build it with maven:

$ mvn -DskipTests -Pfastinstall clean install

Went to the distribution/assembly:

$ cd assemblies/apache-karaf/target/assembly/

and started Karaf from here:

$ JAVA_HOME=/opt/jdk ./bin/karaf debug
Listening for transport dt_socket at address: 5005
__ __  
   / //_/ __ _/ __/
  / ,<  / __ `/ ___/ __ `/ /_
 / /| |/ /_/ / /  / /_/ / __/
/_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (4.2.1-SNAPSHOT)

>From here, first and only thing I do is:

karaf@root()> feature:repo-add
mvn:org.apache.karaf.examples/karaf-jpa-example-features/4.2.1-SNAPSHOT/xml
karaf@root()> feature:install
karaf-jpa-example-datasource

karaf@root()> feature:install karaf-jpa-example-provider
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root:
missing requirement [root] osgi.identity;
osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))"
[caused by: Unable to resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT:
missing requirement [karaf-jpa-example-provider/4.2.1.SNAPSHOT]
osgi.identity;
osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve
org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
missing requirement
[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
effective:=active]]
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
at
org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392)
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378)
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332)
at
org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
at
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT: missing requirement
[karaf-jpa-example-provider/4.2.1.SNAPSHOT] osgi.identity;
osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve
org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
missing requirement
[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
effective:=active]
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
... 12 more
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to
resolve
org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT:
missing requirement
[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT]
osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
effective:=active
at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
... 13 more
Error executing command: Unable to resolve root: missing requirement [root]
osgi.identity; osgi.identity=karaf-jpa-example-provider;
type=karaf.feature; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";
filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))"
[caused by: Unable to resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT:
missing requirement [karaf-jpa-example-provider/4.2.1.SNAPSHOT]
osgi.identity;
osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]";