Camel-SQL 2.18.2 problem with MongoDbBasicConverters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel-SQL 2.18.2 problem with MongoDbBasicConverters

antopet
Hi,
I'm trying to execute a sql from apache Camel. I using version 2.18.2 and wildfly 10.1.0 final and wildfly-camel patch 4.5.0

My code is:

from("direct:testDatabase").routeId("testDatabase")
                .setHeader("id", constant("hello"))
                .to("sql:select * from testtable where name=:#id?dataSource=myDS")
                .to("log:stream")
                .split(body()).streaming()
                .to("log:row");

and I got this error

java.lang.NoClassDefFoundError: Could not initialize class org.apache.camel.component.mongodb.converters.MongoDbBasicConverters

am I doing something wrong with dependencies?


Reply | Threaded
Open this post in threaded view
|

Re: Camel-SQL 2.18.2 problem with MongoDbBasicConverters

Claus Ibsen-2
Hi

Not sure its likely some classloading on jboss wildfly side.

There is a 4.6.0 release of camel-widlfly. And if you still have
trouble then you can report it to their community
https://github.com/wildfly-extras/wildfly-camel

On Tue, May 9, 2017 at 3:52 PM, antopet <[hidden email]> wrote:

> Hi,
> I'm trying to execute a sql from apache Camel. I using version 2.18.2 and
> wildfly 10.1.0 final and wildfly-camel patch 4.5.0
>
> My code is:
>
> from("direct:testDatabase").routeId("testDatabase")
>                 .setHeader("id", constant("hello"))
>                 .to("sql:select * from testtable where
> name=:#id?dataSource=myDS")
>                 .to("log:stream")
>                 .split(body()).streaming()
>                 .to("log:row");
>
> and I got this error
>
> java.lang.NoClassDefFoundError: Could not initialize class
> org.apache.camel.component.mongodb.converters.MongoDbBasicConverters
>
> am I doing something wrong with dependencies?
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-SQL-2-18-2-problem-with-MongoDbBasicConverters-tp5799167.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Camel-SQL 2.18.2 problem with MongoDbBasicConverters

antopet
Hi,

Yes it is something when I run the code in wildfly (in 4.6.0), when I run it in standalone mode I don't get the problem.

I try to connect a PostgresDb not a mongoDB.

And the problem is (from the log):
Is the line,in DefaultSqlPrepareStatmentStrategy.java:
186: Map<?,?> bodyMap = safeMap(exchange.getContext().getTypeConverter().tryConvertTo(Map.class, body));

What I have done is a workaround and rebuild sql Component where I replaced the line with:

Map<?,?> bodyMap = Collections.emptyMap();
if (body instanceof Map<?,?>) {
    bodyMap = safeMap(exchange.getContext().getTypeConverter().tryConvertTo(Map.class, body));
}

I did the same in hasParameter function.

The code is probably not good code, but for now it works for me (and it builds)

The log:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.camel.component.mongodb.converters.MongoDbBasicConverters
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:1370)
        at org.apache.camel.impl.converter.StaticMethodTypeConverter.convertTo(StaticMethodTypeConverter.java:60)
        at org.apache.camel.support.TypeConverterSupport.tryConvertTo(TypeConverterSupport.java:75)
        at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:304)
        at org.apache.camel.impl.converter.BaseTypeConverterRegistry.tryConvertTo(BaseTypeConverterRegistry.java:221)
        at org.apache.camel.impl.converter.BaseTypeConverterRegistry.tryConvertTo(BaseTypeConverterRegistry.java:209)
        at org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.lookupParameter(DefaultSqlPrepareStatementStrategy.java:186)
        at org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy$PopulateIterator.next(DefaultSqlPrepareStatementStrategy.java:279)
        at org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.populateStatement(DefaultSqlPrepareStatementStrategy.java:131)
        at org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:146)
        at org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:116)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
        at org.apache.camel.component.sql.SqlProducer.process(SqlProducer.java:116)
Reply | Threaded
Open this post in threaded view
|

Re: Camel-SQL 2.18.2 problem with MongoDbBasicConverters

antopet
Hi,

I removed the mongodb module from the wildfly, and now everthing work perfect when I call the postgresDB with (4.5.0 and 4.6.0). So it is probably something wrong with the mongodb module that effect the sql Component? how?

//Anton