deploying cxf webservice via camel into karaf 4.1.1

2017-08-23 Thread Matthew Shaw
Hi All,

Using karaf 4.1.1 which ships with cxf 3.x as a feature. I've installed 
features and CXF is running fine. However, I have a bundle which is depending 
on camel2.19.1 (feature also installed in karaf), which is declaring a route 
with a web service.

My bundle installs fine and is active and I can browse to 
http://localhost:8181/cxf/ and see my service registered and ready, also in 
karaf log.

However, when I try and browse the wsdl I receive a class loading issue as per 
the following snippet:

Caused by: java.lang.RuntimeException: Provider for class 
javax.xml.stream.XMLOutputFactory cannot be created
at 
javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:367)
... 48 more
Caused by: java.util.ServiceConfigurationError: 
javax.xml.stream.XMLOutputFactory: Provider com.ctc.wstx.stax.WstxOutputFactory 
not found
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at 
java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at javax.xml.stream.FactoryFinder$1.run(FactoryFinder.java:353)
at java.security.AccessController.doPrivileged(Native Method)
at 
javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:341)

Is this a classloading problem from within the cxf feature that ships with 
karaf? It appears to me that perhaps cxf is using a thread based classloader? I 
can't see how my bundle could be influencing this issue. Any ideas are welcome.


Cheers,
Matt.

This email, including any attachments sent with it, is confidential and for the 
sole use of the intended recipient(s). This confidentiality is not waived or 
lost, if you receive it and you are not the intended recipient(s), or if it is 
transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this 
email is strictly prohibited. The information contained in this email, 
including any attachment sent with it, may be subject to a statutory duty of 
confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in 
error, you are asked to immediately notify the sender. You should also delete 
this email, and any copies, from your computer system network and destroy any 
hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or 
take any action(s) that relies on it; any form of disclosure, modification, 
distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure 
this email does not contain malicious software, the Queensland Ambulance 
Service does not accept responsibility for the consequences if any person's 
computer inadvertently suffers any disruption to services, loss of information, 
harm or is infected with a virus, other malicious computer programme or code 
that may occur as a consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and 
not the views of the Queensland Government.



The content presented in this publication is distributed by the Queensland 
Government as an information source only. The State of Queensland makes no 
statements, representations or warranties about the accuracy, completeness or 
reliability of any information contained in this publication. The State of 
Queensland disclaims all responsibility and all liability (including without 
limitation for liability in negligence) for all expenses, losses, damages and 
costs you might incur as a result of the information being inaccurate or 
incomplete in any way, and for any reason reliance was placed on such 
information.


camel-example-cxf-osgi

2017-08-23 Thread Matthew Shaw
Hi,

I'm trying to run the camel-example-cxf-osgi example in karaf 4.1.1, and the 
service is successfully deployed through the bundle. However when trying to 
view the wsdl I'm getting the following exception, any ideas?

javax.xml.stream.FactoryConfigurationError: Provider for class 
javax.xml.stream.XMLOutputFactory cannot be created
at 
javax.xml.stream.FactoryFinder.findServiceProvider(FactoryFinder.java:370)
at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:313)
at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:227)
at 
javax.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java:130)
at 
org.apache.cxf.staxutils.StaxUtils.getXMLOutputFactory(StaxUtils.java:295)
at 
org.apache.cxf.staxutils.StaxUtils.createXMLStreamWriter(StaxUtils.java:410)
at 
org.apache.cxf.interceptor.StaxOutInterceptor.handleMessage(StaxOutInterceptor.java:82)
at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at 
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:83)
at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at 
org.apache.cxf.phase.PhaseInterceptorChain.doInterceptStartingAt(PhaseInterceptorChain.java:470)
at 
org.apache.cxf.frontend.WSDLGetInterceptor.handleMessage(WSDLGetInterceptor.java:97)
at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at 
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:262)
at 
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
at 
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:299)
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:223)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:274)
at 
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584)
at 
org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:72)
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
at 
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284)
at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at 
org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:534)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
at 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at 
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at 
org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
at 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
at 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
at 
org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.lang.Thread.run(Thread.java:748)

RE: restlest service deployment to karaf

2017-08-23 Thread Matthew Shaw
Hi Claus,

I went to the camel-servlet site, but the bottom section on wiring it up with 
osgi is showing an error. 

Anyhow, there appears to be a blueprint example. Is there an example of wiring 
it up with declarative services, ie. Osgi Annotations in my java pojo?

Cheers,
Matt.

-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Wednesday, 23 August 2017 3:09 PM
To: users@camel.apache.org
Subject: Re: restlest service deployment to karaf

Use servlet instead of restlet if you want to reuse ports in karaf, as you then 
use its servlet engine.

On Wed, Aug 23, 2017 at 7:03 AM, Matthew Shaw 
 wrote:
> This maybe a stupid question, but I'm using camel to expose rest 
> endpoints from my bundle, into karaf. How do I deploy multiple 
> services to the same host and port with restlet? Here is my dsl
>
> restConfiguration().component("restlet").host("localhost").port(8095).
> bindingMode(RestBindingMode.json);
>
> This works fine.
>
> The I have another service / camel route with an additional endpoint defin:
>
>
> restConfiguration().component("restlet").host("localhost").port(8095).
> bindingMode(RestBindingMode.json);
>
>
> Cheers,
> Matt.
> This email, including any attachments sent with it, is confidential and for 
> the sole use of the intended recipient(s). This confidentiality is not waived 
> or lost, if you receive it and you are not the intended recipient(s), or if 
> it is transmitted/received in error.
>
> Any unauthorised use, alteration, disclosure, distribution or review of this 
> email is strictly prohibited. The information contained in this email, 
> including any attachment sent with it, may be subject to a statutory duty of 
> confidentiality if it relates to health service matters.
>
> If you are not the intended recipient(s), or if you have received this email 
> in error, you are asked to immediately notify the sender. You should also 
> delete this email, and any copies, from your computer system network and 
> destroy any hard copies produced.
>
> If not an intended recipient of this email, you must not copy, distribute or 
> take any action(s) that relies on it; any form of disclosure, modification, 
> distribution and/or publication of this email is also prohibited.
>
> Although the Queensland Ambulance Service takes all reasonable steps to 
> ensure this email does not contain malicious software, the Queensland 
> Ambulance Service does not accept responsibility for the consequences if any 
> person's computer inadvertently suffers any disruption to services, loss of 
> information, harm or is infected with a virus, other malicious computer 
> programme or code that may occur as a consequence of receiving this email.
>
> Unless stated otherwise, this email represents only the views of the sender 
> and not the views of the Queensland Government.
>
> **
> **
>
> The content presented in this publication is distributed by the Queensland 
> Government as an information source only. The State of Queensland makes no 
> statements, representations or warranties about the accuracy, completeness or 
> reliability of any information contained in this publication. The State of 
> Queensland disclaims all responsibility and all liability (including without 
> limitation for liability in negligence) for all expenses, losses, damages and 
> costs you might incur as a result of the information being inaccurate or 
> incomplete in any way, and for any reason reliance was placed on such 
> information.



--
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

This email, including any attachments sent with it, is confidential and for the 
sole use of the intended recipient(s). This confidentiality is not waived or 
lost, if you receive it and you are not the intended recipient(s), or if it is 
transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this 
email is strictly prohibited. The information contained in this email, 
including any attachment sent with it, may be subject to a statutory duty of 
confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in 
error, you are asked to immediately notify the sender. You should also delete 
this email, and any copies, from your computer system network and destroy any 
hard copies produced.

If not an intended recipient of this email, you must not copy, distribute or 
take any action(s) that relies on it; any form of disclosure, modification, 
distribution and/or publication of this email is also prohibited.

Although the Queensland Ambulance Service takes all reasonable steps to ensure 
this email does not contain malicious software, the Queensland Ambulance 
Service does not accept responsibility for the consequences if 

Re: Groovy DSL - expression closures

2017-08-23 Thread Remco Schoen
Hi,

I understand :)

Maybe an idea to mention on that page, that it is deprecated.

--

Met vriendelijke groet,


Remco Schoen

Op 23 aug. 2017, om 07:33 heeft Claus Ibsen 
> het volgende geschreven:

Hi

The groovy DSL is deprecated and its not recommended to be used. We
have also deprecated Scala DSL as well.

Sorry but there is only as few we can maintain which is Java and XML.



On Tue, Aug 15, 2017 at 2:26 PM, Remco Schoen 
> wrote:
Hi,

I’m trying to get processor closures to work as described on:
http://camel.apache.org/groovy-dsl.html

But when I put the code below in a groovy file, it gives an error.

Should this work?

Kind regards,

Remco Schoen

The error:

groovy.lang.MissingMethodException: No signature of method: 
simpletest$1$_configure_closure1.doCall() is applicable for argument types: 
(org.apache.camel.impl.DefaultExchange, java.lang.Class) values: , ...]
Possible solutions: doCall(), doCall(java.lang.Object), findAll(), findAll()
at 
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:286)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.Closure.call(Closure.java:414)
at 
org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:54)
at 
org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:124)
at com.sun.proxy.$Proxy11.evaluate(Unknown Source)
at 
org.apache.camel.processor.SetPropertyProcessor.process(SetPropertyProcessor.java:51)
at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
at 
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:197)
at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:79)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)


The script:

@Grab('org.apache.camel:camel-core:2.19.1')
@Grab('org.slf4j:slf4j-simple:1.6.6')
import org.apache.camel.*
import org.apache.camel.impl.*
import org.apache.camel.builder.*

def camelContext = new DefaultCamelContext()
camelContext.addRoutes(new RouteBuilder() {
   def void configure() {
   from("timer://jdkTimer?period=3000")
   .to("log://camelLogger?level=INFO")
   .setProperty('henk') { 'aaa' }
   }
})
camelContext.start()

addShutdownHook{ camelContext.stop() }
synchronized(this){ this.wait() }





--
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2