You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Harald Wellmann <hw...@gmail.com> on 2012/09/05 10:43:48 UTC

Problem with Camel proxies and hashCode()

In a Spring Web + JPA application running on Tomcat, I'm using
CamelProxyFactoryBean to create a proxy for a service interface, where
the actual service implementation is a remote JMS endpoint. The
service is @InOnly.

When shutting down the web application, I'm getting an exception from
the proxy when Spring's  PersistenceAnnotationBeanPostProcessor the
hashCode() method of the proxied bean: The proxy forwards the
hashCode() invocation to the remote end which is not available, so the
invocation times out and causes the exception.

I'm not sure how to solve this. There doesn't seem to be an API to
customize the CamelInvocationHandler. Shouldn't the invocation handler
invoke hashCode() and equals() locally, at least in the @InOnly case,
which explicitly indicates that no responses should be expected from
the remote endpoint?

Best regards,
Harald

Re: Problem with Camel proxies and hashCode()

Posted by Harald Wellmann <hw...@gmail.com>.
Here's an issue with a test case attached:
https://issues.apache.org/jira/browse/CAMEL-5571

Best regards,
Harald

> 2012/9/5 Claus Ibsen <cl...@gmail.com>:
>>
>> Yeah methods from java.lang.Object should be omitted to be remotely called.
>>
>> Do you have a stacktrace? And can you create a small unit test that
>> reproduces the issue?
>> For example without all the Spring / JPA stuff so we can use it in
>> camel-core for testing.
>>
>>

Re: Problem with Camel proxies and hashCode()

Posted by Harald Wellmann <hw...@gmail.com>.
Ok, I'll try to write a self-contained test. Shouldn't be too hard, I
see the same exception when calling proxy.hashCode() in my own
methods.

Best regards,
Harald

2012/9/5 Claus Ibsen <cl...@gmail.com>:
>
> Yeah methods from java.lang.Object should be omitted to be remotely called.
>
> Do you have a stacktrace? And can you create a small unit test that
> reproduces the issue?
> For example without all the Spring / JPA stuff so we can use it in
> camel-core for testing.
>
>

Re: Problem with Camel proxies and hashCode()

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Sep 5, 2012 at 10:43 AM, Harald Wellmann <hw...@gmail.com> wrote:
> In a Spring Web + JPA application running on Tomcat, I'm using
> CamelProxyFactoryBean to create a proxy for a service interface, where
> the actual service implementation is a remote JMS endpoint. The
> service is @InOnly.
>
> When shutting down the web application, I'm getting an exception from
> the proxy when Spring's  PersistenceAnnotationBeanPostProcessor the
> hashCode() method of the proxied bean: The proxy forwards the
> hashCode() invocation to the remote end which is not available, so the
> invocation times out and causes the exception.
>
> I'm not sure how to solve this. There doesn't seem to be an API to
> customize the CamelInvocationHandler. Shouldn't the invocation handler
> invoke hashCode() and equals() locally, at least in the @InOnly case,
> which explicitly indicates that no responses should be expected from
> the remote endpoint?
>
> Best regards,
> Harald

Yeah methods from java.lang.Object should be omitted to be remotely called.

Do you have a stacktrace? And can you create a small unit test that
reproduces the issue?
For example without all the Spring / JPA stuff so we can use it in
camel-core for testing.


-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen