Re: JPA (Hibernate) with Apache Karaf 4.2

2018-06-05 Thread Kerry

Alex,

Yes exactly as François says. I was trying to find a mail post/stackoverflow 
question I asked on exactly the same thing but unfortunately I couldn't find it.


On 05/06/18 04:36, Francois Papon wrote:

Hi Alex,

I think it's because you are mixing Blueprint and SCR.

The @Reference annotation is used by SCR.

François Papon
fpa...@apache.org
Open3m - https://www.open3m.io

Le 05/06/2018 à 00:13, alex09 a écrit :

Hi Kerry,

nice examples, I like playing around with this and it's well structured and
comprehensible. Just for interest:
I realised that it doesn't matter here
 @Reference(optional = false)
 private BookServiceDao bookService;
what I put in the DAO as optional, all bundles are always ACTIVE, but if I
exclude the DAO from the blueprint, the command is (correctly) not
recognized in the Karaf console, still the bundle is ACTIVE (in the log, the
service is waiting: Command registration delayed for bundle
com.javatechnics.jpa.simple-commands/1.0.0.SNAPSHOT. Missing dependencies:
[com.javatechnics.jpa.dao.BookServiceDao])
Do you know why optional doesn't work in this case? Where can I address
these questions?

Thanks!

Alex




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






Re: Karaf 4.2.0: java.util.concurrent.TimeoutException: null

2018-06-05 Thread Joery Vreijsen
Hi JB!

Did you find any time to look at it?

—

Joery

https://theguild.nl
On 4 Jun 2018, 06:15 +0200, Jean-Baptiste Onofré , wrote:
> Hi,
>
> Let me check if we change the timeout on the Camel and Aries Blueprint
> sides.
>
> It could be related to your inflight messages too, if they don't reach
> the onCompletion quickly.
>
> Regards
> JB
>
> On 03/06/2018 19:39, Joery Vreijsen wrote:
> >
> > Hi,
> >
> > Correct, when I change the time-out in the Camel DefaultShutdownStrategy to 
> > 30 seconds (staying within the blueprint container timeout) the exception 
> > went away.
> >
> > I’m just curious of why this seems to be a problem now as, if i recall 
> > correctly, it worked before.
> >
> > Before, i mean when i upgraded our application from Karaf 4.0.4 to 4.2.0, 
> > and Camel from 2.18.3 to 2.20.1.
> >
> > Thanks for the input so far!
> >
> > —
> >
> > Joery
> >
> > > On 3 Jun 2018, at 18:47, Jean-Baptiste Onofré  wrote:
> > >
> > > So, it seems that you have inflight messages and shutdown strategy are
> > > longer then the blueprint container timeout.
> > >
> > > I would start to change the shutdown strategy to be a little bit more
> > > aggressive.
> > >
> > > Regards
> > > JB
> > >
> > > > On 03/06/2018 17:31, Joery Vreijsen wrote:
> > > > Hi!
> > > >
> > > > Thanks for the quick response, yes I used the DefaultShutdownStrategy of
> > > > Apache Camel 2.21.1.
> > > >
> > > > —
> > > >
> > > > Joery
> > > > > On 3 Jun 2018, 17:24 +0200, Jean-Baptiste Onofré , 
> > > > > wrote:
> > > > > Hi
> > > > >
> > > > > do you use the default Camel graceful shutdown strategy or a custom 
> > > > > one ?
> > > > >
> > > > > Regards
> > > > > JB
> > > > >
> > > > > > On 02/06/2018 22:17, Joery Vreijsen wrote:
> > > > > > Hi there!
> > > > > >
> > > > > > I’m running into a weird issue regarding some timeouts when 
> > > > > > uninstalling
> > > > > > a CamelContext in Karaf 4.2.0.
> > > > > > Due to the fact that i’m not entirely sure if this is a Camel or 
> > > > > > Karaf
> > > > > > issue, but the exception is thrown from inside Karaf i’m going to 
> > > > > > try it
> > > > > > here first.
> > > > > >
> > > > > > I am installing a Camel Context in Karaf using a blueprint.xml. Say 
> > > > > > a
> > > > > > route in this context has a syntax error in it, and when it’s still
> > > > > > running i’m trying to uninstall the bundle in Karaf.
> > > > > > The result is correct, i get the inflight message from Camel with 
> > > > > > the
> > > > > > note saying it’s going to timeout in 5 minutes (300 seconds):
> > > > > >
> > > > > > /[Camel (context-1) thread #1 - ShutdownTask] Waiting as there are 
> > > > > > still
> > > > > > 3 inflight and pending exchanges to complete, timeout in 295 
> > > > > > seconds.
> > > > > > Inflights per route: [route-3 = 1, route-2 = 1, route-1 = 1]
> > > > > > [Camel (context-1) thread #1 - ShutdownTask] There are 2 inflight
> > > > > > exchanges:
> > > > > > InflightExchange: [exchangeId=ID-mac-local-1527969270260-1-1,
> > > > > > fromRouteId=route-1, routeId=route-2, nodeId=split2, elapsed=0,
> > > > > > duration=71634]
> > > > > > InflightExchange: [exchangeId=ID-mac-local-1527969270260-1-3,
> > > > > > fromRouteId=route-1, routeId=route-3, nodeId=to6, elapsed=0,
> > > > > > duration=71634]/
> > > > > >
> > > > > > But after exactly one minute (consistently) the graceful shutdown
> > > > > > procedure of camel is interrupted and the following appears in the 
> > > > > > logs:
> > > > > >
> > > > > > /WARN [Blueprint Event Dispatcher: 1] Timeout occurred during 
> > > > > > graceful
> > > > > > shutdown. Forcing the routes to be shutdown now. Notice: some 
> > > > > > resources
> > > > > > may still be running as graceful shutdown did not complete 
> > > > > > successfully.
> > > > > > WARN [pipe-bundle:uninstall 110] Listener timed out, will be ignored
> > > > > > java.util.concurrent.TimeoutException: null
> > > > > > at
> > > > > > java.util.concurrent.AbstractExecutorService.doInvokeAny(AbstractExecutorService.java:184)
> > > > > > ~[?:?]
> > > > > > at
> > > > > > java.util.concurrent.AbstractExecutorService.invokeAny(AbstractExecutorService.java:225)
> > > > > > ~[?:?]
> > > > > > at
> > > > > > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$4.call(ScheduledExecutorServiceWrapper.java:182)
> > > > > > ~[45:org.apache.aries.blueprint.core:1.9.0]
> > > > > > at
> > > > > > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$15.call(ScheduledExecutorServiceWrapper.java:443)
> > > > > > ~[45:org.apache.aries.blueprint.core:1.9.0]
> > > > > > at
> > > > > > org.apache.aries.blueprint.utils.threading.RWLock.runReadOperation(RWLock.java:33)
> > > > > > ~[45:org.apache.aries.blueprint.core:1.9.0]
> > > > > > at
> > > > > > org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.runUnlessShutdown(ScheduledExecutorServiceWrapper.java:440)
> > > > > > ~[45:org.apache.aries.blueprint.core:1.9.0]
> > > > > > at
> > 

Re: Blueprint/JPA : Need active coordination error

2018-06-05 Thread Jean-Baptiste Onofré
Hi,

Guillaume started the Aries vote yesterday.

I created the Jira to update in Karaf:

https://issues.apache.org/jira/browse/KARAF-5776

It will be included in 4.2.1 (with docker and examples as well).

Regards
JB

On 05/06/2018 10:08, DUTERTRY Nicolas wrote:
> Hi,
> 
> The issue ARIES-1793 has been closed in Aries and the correction is available 
> in org.apache.aries.blueprint.core-1.10.0.
> 
> Is it possible to include the new blueprint core version in the next Karaf 
> 4.2.1 ?
> 
> Regards, 
> --
> Nicolas Dutertry
> 
> -Message d'origine-
> De : Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
> Envoyé : lundi 14 mai 2018 11:12
> À : user@karaf.apache.org
> Objet : Re: Blueprint/JPA : Need active coordination error
> 
> Ooops, I forgot this one :/
> 
> Sorry about that. I'm adding to my daily TODO.
> 
> Regards
> JB
> 
> On 05/14/2018 11:02 AM, DUTERTRY Nicolas wrote:
>> Hi JB,
>>
>>  
>>
>> Do you have any update on that issue ?
>>
>>  
>>
>> Regards,
>>
>> --
>>
>> Nicolas Dutertry
>>
>>  
>>
>> *De :*Jean-Baptiste Onofré [mailto:j...@nanthrax.net]
>> *Envoyé :* lundi 23 avril 2018 13:29
>> *À :* user@karaf.apache.org
>> *Cc :* user@karaf.apache.org
>> *Objet :* RE: Blueprint/JPA : Need active coordination error
>>
>>  
>>
>> Thanks.
>>
>> I'm still in vacation for a couple of days. I will take a look end of this 
>> week
>> when back.
>>
>> Regards
>>
>> JB
>>
>> Le 23 avr. 2018, à 15:16, DUTERTRY Nicolas > > a écrit:
>>
>> Hi,
>>
>> I have opened an issue in aries jira : 
>> https://issues.apache.org/jira/browse/ARIES-1793
>>
>> Regards,
>> --
>> Nicolas Dutertry
>>
>> -Message d'origine-
>> De : Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
>> Envoyé : jeudi 12 avril 2018 14:38
>> À : user@karaf.apache.org
>> Objet : Re: Blueprint/JPA : Need active coordination error
>>
>> Thanks I will take a look asap (I'm in vacation now ;)).
>>
>> Regards
>> JB
>>
>> On 04/12/2018 02:03 PM, DUTERTRY Nicolas wrote:
>>
>>  Here is full stack trace :
>>  
>>  java.lang.IllegalStateException: Need active coordination
>>   at org.apache.aries.jpa.support 
>> .impl.EMSupplierImpl.get(EMSupplierImpl.java:81)
>>  ~[?:?]
>>   at org.apache.aries.jpa.support 
>> .osgi.impl.EmProxy.invoke(EmProxy.java:38)
>>  ~[?:?]
>>   at com.sun.proxy.$Proxy77.createQuery(Unknown Source) ~[?:?]
>>   at Proxy4c2993b8_dc6f_46b4_8e62_524dc0ad05f5.createQuery(Unknown Source) 
>> ~[?:?]
>>   at 
>> com.dutertry.test.karaf.jpa.service.impl.TestRepository.list(TestRepository.java:26)
>>  ~[?:?]
>>   at 
>> com.dutertry.test.karaf.jpa.service.impl.TestServiceImpl.list(TestServiceImpl.java:25)
>>  ~[?:?]
>>   at 
>> com.dutertry.test.karaf.jpa.cmd.ListPersonCommand.execute(ListPersonCommand.java:24)
>>  ~[?:?]
>>   at 
>> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
>>  ~[?:?]
>>   at 
>> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
>>  ~[?:?]
>>   at 
>> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
>>  ~[?:?]
>>   at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:571) 
>> ~[?:?]
>>   at 
>> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:497) 
>> ~[?:?]
>>   at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:386) ~[?:?]
>>   at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) ~[?:?]
>>   at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
>>   at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
>>   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) [?:?]
>>  
>>  --
>>  Nicolas Dutertry
>>  
>>  
>>  -Message d'origine-
>>  De : Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
>>  Envoyé : jeudi 12 avril 2018 13:51
>>  À : user@karaf.apache.org
>>  Objet : Re: Blueprint/JPA : Need active coordination error
>>  
>>  Hi Nicolas,
>>  
>>  I'm surprised it's not a proxy: it should be a Aries Proxy.
>>  
>>  Where the ISE is coming from ?
>>  
>>  Regards
>>  JB
>>  
>>  On 04/12/2018 01:47 PM, DUTERTRY Nicolas wrote:
>>
>>  Hi,
>>
>>   
>>
>>  Yesterday I ran into an error with the new Karaf 4.2.0. This error 
>>  seems to be related to blueprint 1.9.0 (the error does not occur in Karaf 
>> 4.1.5).
>>
>>   
>>
>>  I have committed a project on Github to illustrate the issue :
>>  https://github.com/nicolas-dutertry/test-jpa
>>
>>   
>>
>>  This project contains a blueprint bundle with a bean TestRepository 
>>  annotated with @PersistenceContext. This bean is then injected into 
>>  another bean TestServiceImpl which is 

RE: Blueprint/JPA : Need active coordination error

2018-06-05 Thread DUTERTRY Nicolas
Hi,

The issue ARIES-1793 has been closed in Aries and the correction is available 
in org.apache.aries.blueprint.core-1.10.0.

Is it possible to include the new blueprint core version in the next Karaf 
4.2.1 ?

Regards, 
--
Nicolas Dutertry

-Message d'origine-
De : Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
Envoyé : lundi 14 mai 2018 11:12
À : user@karaf.apache.org
Objet : Re: Blueprint/JPA : Need active coordination error

Ooops, I forgot this one :/

Sorry about that. I'm adding to my daily TODO.

Regards
JB

On 05/14/2018 11:02 AM, DUTERTRY Nicolas wrote:
> Hi JB,
> 
>  
> 
> Do you have any update on that issue ?
> 
>  
> 
> Regards,
> 
> --
> 
> Nicolas Dutertry
> 
>  
> 
> *De :*Jean-Baptiste Onofré [mailto:j...@nanthrax.net]
> *Envoyé :* lundi 23 avril 2018 13:29
> *À :* user@karaf.apache.org
> *Cc :* user@karaf.apache.org
> *Objet :* RE: Blueprint/JPA : Need active coordination error
> 
>  
> 
> Thanks.
> 
> I'm still in vacation for a couple of days. I will take a look end of this 
> week
> when back.
> 
> Regards
> 
> JB
> 
> Le 23 avr. 2018, à 15:16, DUTERTRY Nicolas  > a écrit:
> 
> Hi,
> 
> I have opened an issue in aries jira : 
> https://issues.apache.org/jira/browse/ARIES-1793
> 
> Regards,
> --
> Nicolas Dutertry
> 
> -Message d'origine-
> De : Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
> Envoyé : jeudi 12 avril 2018 14:38
> À : user@karaf.apache.org
> Objet : Re: Blueprint/JPA : Need active coordination error
> 
> Thanks I will take a look asap (I'm in vacation now ;)).
> 
> Regards
> JB
> 
> On 04/12/2018 02:03 PM, DUTERTRY Nicolas wrote:
> 
>  Here is full stack trace :
>  
>  java.lang.IllegalStateException: Need active coordination
>   at org.apache.aries.jpa.support 
> .impl.EMSupplierImpl.get(EMSupplierImpl.java:81)
>  ~[?:?]
>   at org.apache.aries.jpa.support 
> .osgi.impl.EmProxy.invoke(EmProxy.java:38)
>  ~[?:?]
>   at com.sun.proxy.$Proxy77.createQuery(Unknown Source) ~[?:?]
>   at Proxy4c2993b8_dc6f_46b4_8e62_524dc0ad05f5.createQuery(Unknown Source) 
> ~[?:?]
>   at 
> com.dutertry.test.karaf.jpa.service.impl.TestRepository.list(TestRepository.java:26)
>  ~[?:?]
>   at 
> com.dutertry.test.karaf.jpa.service.impl.TestServiceImpl.list(TestServiceImpl.java:25)
>  ~[?:?]
>   at 
> com.dutertry.test.karaf.jpa.cmd.ListPersonCommand.execute(ListPersonCommand.java:24)
>  ~[?:?]
>   at 
> org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
>  ~[?:?]
>   at 
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
>  ~[?:?]
>   at 
> org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
>  ~[?:?]
>   at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:571) ~[?:?]
>   at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:497) 
> ~[?:?]
>   at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:386) ~[?:?]
>   at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) ~[?:?]
>   at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
>   at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
>   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) [?:?]
>  
>  --
>  Nicolas Dutertry
>  
>  
>  -Message d'origine-
>  De : Jean-Baptiste Onofré [mailto:j...@nanthrax.net] 
>  Envoyé : jeudi 12 avril 2018 13:51
>  À : user@karaf.apache.org
>  Objet : Re: Blueprint/JPA : Need active coordination error
>  
>  Hi Nicolas,
>  
>  I'm surprised it's not a proxy: it should be a Aries Proxy.
>  
>  Where the ISE is coming from ?
>  
>  Regards
>  JB
>  
>  On 04/12/2018 01:47 PM, DUTERTRY Nicolas wrote:
> 
>  Hi,
> 
>   
> 
>  Yesterday I ran into an error with the new Karaf 4.2.0. This error 
>  seems to be related to blueprint 1.9.0 (the error does not occur in Karaf 
> 4.1.5).
> 
>   
> 
>  I have committed a project on Github to illustrate the issue :
>  https://github.com/nicolas-dutertry/test-jpa
> 
>   
> 
>  This project contains a blueprint bundle with a bean TestRepository 
>  annotated with @PersistenceContext. This bean is then injected into 
>  another bean TestServiceImpl which is then published as an osgi service :
> 
>     
> 
>  
> 
>      
> 
>     
> 
>  
> 
>        class="com.dutertry.test.karaf.jpa.service.impl.TestRepository"/>
> 
>     
> 
>    class="com.dutertry.test.karaf.jpa.service.impl.TestServiceImpl">
> 
>      
> 
>      
> 
>     
> 
>    ref="testService"/>
> 
>   
> 
>  With Karaf 4.1.5 the instance of TestRepository injected in 
>  testService is a proxy managing JPA