Avoid using Class.forName to load the interface as you are not in control of the classloader.
And hence why you see the weird class cast exception. But in reality the interface has been loaded by 2 different classloaders and thus it can't be casted.
Try doing something like this instead:
Ok I see, but if i do that, maven at the compilation-time don't found my interface..
How can I add my interface to RouteBuilder?
I have this architecture:
|__a -> MyRouteBuilder.java
|__b -> HelloInterface.java
And an "import org.b.HelloInterface;" doesn't work..
Edit: I have to add my HelloInterface to the ressources directory
Edited by: manta7 on Apr 18, 2011 8:58 AM
I didn't work
Even with the hello.setRemoteInterfaces(HelloInterface.class); way..
I still have the same exception!
Finally I used this:
And I think it's working because it pass the compilation and the deployment time..
But now during the execution of my workflow, I have this error:
Caused by: org.apache.camel.InvalidPayloadException: No body available of type: java.rmi.Remote but has value: B@715cb7 of type: byte on: Message:[B@715cb7.
Caused by: No type converter available to convert from type: byte to the required type: java.rmi.Remote with value B@715cb7. ExchangeMessage: B@715cb7.
Caused by: org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: byte to the required type: java.rmi.Remote with value B@715cb7
Do I need a converter ?...
Edited by: manta7 on Apr 18, 2011 12:58 PM
Edited by: manta7 on Apr 18, 2011 12:59 PM
My workflow is the following:
And my direct:hello
And I have this exception:
No type converter available to convert from type: java.lang.String to the required type: java.rmi.Remote
What version of Camel are you using?
And what's the method signature of your hello interface?