Hi

Thanks so what we can see its that you end up with camel-jms thread
attempting to load the class which it cannot do

I logged a ticket
https://issues.apache.org/jira/browse/CAMEL-12278

You are welcome to test the SNAPSHOT build for either master or the
2.20.x branch (you can build it yourself, or wait a while until CI
server publish updated snapshots on ASF snapshot maven repo)



On Mon, Feb 19, 2018 at 3:08 PM, Joery Vreijsen <jhjvreij...@gmail.com> wrote:
> Hi,
>
> These loggings showed up on installation:
>
> 15:03:49.890 INFO [Blueprint Event Dispatcher: 1] Attempting to start Camel 
> Context ID_5a86a27cc6d58e7b5e000001
> 15:03:49.891 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.20.1 
> (CamelContext: ID_5a86a27cc6d58e7b5e000001) is starting
> 15:03:49.927 INFO [Blueprint Event Dispatcher: 1] StreamCaching is enabled on 
> CamelContext: ID_5a86a27cc6d58e7b5e000001
> 15:03:49.937 INFO [Blueprint Event Dispatcher: 1] MDC logging is enabled on 
> CamelContext: ID_5a86a27cc6d58e7b5e000001
> 15:03:49.942 INFO [Blueprint Event Dispatcher: 1] JMX is enabled
> 15:03:49.971 INFO [Thread-86] Sending starting signal..
> 15:03:50.056 DEBUG [Blueprint Event Dispatcher: 1] Initializing expression 
> using: $.content
> 15:03:50.172 DEBUG [Blueprint Event Dispatcher: 1] Compiled static JsonPath: 
> $.content
> 15:03:50.175 DEBUG [Blueprint Event Dispatcher: 1] Initializing expression 
> using: $.content
> 15:03:50.177 DEBUG [Blueprint Event Dispatcher: 1] Compiled static JsonPath: 
> $.content
> 15:03:50.226 INFO [Blueprint Event Dispatcher: 1] StreamCaching in use with 
> spool directory: tmp/camelcontext-ID_5a86a27cc6d58e7b5e000001 and rules: 
> [Spool > 70% used of Max heap memory]
> 15:03:50.291 INFO [Blueprint Event Dispatcher: 1] jetty-9.3.21.v20170918
> 15:03:50.299 INFO [Blueprint Event Dispatcher: 1] Started 
> o.e.j.s.ServletContextHandler@5e4c54e8{/,null,AVAILABLE}
> 15:03:50.306 INFO [Blueprint Event Dispatcher: 1] Started 
> ServerConnector@62e4e21b{HTTP/1.1,[http/1.1]}{0.0.0.0:9000}
> 15:03:50.312 INFO [Blueprint Event Dispatcher: 1] Started @283167ms
> 15:03:50.318 INFO [Blueprint Event Dispatcher: 1] Route: 
> 38c94ee6-565a-4e52-8500-5e9ccca53fff started and consuming from: 
> jetty:http://0.0.0.0:9000/split/jsonpath?transferException=true
> 15:03:50.341 INFO [ActiveMQ Task-1] Successfully connected to 
> tcp://localhost:61616
> 15:03:50.356 INFO [Blueprint Event Dispatcher: 1] Route: 
> 28dca82e-1ba4-4ca4-a978-756304c69e2c started and consuming from: 
> activemq://ID_5a86a27cc6d58e7b5e000001_38c94ee6-565a-4e52-8500-5e9ccca53fff
> 15:03:50.369 INFO [ActiveMQ Task-1] Successfully connected to 
> tcp://localhost:61616
> 15:03:50.377 INFO [Blueprint Event Dispatcher: 1] Route: 
> 64eb9be4-e8fc-4dfa-8270-86e1daf3a15e started and consuming from: 
> activemq://ID_5a86a27cc6d58e7b5e000001_28dca82e-1ba4-4ca4-a978-756304c69e2c_BottomCenter_split
> 15:03:50.389 INFO [ActiveMQ Task-1] Successfully connected to 
> tcp://localhost:61616
> 15:03:50.398 INFO [Blueprint Event Dispatcher: 1] Route: 
> 8c827be5-1469-4aac-ba42-24eb1da56658 started and consuming from: 
> activemq://ID_5a86a27cc6d58e7b5e000001_28dca82e-1ba4-4ca4-a978-756304c69e2c_split
> 15:03:50.404 INFO [Blueprint Event Dispatcher: 1] Total 4 routes, of which 4 
> are started
> 15:03:50.408 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.20.1 
> (CamelContext: ID_5a86a27cc6d58e7b5e000001) started in 0.517 seconds
>
> These loggings showed up on triggering the route:
>
> 15:04:12.904 DEBUG [Camel (ID_5a86a27cc6d58e7b5e000001) thread #5 - 
> JmsConsumer[ID_5a86a27cc6d58e7b5e000001_38c94ee6-565a-4e52-8500-5e9ccca53fff]]
>  Attempting to enable JacksonJsonAdapter by resolving: 
> org.apache.camel.jsonpath.jackson.JacksonJsonAdapter from classpath
> 15:04:12.913 DEBUG [Camel (ID_5a86a27cc6d58e7b5e000001) thread #5 - 
> JmsConsumer[ID_5a86a27cc6d58e7b5e000001_38c94ee6-565a-4e52-8500-5e9ccca53fff]]
>  Cannot writeAsString as adapter cannot be initialised
>
> - Joery
>
> On 19 Feb 2018 14:53 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
>> Hi
>>
>> Maybe OSGi classloading is wonderful
>>
>> Can you turn on DEBUG/TRACE logging at 
>> org.apache.camel.jsonpath.JsonPathEngine
>> And see what the logs say
>>
>>
>>
>> On Mon, Feb 19, 2018 at 2:41 PM, Joery Vreijsen <jhjvreij...@gmail.com> 
>> wrote:
>> > Hi Claus,
>> >
>> > After successfully creating my flow in the Java DSL i was now moving it 
>> > across to the Spring DSL running in Karaf.
>> > However i kept running into the issue that the JacksonJsonAdapter wasn’t 
>> > found on my class path.
>> >
>> > When i manually exported the 
>> > org.apache.camel.jsonpath.jackson.JacksonJsonAdapter in one of my bundles 
>> > this however did work.
>> >
>> > Can it be that this does not get exported (correctly) by the 
>> > camel-jsonpath feature?
>> >
>> > Cheers!
>> >
>> > - Joery
>> >
>> > On 19 Feb 2018 10:53 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
>> > > Hi
>> > >
>> > > Thanks for sharing its a jackson issue. Maybe you could try with
>> > > 2.9.10 version and see how it works there.
>> > >
>> > > On Sun, Feb 18, 2018 at 11:50 PM, Joery Vreijsen <jhjvreij...@gmail.com> 
>> > > wrote:
>> > > > Hi,
>> > > >
>> > > > Just posting my final findings to this.
>> > > > My issue was caused by the fact i was using Jackson 2.9.4 which 
>> > > > logged: Cannot writeAsString as adapter cannot be initialized.
>> > > > When downgrading to 2.8.10 the writeAsString option worked perfectly, 
>> > > > outputting a valid Json string, rather than the Map toString().
>> > > >
>> > > > This might also explain the NoTypeConversionAvailableException.
>> > > >
>> > > > Maybe something to add to the docs ;)
>> > > >
>> > > > Thanks for the help, cheers!
>> > > >
>> > > > - Joery
>> > > >
>> > > > On 16 Feb 2018 16:55 +0100, Claus Ibsen <claus.ib...@gmail.com>, wrote:
>> > > > > Hi
>> > > > >
>> > > > > It looks like your json is invalid / not structured well. You inner
>> > > > > map uses duplicate ids, eg document.
>> > > > > If possible use a array instead, eg [ ]
>> > > > >
>> > > > > See the unit test from the source code - 
>> > > > > JsonPathSplitWriteAsStringTest
>> > > > >
>> > > > > On Fri, Feb 16, 2018 at 10:44 AM, Joery Vreijsen 
>> > > > > <jhjvreij...@gmail.com> wrote:
>> > > > > > That indeed was my thought aswell, i tried the following route:
>> > > > > >
>> > > > > > from("file:src/data")
>> > > > > > .split().jsonpathWriteAsString("$..document")
>> > > > > > .setHeader(Exchange.FILE_NAME, new 
>> > > > > > SimpleExpression("${exchangeId}.json"))
>> > > > > > .to("file:target/messages/others”);
>> > > > > >
>> > > > > > But this resulted also in the following exception:
>> > > > > >
>> > > > > > No body available of type: java.io.InputStream but has value: 
>> > > > > > {name=document 1, type=pdf} of type: java.util.LinkedHashMap on: 
>> > > > > > Message[]. Caused by: No type converter available to convert from 
>> > > > > > type: java.util.LinkedHashMap to the required type: 
>> > > > > > java.io.InputStream with value {name=document 1, type=pdf}. 
>> > > > > > Exchange[ID-local-1518795550966-0-3]. Caused by: 
>> > > > > > [org.apache.camel.NoTypeConversionAvailableException - No type 
>> > > > > > converter available to convert from type: java.util.LinkedHashMap 
>> > > > > > to the required type: java.io.InputStream with value 
>> > > > > > {name=document 1, type=pdf}]
>> > > > > >
>> > > > > > I tried the route in the Spring DSL, and there the WriteAsString 
>> > > > > > option worked, but outputted the .toString() value of the Map 
>> > > > > > class, e.g. "{name=document 1, type=pdf}”.
>> > > > > > Is there a possibility to let it output a valid json string, or is 
>> > > > > > it just the Map toString function you can get back?
>> > > > > >
>> > > > > > Thanks again.
>> > > > > >
>> > > > > > Cheers!
>> > > > > >
>> > > > > > - Joery
>> > > > > >
>> > > > > > On 16 Feb 2018 16:37 +0100, Claus Ibsen <claus.ib...@gmail.com>, 
>> > > > > > wrote:
>> > > > > > > Ah okay yeah that can make sense to try to tell it to output as
>> > > > > > > String. See the writeAsString option you would need to use
>> > > > > > > https://github.com/apache/camel/blob/master/components/camel-jsonpath/src/main/docs/jsonpath-language.adoc
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > On Fri, Feb 16, 2018 at 10:30 AM, Joery Vreijsen 
>> > > > > > > <jhjvreij...@gmail.com> wrote:
>> > > > > > > > Hi Clause,
>> > > > > > > >
>> > > > > > > > Thanks for the quick response!
>> > > > > > > >
>> > > > > > > > When removing the String.class i get the following exception:
>> > > > > > > >
>> > > > > > > > No body available of type: java.io.InputStream but has value: 
>> > > > > > > > {name=document 2, type=pdf} of type: java.util.LinkedHashMap 
>> > > > > > > > on: Message[]. Caused by: No type converter available to 
>> > > > > > > > convert from type: java.util.LinkedHashMap to the required 
>> > > > > > > > type: java.io.InputStream with value {name=document 2, 
>> > > > > > > > type=pdf}. Exchange[ID-local-1518794941554-0-5]. Caused by: 
>> > > > > > > > [org.apache.camel.NoTypeConversionAvailableException - No type 
>> > > > > > > > converter available to convert from type: 
>> > > > > > > > java.util.LinkedHashMap to the required type: 
>> > > > > > > > java.io.InputStream with value {name=document 2, type=pdf}]
>> > > > > > > >
>> > > > > > > > I was trying to split a Json without getting a Map POJO as 
>> > > > > > > > return, but rather just a String value.
>> > > > > > > >
>> > > > > > > > Cheers,
>> > > > > > > >
>> > > > > > > > - Joery
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > On 16 Feb 2018 16:27 +0100, Claus Ibsen 
>> > > > > > > > <claus.ib...@gmail.com>, wrote:
>> > > > > > > > > Try without the String.class in the jsonpath
>> > > > > > > > >
>> > > > > > > > > On Fri, Feb 16, 2018 at 10:22 AM, Joery Vreijsen 
>> > > > > > > > > <jhjvreij...@gmail.com> wrote:
>> > > > > > > > > > Hi,
>> > > > > > > > > >
>> > > > > > > > > > I’m trying to split my following Json file with the Camel 
>> > > > > > > > > > Splitter & JsonPath components.
>> > > > > > > > > >
>> > > > > > > > > > [
>> > > > > > > > > > {
>> > > > > > > > > > "document": {
>> > > > > > > > > > "name": "document 1",
>> > > > > > > > > > "type": "pdf"
>> > > > > > > > > > }
>> > > > > > > > > > },
>> > > > > > > > > > {
>> > > > > > > > > > "document": {
>> > > > > > > > > > "name": "document 2",
>> > > > > > > > > > "type": "pdf"
>> > > > > > > > > > }
>> > > > > > > > > > }
>> > > > > > > > > > ]
>> > > > > > > > > >
>> > > > > > > > > > The route I’m using looks like this:
>> > > > > > > > > >
>> > > > > > > > > > from("file:src/data")
>> > > > > > > > > > .split().jsonpath("$..document", String.class)
>> > > > > > > > > > .to("file:target/messages/others");
>> > > > > > > > > >
>> > > > > > > > > > I expected two output files with contents similar to this:
>> > > > > > > > > >
>> > > > > > > > > > "document": {
>> > > > > > > > > > "name": "document 1",
>> > > > > > > > > > "type": "pdf"
>> > > > > > > > > > }
>> > > > > > > > > >
>> > > > > > > > > > Strangely enough i got 4 output files with the following 
>> > > > > > > > > > content:
>> > > > > > > > > >
>> > > > > > > > > > file 1: [{"name":"document 1"
>> > > > > > > > > > file 2: "type":"pdf"}
>> > > > > > > > > > file 3: {"name":"document 2"
>> > > > > > > > > > file 4: "type":"pdf"}]
>> > > > > > > > > >
>> > > > > > > > > > Am i doing something wrong with my JsonPath? Any help is 
>> > > > > > > > > > very much appreciated!
>> > > > > > > > > >
>> > > > > > > > > > Cheers,
>> > > > > > > > > >
>> > > > > > > > > > - Joery
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > > --
>> > > > > > > > > Claus Ibsen
>> > > > > > > > > -----------------
>> > > > > > > > > http://davsclaus.com @davsclaus
>> > > > > > > > > Camel in Action 2: https://www.manning.com/ibsen2
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > --
>> > > > > > > Claus Ibsen
>> > > > > > > -----------------
>> > > > > > > http://davsclaus.com @davsclaus
>> > > > > > > Camel in Action 2: https://www.manning.com/ibsen2
>> > > > >
>> > > > >
>> > > > >
>> > > > > --
>> > > > > Claus Ibsen
>> > > > > -----------------
>> > > > > http://davsclaus.com @davsclaus
>> > > > > Camel in Action 2: https://www.manning.com/ibsen2
>> > >
>> > >
>> > >
>> > > --
>> > > Claus Ibsen
>> > > -----------------
>> > > http://davsclaus.com @davsclaus
>> > > Camel in Action 2: https://www.manning.com/ibsen2
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2



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

Reply via email to