Sorry I sent the original message from my iPhone, hoping it was a known issue
and a quick workaround.
Below is a small program showing the problem.
Change the camel version in the pom from 2.0.0 to 2.1.0 to see the error.
RCPTest.java
package test;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.bean.ProxyHelper;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.log4j.*;
public class RPCTest {
public static void main(String[] args) throws Exception {
Logger.getRootLogger().addAppender(new ConsoleAppender(new
PatternLayout(PatternLayout.DEFAULT_CONVERSION_PATTERN)));
CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new RouteBuilder() {
public void configure() {
from("vm:echo").bean(new Echo() {
public String echo(String text) {
return text;
}
});
}
});
camelContext.start();
Echo service =
ProxyHelper.createProxy(camelContext.getEndpoint("vm:echo"), Echo.class);
//prints "test"
System.out.println(service.echo("test"));
//prints "null" for Camel 2.0 but error for Camel 2.1
System.out.println(service.echo(null));
}
public static interface Echo{
String echo(String text);
}
}
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>jmsproblem</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</project>
On Dec 7, 2009, at 2:18 PM, Claus Ibsen wrote:
> Hi
>
> Could you please use more time to report this issue?
>
> Create a JIRA ticket and attach a sample with the problem if possible.
> At least post the stacktrace and you route and remote service
> interfaces and whatnot, so we have something to use to track the
> issue.
>
>
> On Mon, Dec 7, 2009 at 7:52 PM, Ming Fang <[email protected]> wrote:
>> Camel v2.1 no longer allow remote service to return null value.
>> I'm getting a InvalidPayloadException in CamelInvocationHandler.invoke().
>>
>> This is a bug since it is legal to return null values.
>>
>
>
>> --Ming
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus