Re: Camel on Karaf looking to resolve http://camel.apache.org/schema/spring/v${camel.schema.version}

2017-03-13 Thread Niels Bertram
Bug number for the discussed problem with camel-spring 2.18.x installed
artefacts is https://issues.apache.org/jira/browse/CAMEL-11009 if anyone
wants to follow it.

On Mon, Mar 13, 2017 at 10:25 PM, Niels Bertram  wrote:

> Makes sense what you are saying. I just installed camel 2.18.2 components
> and by the looks of it, it is a packaging failure in camel-spring.
>
> 1. install camel feature on Karaf 4.0.8 (also tested 4.1.0):
>
> feature:repo-add camel 2.18.2
> feature:install camel
>
> 2. install some route that uses blueprint and camel blueprint schema
>
> Looking at http://search.maven.org/remotecontent?filepath=org/
> apache/camel/camel-spring/2.18.2/camel-spring-2.18.2.jar
>
> I can see that file /META-INF/spring.schemas shows following:
>
> #
> # Licensed to the Apache Software Foundation (ASF) under one or more
> # contributor license agreements.  See the NOTICE file distributed with
> ...
> http\://camel.apache.org/schema/spring=camel-spring.xsd
> http\://camel.apache.org/schema/spring/v${camel.schema.
> version}=camel-spring-v${camel.schema.version}.xsd
> <http://camel.apache.org/schema/spring/v$%7Bcamel.schema.version%7D=camel-spring-v$%7Bcamel.schema.version%7D.xsd>
>
> Its actually broken in all 2.18.x releases but ok in 2.17.x and 2.16.x
>
> I'll file a bug with Camel. Thanks for your thoughts.
>
>
> On Mon, Mar 13, 2017 at 7:43 PM, Guillaume Nodet 
> wrote:
>
>> IIRC, camel blueprint translated the xml in the camel-spring namespace to
>> be able to leverage jaxb, but clearly a property should have been replaced
>> by the actual camel version.
>> Can you explain exactly which bundles / features you installed  (with
>> versions) and the blueprint xml you use ?
>>
>> 2017-03-12 14:14 GMT+01:00 Niels Bertram :
>>
>>> Hi there,
>>>
>>> I am trying to implement a very basic CXF / Camel REST service. And
>>> despite best efforts I am getting below stacktrace when installing by
>>> bundle.
>>>
>>> Disturbing part is, I did not ask for spring, I want a plain blueprint
>>> instance.
>>>
>>> Anyone has seen this before?
>>>
>>>
>>> 2017-03-12 23:00:39,527 | WARN  | pool-32-thread-2 |
>>> NamespaceHandlerRegistryImpl | 12 - org.apache.aries.blueprint.core
>>> - 1.7.1 | Error registering NamespaceHandler
>>> java.lang.IllegalArgumentException: Illegal character in path at index
>>> 40: http://camel.apache.org/schema/spring/v${camel.schema.version}
>>> at java.net.URI.create(URI.java:852) [?:?]
>>> at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistr
>>> yImpl.getNamespaces(NamespaceHandlerRegistryImpl.java:203)
>>> [12:org.apache.aries.blueprint.core:1.7.1]
>>> at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistr
>>> yImpl.registerHandler(NamespaceHandlerRegistryImpl.java:157)
>>> [12:org.apache.aries.blueprint.core:1.7.1]
>>> at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistr
>>> yImpl.addingService(NamespaceHandlerRegistryImpl.java:121)
>>> [12:org.apache.aries.blueprint.core:1.7.1]
>>> at 
>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>>> [?:?]
>>> at 
>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
>>> [?:?]
>>> at 
>>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>>> [?:?]
>>> at 
>>> org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
>>> [?:?]
>>> at 
>>> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
>>> [?:?]
>>> at org.apache.felix.framework.EventDispatcher.invokeServiceList
>>> enerCallback(EventDispatcher.java:990) [?:?]
>>> at 
>>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
>>> [?:?]
>>> at 
>>> org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
>>> [?:?]
>>> at 
>>> org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)
>>> [?:?]
>>> at org.apache.felix.framework.Felix.registerService(Felix.java:3549)
>>> [?:?]
>>> at 
>>> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
>>> [?:?]
>>> at 
>>> org.apache.felix.framework.

JacksonJsonProvider not working with CXF Blueprint

2017-03-13 Thread Niels Bertram
Hi there,

I tried to configure a simple CXF JAXRS service and use Jackson as the JSON
provider. I did follow the CXF user documentation to configure the Jackson
provider but it is ignored and default jettison does the work. I use the
exact configuration without any issues in a plain Spring context (slightly
adapted for different xml names obviously).

Adding the skip.default.json.provider.registration=true property to the
 does seem to do little difference.

I created a quick start demo of the issue:
https://github.com/bertramn/cxf-jackson-osgi-blueprint-issue

I also noticed that when I create and configure a 
and try to reference this on the  the
blueprint will fail with a can't resolve id error.

Did anyone came across those issues?

Cheers,
Niels


Re: Camel on Karaf looking to resolve http://camel.apache.org/schema/spring/v${camel.schema.version}

2017-03-13 Thread Niels Bertram
Makes sense what you are saying. I just installed camel 2.18.2 components
and by the looks of it, it is a packaging failure in camel-spring.

1. install camel feature on Karaf 4.0.8 (also tested 4.1.0):

feature:repo-add camel 2.18.2
feature:install camel

2. install some route that uses blueprint and camel blueprint schema

Looking at
http://search.maven.org/remotecontent?filepath=org/apache/camel/camel-spring/2.18.2/camel-spring-2.18.2.jar

I can see that file /META-INF/spring.schemas shows following:

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
...
http\://camel.apache.org/schema/spring=camel-spring.xsd
http\://
camel.apache.org/schema/spring/v${camel.schema.version}=camel-spring-v${camel.schema.version}.xsd

Its actually broken in all 2.18.x releases but ok in 2.17.x and 2.16.x

I'll file a bug with Camel. Thanks for your thoughts.


On Mon, Mar 13, 2017 at 7:43 PM, Guillaume Nodet  wrote:

> IIRC, camel blueprint translated the xml in the camel-spring namespace to
> be able to leverage jaxb, but clearly a property should have been replaced
> by the actual camel version.
> Can you explain exactly which bundles / features you installed  (with
> versions) and the blueprint xml you use ?
>
> 2017-03-12 14:14 GMT+01:00 Niels Bertram :
>
>> Hi there,
>>
>> I am trying to implement a very basic CXF / Camel REST service. And
>> despite best efforts I am getting below stacktrace when installing by
>> bundle.
>>
>> Disturbing part is, I did not ask for spring, I want a plain blueprint
>> instance.
>>
>> Anyone has seen this before?
>>
>>
>> 2017-03-12 23:00:39,527 | WARN  | pool-32-thread-2 |
>> NamespaceHandlerRegistryImpl | 12 - org.apache.aries.blueprint.core
>> - 1.7.1 | Error registering NamespaceHandler
>> java.lang.IllegalArgumentException: Illegal character in path at index
>> 40: http://camel.apache.org/schema/spring/v${camel.schema.version}
>> at java.net.URI.create(URI.java:852) [?:?]
>> at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistr
>> yImpl.getNamespaces(NamespaceHandlerRegistryImpl.java:203)
>> [12:org.apache.aries.blueprint.core:1.7.1]
>> at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistr
>> yImpl.registerHandler(NamespaceHandlerRegistryImpl.java:157)
>> [12:org.apache.aries.blueprint.core:1.7.1]
>> at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistr
>> yImpl.addingService(NamespaceHandlerRegistryImpl.java:121)
>> [12:org.apache.aries.blueprint.core:1.7.1]
>> at 
>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>> [?:?]
>> at 
>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
>> [?:?]
>> at 
>> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>> [?:?]
>> at 
>> org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
>> [?:?]
>> at 
>> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
>> [?:?]
>> at org.apache.felix.framework.EventDispatcher.invokeServiceList
>> enerCallback(EventDispatcher.java:990) [?:?]
>> at 
>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
>> [?:?]
>> at 
>> org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
>> [?:?]
>> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)
>> [?:?]
>> at org.apache.felix.framework.Felix.registerService(Felix.java:3549)
>> [?:?]
>> at 
>> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
>> [?:?]
>> at 
>> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:355)
>> [?:?]
>> at 
>> org.apache.aries.blueprint.spring.SpringExtension.start(SpringExtension.java:78)
>> [202:org.apache.aries.blueprint.spring:0.2.0]
>> at 
>> org.apache.felix.utils.extender.AbstractExtender$1.run(AbstractExtender.java:265)
>> [202:org.apache.aries.blueprint.spring:0.2.0]
>> at 
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>> [?:?]
>> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
>> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFu
>> tureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
>> at java.util

Camel on Karaf looking to resolve http://camel.apache.org/schema/spring/v${camel.schema.version}

2017-03-12 Thread Niels Bertram
Hi there,

I am trying to implement a very basic CXF / Camel REST service. And despite
best efforts I am getting below stacktrace when installing by bundle.

Disturbing part is, I did not ask for spring, I want a plain blueprint
instance.

Anyone has seen this before?


2017-03-12 23:00:39,527 | WARN  | pool-32-thread-2 |
NamespaceHandlerRegistryImpl | 12 - org.apache.aries.blueprint.core -
1.7.1 | Error registering NamespaceHandler
java.lang.IllegalArgumentException: Illegal character in path at index 40:
http://camel.apache.org/schema/spring/v${camel.schema.version}
at java.net.URI.create(URI.java:852) [?:?]
at
org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.getNamespaces(NamespaceHandlerRegistryImpl.java:203)
[12:org.apache.aries.blueprint.core:1.7.1]
at
org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.registerHandler(NamespaceHandlerRegistryImpl.java:157)
[12:org.apache.aries.blueprint.core:1.7.1]
at
org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.addingService(NamespaceHandlerRegistryImpl.java:121)
[12:org.apache.aries.blueprint.core:1.7.1]
at
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
[?:?]
at
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
[?:?]
at
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
[?:?]
at
org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) [?:?]
at
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
[?:?]
at
org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
[?:?]
at
org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557) [?:?]
at
org.apache.felix.framework.Felix.registerService(Felix.java:3549) [?:?]
at
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
[?:?]
at
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:355)
[?:?]
at
org.apache.aries.blueprint.spring.SpringExtension.start(SpringExtension.java:78)
[202:org.apache.aries.blueprint.spring:0.2.0]
at
org.apache.felix.utils.extender.AbstractExtender$1.run(AbstractExtender.java:265)
[202:org.apache.aries.blueprint.spring:0.2.0]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[?:?]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[?:?]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[?:?]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[?:?]
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: java.net.URISyntaxException: Illegal character in path at index
40: http://camel.apache.org/schema/spring/v${camel.schema.version}
at java.net.URI$Parser.fail(URI.java:2848) ~[?:?]
at java.net.URI$Parser.checkChars(URI.java:3021) ~[?:?]
at java.net.URI$Parser.parseHierarchical(URI.java:3105) ~[?:?]
at java.net.URI$Parser.parse(URI.java:3053) ~[?:?]
at java.net.URI.(URI.java:588) ~[?:?]
at java.net.URI.create(URI.java:850) ~[?:?]
... 24 more


Re: Karaf and Docker

2015-04-18 Thread Niels
Maybe drawing a timeline of a typical application lifecycle and outlining the 
challenges at the various stages should paint a pretty good picture. This could 
then be overlaid with the technology features that support each of those 
concerns. We'd get to a view that would show the areas where docker provides 
benefits and where OSGi plays its strengths.

End of the day OSGi covers the  lifecycle of interdependent application 
components and docker is more or less a means to speed up deployment of a 
configured compute resource.

Nothing wrong with docker but using it purposeful seems a bit of a challenge to 
a lot of folks out there.

Cheers,
Niels

Re: Karaf and Docker

2015-04-11 Thread Niels
Could not agree more Achim. Good fad indicators are high promises which are 
designed to target the ultimate need of decision makers to deliver software 
quicker and cheaper. Just rewind 10 years and we will find the exact same 
promises were made at the start of the SOA hype which are now touted by the 
microservices believers. At the end of the day nothing will prevent people from 
doing something really badly.

I can see the value of docker but unless one really has all the lifecycle ducks 
in a row I would not go down the path and containerise the all and sundry.

Cheers,
Niels

> On 12 Apr 2015, at 08:28, Ryan Moquin  wrote:
> 
> I used to work somewhere with other developers who always became very 
> spiritual about whatever the latest "cool" developer technology or 
> methodology is.  Microservices was one of them.  It always made me laugh when 
> I was told how super efficient and streamlined it was over any other solution 
> because every fat jar deployed (Maven shade plugin abuse in order to be lazy) 
> was between 500Mb and 1.7Gb.  So much for being a "micro"-service.
> 
>> On Apr 8, 2015 2:55 PM, "Achim Nierbeck"  wrote:
>> I'm very ambivalent regarding this topic. 
>> 
>> On one hand I see a lot of move to Docker as heading for the holy grail on 
>> fixing all the issues we had in the past. #FAIL
>> On the other hand I see some benefits of it, but still haven't found the 
>> concrete use-case where it did top a bar-metal or bare virtualized machine. 
>> 
>> It's absolutely true that it does have some benefits for easier deployment 
>> of "Infrastructure" but I also see a lot of failures in usage of Docker. 
>> Just to mention one, where did the init daemon go, it's been there for a 
>> reason in linux OS's and now we run applications on top of the system 
>> without it ... I don't feel comfortable with that, especially if you don't 
>> have a JVM as process running which starts spawning other processes (one 
>> might remember the zombie processes). 
>> In the end there are mostly more slopy/lazy people around[1] trying to get 
>> something going, that's why Docker will be sufficient enough, while the 
>> dynamic and re-configurable service oriented software architecture will be 
>> on the decrease. One just needs to follow that Microservice hype. 
>> Docker/SpringBoot are just part of this "mantra" :D
>> In the end people will just split their Monolithic rubbish up to different 
>> small Monolithic piles of rubbish, but in case one of them is failing, 
>> they'll end up with one big failing pile of rubbish. 
>> 
>> Besides this rant, I think building a custom Karaf with your application on 
>> top, distributable as Docker image. Or as I did for a showcase building a 
>> base Karaf Docker Image for Continuous Integration/Delivery Pipeline is a 
>> good combination. As long as it's possible to configure the services inside 
>> this docker image from the outside. 
>> 
>> regards, Achim 
>> 
>> [1] - http://blog.osgi.org/2014/08/is-docker-eating-javas-lunch.html
>> 
>> 
>> 2015-04-08 17:34 GMT+02:00 Frank Lyaruu :
>>> I agree, I do feel that vibe from time to time, mostly due to the 
>>> 'containers should be immutable' mantra.
>>> 
>>> In my opinion, if you can get away with it, make it as dynamic as you want, 
>>> but I guess we all know that building an application that can be 
>>> reconfigured + updated on the fly is not easy at all.
>>> 
>>> Anyway, while we're at it, I also wrote a few posts about OSGi + Docker, 
>>> with quite a different approach: I explore monitoring the Docker API to 
>>> discover services, and inject those services as OSGi configuration data:
>>> 
>>> http://www.codemonkey.nl/discovery/
>>> 
>>> I think OSGi and Docker can complement each other very nicely.
>>> 
>>> regards, Frank
>>> 
>>>> On Wed, Apr 8, 2015 at 4:54 PM, Ryan Moquin  wrote:
>>>> Don't get me wrong, I don't mean that Docker and Karaf are 
>>>> interchangeable.  I mean that it feels like, from quite a few things I 
>>>> read, that the trend may be to have a docker image built as part of every 
>>>> CI build.  The purpose being that deployments should be fully immutable 
>>>> and if changes need to be made, then a new Docker image should be 
>>>> generated and deployed.
>>>> 
>>>> One particular conversation that I felt really expressed this type of 
>>>> development track is

Re: Retrieve reference of JMS ConnectionFactory

2015-03-25 Thread niels
Hey Krzysztof,

I forgot to mention versions:
- Karaf 2.3.6
- ActiveMQ 5.9.0
- Camel 2.13.2

I also installed the JMS bundle and was able to list the connection factory:

karaf@flux>jms:connectionfactories
JMS Connection Factory
localhost

I'm also able to list the queues from AMQ without ClassNotFoundException you
first received.

karaf@flux>jms:queues localhost
JMS Queues
ID_550952684d6163871467_f934b9e9-fd31-470b-a924-1a7c306f6b22
tracing
elasticsearch_log
ID_550952684d6163871467_9701e4b3-37ef-4934-8882-deddb2d033fa
invoicing

The only thing I try to do in the second bundle is to capture a reference to
the exported ConnectionFactory like I mentioned earlier:



The blueprint file are deployed by the dropping them in de deploy directory
for hot deploys. 






--
View this message in context: 
http://karaf.922171.n3.nabble.com/Retrieve-reference-of-JMS-ConnectionFactory-tp4039259p4039286.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Retrieve reference of JMS ConnectionFactory

2015-03-24 Thread niels
  at
org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1245)[6:org.apache.felix.fileinstall:3.4.0]
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1217)[6:org.apache.felix.fileinstall:3.4.0]
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1207)[6:org.apache.felix.fileinstall:3.4.0]
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:504)[6:org.apache.felix.fileinstall:3.4.0]
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:358)[6:org.apache.felix.fileinstall:3.4.0]
at
org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:310)[6:org.apache.felix.fileinstall:3.4.0]
Caused by: java.lang.NullPointerException
at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)[org.apache.felix.framework-4.0.3.jar:]
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)[org.apache.felix.framework-4.0.3.jar:]
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
at java.lang.ClassLoader.loadClass(ClassLoader.java:410)[:1.7.0_11]
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)[:1.7.0_11]
at java.lang.Class.forName0(Native Method)[:1.7.0_11]
at java.lang.Class.forName(Class.java:264)[:1.7.0_11]
at
org.apache.aries.proxy.impl.interfaces.ProxyClassLoader.isInvalid(ProxyClassLoader.java:109)[12:org.apache.aries.proxy.impl:1.0.2]
at
org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator.getProxyInstance(InterfaceProxyGenerator.java:84)[12:org.apache.aries.proxy.impl:1.0.2]
at
org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:72)[12:org.apache.aries.proxy.impl:1.0.2]
at
org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingInterceptingProxy(AbstractProxyManager.java:75)[12:org.apache.aries.proxy.impl:1.0.2]
at
org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingProxy(AbstractProxyManager.java:40)[12:org.apache.aries.proxy.impl:1.0.2]
at
org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createProxy(AbstractServiceReferenceRecipe.java:338)[7:org.apache.aries.blueprint.core:1.4.0]
at
org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:106)[7:org.apache.aries.blueprint.core:1.4.0]/

So apparently no service is found for the specific interface. I find this
strange since I have several bundles running with Camel and also using the
ActiveMQ queues in between. Those bundles don't complain of a
ConnectionFactory missing. 
I'm assuming I'm missing something to export the service. Is there anybody
who could point me in the right direction? All help is welcome.

Cheers,

Niels






--
View this message in context: 
http://karaf.922171.n3.nabble.com/Retrieve-reference-of-JMS-ConnectionFactory-tp4039259.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Re: Security Subject from AccessControlContext is null when using JAAS and CXF JAASAuthenticationFilter

2015-01-20 Thread Niels Bertram
Hi Christian, it would probably be better to add the doAs option to the
JAASAuthenticationFilter and fix whatever is causing the NPE rather than
trying to make the JAASLoginInterceptor do things it may not be designed to
do. I'll add some thoughts to the JIRA.

Thanks for the efforts,
Niels


Re: Security Subject from AccessControlContext is null when using JAAS and CXF JAASAuthenticationFilter

2015-01-19 Thread Niels Bertram
Hi Christian,

Using authz actually does not make any difference to the response someone
will get when not authenticated. The JAASAuthenticationFilter will continue
to press for credentials with a HTTP 401 response code. Where the
JAASAuthenticationFeature will just fail with an ugly error message and a
500 server error.

For sanity I took your Karaf-Tutorial and added a few REST annotations to
the JAXWS service and also wedged a jaxrs:server configuration into the
blueprint. Authentication and authorization seems to work ok as long as
there is a valid auth header in the HTTP request:

$ curl -H "Accept: application/json" -X GET -u karaf:karaf
http://localhost:8181/cxf/rest/person
{"person":[{"id":1,"name":"Chris"}]}

But trying to access the resource unauthenticated and asking to get a
application/json response explicitly the only thing I get back is a bunch
of XML garbage:

$ curl -H "Accept: application/json" -X GET
http://localhost:8181/cxf/rest/personhttp://cxf.apache.org/bindings/xformat";>http://cxf.apache.org/bindings/xformat";>org.apache.cxf.interceptor.security.AuthenticationException:
Authentication required but no user or password was
supplied

Here I would expect a HTTP 401 response instead of XML and a HTTP 500
Server Error. As said before, for a proper REST experience one would need
to use JAASAuthenticationFilter but this component should not be disabling
the useDoAs on the JAASLoginInterceptor.

Cheers,
Niels



On Mon, Jan 19, 2015 at 11:10 PM, Christian Schneider <
ch...@die-schneider.net> wrote:

>  Have you tried to use only the JAASAuthenticationFeature
> together with blueprint authz for Rest?
>
> Maybe it works better.
>
> Christian
>
>


Re: Security Subject from AccessControlContext is null when using JAAS and CXF JAASAuthenticationFilter

2015-01-19 Thread Niels Bertram
-transports-http:3.0.2]
at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)[103:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at 
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)[103:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:290)[103:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:214)[103:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:575)[84:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0]
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)[103:org.apache.cxf.cxf-rt-transports-http:3.0.2]
at 
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)[89:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)[89:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]
at 
org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)[98:org.ops4j.pax.web.pax-web-jetty:3.1.2]
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)[89:org.eclipse.jetty.aggregate.jetty-all-server:8.1.15.v20140411]




On Mon, Jan 19, 2015 at 8:16 PM, Niels Bertram  wrote:

> Hi Christian,
>
> oh yes I can see, adding the JAASAuthenticationFeature to the cxf bus is
> required *in addition *to adding the JAASLoginInterceptor. I was not
> getting desired result after Phase 1 so that makes sense.
>
> I added a very simple example to GitHub
> <https://github.com/bertramn/jaas-auth-rest-example> for anyone
> interested.
>
> Thanks a lot for help, much appreciated!
>
> Kind Regards,
> Niels
>


Re: Security Subject from AccessControlContext is null when using JAAS and CXF JAASAuthenticationFilter

2015-01-19 Thread Niels Bertram
Hi Christian,

oh yes I can see, adding the JAASAuthenticationFeature to the cxf bus is
required *in addition *to adding the JAASLoginInterceptor. I was not
getting desired result after Phase 1 so that makes sense.

I added a very simple example to GitHub
<https://github.com/bertramn/jaas-auth-rest-example> for anyone interested.

Thanks a lot for help, much appreciated!

Kind Regards,
Niels



On Mon, Jan 19, 2015 at 6:18 PM, Christian Schneider <
ch...@die-schneider.net> wrote:

>  Hi Niels,
>
> this is what you need to configure in blueprint to make it work:
>
> https://github.com/cschneider/Karaf-Tutorial/blob/master/cxf/personservice/server/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>
> I never tested with rest but in SOAP it worked fine and it should also
> work in SOAP.
>
> It works like this:
>
> Phase 1 is the authentication. It is mainly done in the CXF interceptor
>
> - The JAASAuthenticationFeature adds the JAASLoginInterceptor
> - Inside the interceptor the basic auth http headers are read and a JAAS
> login is done
> - During the JAAS login by default the "karaf" context is used. So you can
> login for example with karaf/karaf or whatever you set in you
> users.propeties
> - The following CXF chain is called in subject.doAs. This populates the
> AccessControlContext
>
> From this point on you can use standard JAAS API calls to work with the
> AccessControlContext.
>
> Phase 2 is authorization
>
> As a second step you can then use the blueprint authz module. Simply
> activate it with 
>
> It works with the @RolesAllowed annotations to secure access to blueprint
> beans.
> In my case I set it on
> https://github.com/cschneider/Karaf-Tutorial/blob/master/cxf/personservice/server/src/main/java/net/lr/tutorial/karaf/cxf/personservice/impl/PersonServiceImpl.java
>
> @RolesAllowed("admin")
> public Person[] getAll() {
> return personMap.values().toArray(new Person[]{});
> }
>
> So this works with the roles set in users.properties. As the user karaf is
> in the group admin he can access the method. If you add another user
> without this role then it will be able to access unsecured methods but not
> this one.
>
> Does this work for you?
>
> Christian
>
>


Re: Security Subject from AccessControlContext is null when using JAAS and CXF JAASAuthenticationFilter

2015-01-18 Thread Niels Bertram
Hi Christian,

yes I did give cxf 3.0.3 on Karaf 2.3.9 a try without the desired outcome.
After some digging, it appears that the AccessControlContext does not have
the combiner field populated after a sucessful authentication. There are a
few AccessControlContext instances in the heap that have a valid combiner
set. These contexts appear to be from the Karaf shell.

The point at which subject retrieval fails is
injavax.security.auth.Subject.getSubject(AccessControlContext
acc) line 300 on JDK 1.7.0_71. Here it expects the AccessControlContext to
return a SubjectDomainCombiner but the actual combiner on the
AccessControlContext is null and hence it is not able to retieve the
security context.

// return the Subject from the DomainCombiner of the provided
contextreturn AccessController.doPrivileged
(new java.security.PrivilegedAction() {
public Subject run() {
DomainCombiner dc = acc.getDomainCombiner();
if (!(dc instanceof SubjectDomainCombiner))
return null;
SubjectDomainCombiner sdc = (SubjectDomainCombiner)dc;
return sdc.getSubject();
}
});

Now I am not sure but I would expect this context to be set by the JAAS
framework and not the CXF interceptor. I had a quick look at
the authorization blueprint extension but not sure I understand the
workings of this test. All I am after is to get the Subject in a simple
authenticated REST service call.

Any thoughts or pointers on the above? Looks to me as if something is
broken in either Karaf JAAS or the CXF interceptor.

Many thanks,
Niels

On Sun, Jan 18, 2015 at 11:25 PM, Christian Schneider <
ch...@die-schneider.net> wrote:

>  Did you try with CXF 3.0.2 ? The older versions of CXF did not set the
> AccessControlContext.
>
> Btw. if you use Blueprint you can also try the jaas authorization
> blueprint extension.
> See
> https://github.com/apache/aries/blob/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/authz/AuthorizationTest.java
>
> Christian
>
> Am 18.01.2015 um 13:29 schrieb Niels Bertram:
>
>  I am trying to get the contexts Principal from the AccessControlContext
> as documented on stackexchange
> <http://stackoverflow.com/questions/20970380/get-current-user-in-an-osgi-context-fuse-karaf>
> .
>
> Unfortunately whenever I retrieve the subject using the current
> AccessControlContext, the subject is null.
>
> I basically create a very simple jaxrs server and register the CXF
> JAASAuthenticationFilter with the server:
>
> 
> 
> 
>
> 
> 
>  class="org.apache.karaf.jaas.modules.mongo.test.EchoServiceImpl" />
> 
> 
> 
> 
> 
>
>  When I execute the REST service, I try to get the Subject in the code as
> below but it is always null:
>
> AccessControlContext acc = AccessController.getContext();if (acc == null) {
>   throw new RuntimeException("access control context is null");
> }
> Subject subject = Subject.getSubject(acc);if (subject == null) {
>   throw new RuntimeException("subject is null");
> }
>
>  Interestingly if I inject the javax.ws.rs.core.SecurityContext into the
> CXF REST service, I do get a security principal.
>
> public Response echo(@Context SecurityContext context) {
>Principal user = context.getUserPrincipal();
> }
>
>  Is there another configuration required in Karaf or is this a bug in
> either Karaf or CXF? Would love to hear if anyone else came across this.
>
> Cheers, Niels
>
> BTW: I tried the same in karaf 2.3.9, 2.4.1 and 3.0.2 with exact same
> result.
>
>
>
> --
>
> Christian Schneiderhttp://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>
>


Security Subject from AccessControlContext is null when using JAAS and CXF JAASAuthenticationFilter

2015-01-18 Thread Niels Bertram
I am trying to get the contexts Principal from the AccessControlContext as
documented on stackexchange
<http://stackoverflow.com/questions/20970380/get-current-user-in-an-osgi-context-fuse-karaf>
.

Unfortunately whenever I retrieve the subject using the current
AccessControlContext, the subject is null.

I basically create a very simple jaxrs server and register the CXF
JAASAuthenticationFilter with the server:














When I execute the REST service, I try to get the Subject in the code as
below but it is always null:

AccessControlContext acc = AccessController.getContext();if (acc == null) {
  throw new RuntimeException("access control context is null");
}
Subject subject = Subject.getSubject(acc);if (subject == null) {
  throw new RuntimeException("subject is null");
}

Interestingly if I inject the javax.ws.rs.core.SecurityContext into the CXF
REST service, I do get a security principal.

public Response echo(@Context SecurityContext context) {
   Principal user = context.getUserPrincipal();
}

Is there another configuration required in Karaf or is this a bug in either
Karaf or CXF? Would love to hear if anyone else came across this.

Cheers, Niels

BTW: I tried the same in karaf 2.3.9, 2.4.1 and 3.0.2 with exact same
result.


Re: [Windows7+MingW32] Problem starting karaf with ./bin/karaf

2014-12-18 Thread Niels
Is your Win7 a 64bit build by any chance? I remember having the same issue some 
time ago. I recall that in my case the SIGHUP error was generated by the actual 
shell as it tried to attach a signal handler to the windows process. Niels

> On 19 Dec 2014, at 3:18, Arnaud Vandyck  wrote:
> 
> With MINGW32, I have a *nix like console on windows (with GNU tools). Some 
> scripts take care of that.
> 
> By the way, using the "traditional Windows command line tool", everything is 
> ok.
> 
> Thanks,
> 
> 2014-12-18 16:42 GMT+01:00 Jean-Baptiste Onofré :
>> 
>> Hi Arnaud,
>> 
>> not sure to follow what you do.
>> 
>> If you use Windows, you have to use the *.bat scripts, the bin/karaf, 
>> bin/shell, etc are for Unix system.
>> 
>> It's described here:
>> 
>> http://karaf.apache.org/manual/latest/users-guide/start-stop.html
>> 
>> Regards
>> JB
>> 
>> 
>>> On 12/18/2014 04:14 PM, Arnaud Vandyck wrote:
>>> Hi,
>>> 
>>> When I use ./bin/shell, I have
>>> 
>>> $ ./bin/shell
>>> shell: Ignoring predefined value for KARAF_HOME
>>>  __ __  
>>> / //_/ __ _/ __/
>>>/ ,<  / __ `/ ___/ __ `/ /_
>>>   / /| |/ /_/ / /  / /_/ / __/
>>>  /_/ |_|\__,_/_/   \__,_/_/
>>> 
>>>Apache Karaf (4.0.0.M1)
>>> 
>>> 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()>
>>> 
>>> But if I try ./bin/karaf, I have
>>> 
>>> $ ./bin/karaf
>>> karaf: Ignoring predefined value for KARAF_HOME
>>> javax.management.JMRuntimeException: Failed to load MBeanServerBuilder
>>> class org.apache.karaf.management.boot.KarafMBeanServerBuilder:
>>> java.lang.ClassNotFoundException: org.apache.karaf.management.boo
>>> t.KarafMBeanServerBuilder
>>>  at
>>> javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:503)
>>>  at
>>> javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:539)
>>>  at
>>> javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:316)
>>>  at
>>> javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:231)
>>>  at
>>> javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:192)
>>>  at
>>> java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:468)
>>>  at
>>> sun.management.jmxremote.ConnectorBootstrap.startLocalConnectorServer(ConnectorBootstrap.java:518)
>>>  at sun.management.Agent.startLocalManagementAgent(Agent.java:138)
>>>  at sun.management.Agent.startAgent(Agent.java:260)
>>>  at sun.management.Agent.startAgent(Agent.java:447)
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.apache.karaf.management.boot.KarafMBeanServerBuilder
>>>  at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
>>>  at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
>>>  at java.security.AccessController.doPrivileged(Native Method)
>>>  at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
>>>  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>  at
>>> javax.management.MBeanServerFactory.loadBuilderClass(MBeanServerFactory.java:446)
>>>  at
>>> javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:488)
>>>  ... 9 more
>>> Exception envoyée par l'agent : javax.management.JMRuntimeException:
>>> Failed to load MBeanServerBuilder class
>>> org.apache.karaf.management.boot.KarafMBeanServerBuilder:
>>> java.lang.ClassNotFoundException:
>>>   org.apache.karaf.management.boot.KarafMBeanServerBuilder
>>> 
>>> When launching with the cmd and .\bin\karaf.bat, I have a error but it
>>> seems to be running:
>>> karaf.bat: Ignoring predefined value for KARAF_HOME
>>> Error starting karaf activator
>>> org.apache.karaf.diagnostic.core.internal.Activator: Unknown signal: HUP
>>>  __ __  
>>> / //_/ __ _/ __/
>>>/ ,<  / __ `/ ___/ __ `/ /_
>>>   / /| |/ /_/ / /  / /_/ / __/
>>>  /_/ |_|\__,_/_/   \__,_/_/
>>> 
>>>Apache Karaf (4.0.0.M1)
>>> 
>>> 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()>
>>> 
>>> Cheers,
>>> 
>>> --
>>> Arnaud Vandyck
>>> http://about.me/avdyk
>> 
>> -- 
>> Jean-Baptiste Onofré
>> jbono...@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 
> 
> -- 
> Arnaud Vandyck
> http://about.me/avdyk


Karaf shell if operators

2014-09-30 Thread Niels Bertram
Does anyone know what the operators are for the shell:if statement? I am
puzzled by the lack of documentation and anything that would seem logical
does not work in the shell.


I want to also check for the version inside an if statement but can't get
anything to work (red part obviously does not work):


bundles = $.context bundles ;
each ($bundles) {
symbolicName = $it symbolicName;
bundleId = (($it bundleid) toString);
version = (($it version) toString);
if { $symbolicName equals "org.springframework.security.core" *and
$version equals "3.1.4.RELEASE"* } {
  osgi:bundle-level --force $bundleId 30
  osgi:start --force $bundleId
}
}

If anyone can offer some help that would be much appreciated.

Cheers,
Niels


Re: Custom Karaf with Apache Camel

2014-01-17 Thread niels
Hey JB,

did you find out something? 

Regards,

Niels



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Custom-Karaf-with-Apache-Camel-tp4030997p4031132.html
Sent from the Karaf - User mailing list archive at Nabble.com.


Custom Karaf with Apache Camel

2014-01-14 Thread niels
Hey,

I'm trying to create a custom distribution of Karaf with Apache Camel. 
I tried building a distribution with several different version of Apache
Camel without any luck.

I first tried the version used by ServiceMix: Camel - 2.10.7 without any
luck. 
Maven was complaining:  

[WARNING] could not resolve wrap:mvn:bsf/bsf/2.4.0
org.sonatype.aether.resolution.ArtifactResolutionException: Could not find
artifact wrap:mvn:jar:bsf/bsf/2.4.0 in servicemix
(http://svn.apache.org/repos/asf/servicemix/m2-repo)

When I tried Camel - 2.11.3 I got the same result. Finally I tried to use
the latest Camel version 2.12.2.
This one didn't complain about BSF missing (could be it didn't got that far)
but complained on facebook4j-core  being missing. 

[WARNING] could not resolve wrap:mvn:org.facebook4j/facebook4j-core/1.1.12
org.sonatype.aether.resolution.ArtifactResolutionException: Could not find
artifact wrap:mvn:jar:org.facebook4j/facebook4j-core/1.1.12 in servicemix
(http://svn.apache.org/repos/asf/servicemix/m2-repo)

I assume BSF is needed for scripting in Camel and facebook4j-core for the
facebook component both which I don't need. So could it be I could better
create a custom feature file only including camel-core bundle and the
components that I need? If so could somebody give a small hint how I could
accomplish it?

Still I find it strange I couldn't build a version with Camel 2.10.7.

btw: I'm using Java version "1.7.0_25" with Apache Maven 3.0.5 on Ubuntu
13.04 

This is the pom I defined:


http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>

4.0.0


org.apache.karaf.assemblies
assemblies
3.0.0
../pom.xml


nl.kabisa.esb
flux
pom
Kabisa Flux Distribution


   
${basedir}/../etc/appended-resources




org.apache.karaf.features
framework
kar


org.apache.karaf.features
standard
features
xml
runtime


org.apache.karaf.features
spring
features
xml
runtime


org.apache.camel.karaf
apache-camel
2.12.2
features
xml






${project.basedir}/../..
false

README
RELEASE*
LICENSE
NOTICE





org.apache.maven.plugins
maven-resources-plugin


process-resources

resources





org.apache.maven.plugins
maven-remote-resources-plugin

true



org.apache.karaf.tooling
karaf-maven-plugin


process-resources
process-resources

install-kars



package

instance-create-archive





wrapper


framework











--
View this message in context: 
http://karaf.922171.n3.nabble.com/Custom-Karaf-with-Apache-Camel-tp4030997.html
Sent from the Karaf - User mailing list archive at Nabble.com.