Hi Try without the spring RMI exporter. It seems like Spring injects a Proxy.
On Thu, Feb 17, 2011 at 10:15 AM, bdusauso <[email protected]> wrote: > > Hi, > > I'm trying to invoke a RMI service with Camel. > This RMI service is exported with Spring RmiServiceExporter. > > But I have a type conversion problem with Camel. > It says : > > Caused by: org.apache.camel.InvalidPayloadException: No body available of > type: org.springframework.remoting.support.RemoteInvocation but has value: > Hello Camel-RMI !!! of type: java.lang.String on: Message: Hello Camel-RMI > !!!. Caused by: No type converter available to convert from type: > java.lang.String to the required type: > org.springframework.remoting.support.RemoteInvocation with value Hello > Camel-RMI !!!. Exchange[Message: Hello Camel-RMI !!!]. Caused by: > [org.apache.camel.NoTypeConversionAvailableException - No type converter > available to convert from type: java.lang.String to the required type: > org.springframework.remoting.support.RemoteInvocation with value Hello > Camel-RMI !!!] > at > org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:102) > at > org.apache.camel.builder.ExpressionBuilder$31.evaluate(ExpressionBuilder.java:798) > ... 50 more > Caused by: org.apache.camel.NoTypeConversionAvailableException: No type > converter available to convert from type: java.lang.String to the required > type: org.springframework.remoting.support.RemoteInvocation with value Hello > Camel-RMI !!! > at > org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:143) > at > org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100) > ... 51 more > > Here's my Spring/Camel configuration : > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring-2.6.0.xsd"> > > <camelContext xmlns="http://camel.apache.org/schema/spring"> > <route> > <from uri="direct:start"/> > <to uri="rmi://localhost:1099/logService"/> > </route> > </camelContext> > > <!-- This class outputs the String passed as argument to stdout --> > <bean id="logService" class="be.drunkcoders.camel.SimpleLogService"/> > > <bean class="org.springframework.remoting.rmi.RmiServiceExporter"> > <property name="serviceName" value="logService"/> > <property name="serviceInterface" > value="be.drunkcoders.camel.LogService"/> > <property name="service" ref="logService"/> > </bean> > </beans> > > And here's the main class : > > public class Main { > > public static void main(String[] args) throws Exception { > > AbstractXmlApplicationContext springCtx = new > ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml"); > springCtx.start(); > > CamelContext camelCtx = springCtx.getBean(CamelContext.class); > camelCtx.start(); > > ProducerTemplate template = camelCtx.createProducerTemplate(); > template.sendBody("direct:start", "Hello Camel-RMI !!!"); > > camelCtx.stop(); > springCtx.stop(); > } > } > > On the other side, if I use a Spring RMI client (made with > RmiProxyFactoryBean) it works well, but then I don't use camel-rmi component > at all, of course. > > Am I doing something wrong ? > > Regards. > > PS : it seems I cannot post directly from email to the mailing-list. Each > time I try the mail seems to get stuck somewhere (maybe blocked ?) but I > don't get any errors. > Can someone please tell me if I'm not blocked, for whatever reason, on this > mailing-list ? > Thanks. > -- > View this message in context: > http://camel.465427.n5.nabble.com/RMI-Component-tp3389123p3389123.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
