Hello,
I'm trying to perform queries in a database thank to the ibatis component.
My route is the following:
from("jbi:service:http://hp.com/temip/openmediation/routing/insert").
convertBodyTo(RoutingInfo.class).
to("ibatis:insertRouting");
As you can notice I've added a Converter to convert the ServiceMix DOMSource
into the Bean class expected by the IBatis request.
The COnverter implementation is the following (it's a test implementation
for the moment):
@Converter
public class RoutingInfoConverter {
private static Log log = LogFactory.getLog(RoutingInfoConverter.class);
@Converter
public static RoutingInfo toRoutingInfo(DOMSource src) {
log.info("toRoutingInfo");
RoutingInfo routingInfo= new
RoutingInfo("foo","bar");
return routingInfo;
}
But at runtime the Converter is not call. I've got the following error:
DEBUG - SedaQueue -
[EMAIL PROTECTED] dequeued
exchange: InOut[
id: ID:16.17.2.253-119813215c7-6:0
status: Active
role: provider
service: {http://hp.com/temip/openmediation/routing}insert
endpoint: camel16-17-2-253-119813215c7-22-1
in: <?xml version="1.0" encoding="UTF-8"?><hello>world</hello>
]
DEBUG - CamelJbiComponent - Received exchange: status: Active,
role: provider
DEBUG - CamelJbiComponent - Retrieved correlation id:
ID:16.17.2.253-119813215c7-5:0
DEBUG - CamelJbiEndpoint - Received exchange: InOut[
id: ID:16.17.2.253-119813215c7-6:0
status: Active
role: provider
service: {http://hp.com/temip/openmediation/routing}insert
endpoint: camel16-17-2-253-119813215c7-22-1
in: <?xml version="1.0" encoding="UTF-8"?><hello>world</hello>
out: null
]
DEBUG - IBatisComponent - Defaulting to use the iBatis
configuration from: class path resource [SqlMapConfig.xml]
ERROR - DeadLetterChannel - On delivery attempt: 0 caught:
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in org/apache/camel/component/ibatis/Routing.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the insertRouting.
--- Cause: java.sql.SQLException: Invalid parameter object type. Expected
'com.hp.temip.openmediation.routing.db.RoutingInfo' but found 'ja
vax.xml.transform.dom.DOMSource'.
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in org/apache/camel/component/ibatis/Routing.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the insertRouting.
--- Cause: java.sql.SQLException: Invalid parameter object type. Expected
'com.hp.temip.openmediation.routing.db.RoutingInfo' but found 'ja
vax.xml.transform.dom.DOMSource'.
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:59)
Do you have any idea?
Note: The Converter class is well loaded as you can see in the traces:
DEBUG - ResolverUtil - Scanning for classes in
[/C:/dev/apache-servicemix-3.2/data/smx/service-assemblies/temip-routing-sa
/version_2/sus/servicemix-camel/temip-routing-db-su/com/hp/temip/openmediation/routing/db/]
matching criteria: annotated with @Converter
DEBUG - AnnotationTypeConverterLoader - Loading converter class:
org.apache.camel.converter.NIOConverter
DEBUG - AnnotationTypeConverterLoader - Loading converter class:
org.apache.camel.converter.jaxp.XmlConverter
DEBUG - AnnotationTypeConverterLoader - Loading converter class:
org.apache.camel.converter.IOConverter
DEBUG - AnnotationTypeConverterLoader - Loading converter class:
org.apache.camel.converter.CollectionConverter
DEBUG - AnnotationTypeConverterLoader - Loading converter class:
com.hp.temip.openmediation.routing.db.RoutingInfoConverter
DEBUG - AnnotationTypeConverterLoader - Loading converter class:
org.apache.camel.converter.ObjectConverter
Note 2: I use Camel 1.2
Thank for you help
Christophe
--
View this message in context:
http://www.nabble.com/Need-help-on-ibatis-component-usage-tp16851028s22882p16851028.html
Sent from the Camel - Users mailing list archive at Nabble.com.