-
1. Re: ClassCastException with RmiEndpoint
davsclaus Apr 18, 2011 3:35 AM (in response to manta7)Hi
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:
hello.setRemoteInterfaces(HelloInterface.class);
-
2. Re: ClassCastException with RmiEndpoint
manta7 Apr 18, 2011 4:58 AM (in response to davsclaus)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:
org
|__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
-
3. Re: ClassCastException with RmiEndpoint
manta7 Apr 18, 2011 5:02 AM (in response to davsclaus)I didn't work
Even with the hello.setRemoteInterfaces(HelloInterface.class); way..
I still have the same exception!
-
4. Re: ClassCastException with RmiEndpoint
manta7 Apr 18, 2011 8:59 AM (in response to davsclaus)Finally I used this:
to("rmi://localhost:1099/Hello1?remoteInterfaces=org.xx.HelloInterface");
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
-
5. Re: ClassCastException with RmiEndpoint
manta7 Apr 18, 2011 11:15 AM (in response to manta7)My workflow is the following:
from(Queue).
bean(Bean.class, "processExchange").
convertBodyTo(String.class, "UTF-8").
enrich("direct:hello").
to(ExchangePattern.InOut, "jbi:endpoint:service:endpoint");
And my direct:hello
from("direct:hello").
to("rmi://localhost:1099/Hello1?remoteInterfaces=HelloInterface");
And I have this exception:
No type converter available to convert from type: java.lang.String to the required type: java.rmi.Remote
:(...
-
6. Re: ClassCastException with RmiEndpoint
davsclaus Apr 19, 2011 4:07 AM (in response to manta7)What version of Camel are you using?
And what's the method signature of your hello interface?