You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by woggle23 <ma...@yahoo.co.uk> on 2011/07/01 10:13:05 UTC

Re: intercept using adviceWith()

Hi Claus

I tried moving the adviceWith() to the actual test method, still no joy I'm
afraid. It still works fine with a single interceptor, adding the 2nd still
causes problems though; the message is still intercepted but the error
handling doesn't work (as before).

Did you try running this yourself? If so, what version of Camel were you
using? The above error description relates to version 2.7.0. Running with
version 2.8-SNAPSHOT yields the following stackdump:

java.lang.NoSuchMethodError:
org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
	at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)
	at
org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:609)
	at
org.woggle23.DatabaseErrorTest.createCamelContext(DatabaseErrorTest.java:69)
	at org.apache.camel.test.CamelTestSupport.setUp(CamelTestSupport.java:115)
	at junit.framework.TestCase.runBare(TestCase.java:132)
	at org.apache.camel.test.TestSupport.runBare(TestSupport.java:65)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
	at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
	at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
	at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

Updated test case:
http://camel.465427.n5.nabble.com/file/n4541328/unittestissue.zip
unittestissue.zip 

Cheers

Matt

--
View this message in context: http://camel.465427.n5.nabble.com/intercept-using-adviceWith-tp4520468p4541328.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: intercept using adviceWith()

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jul 1, 2011 at 10:43 AM, Claus Ibsen <cl...@gmail.com> wrote:
> I dont have the time currently to look into this. Will likely get time
> later next week.
> The adviceWith has some limitations, and you may have hit such.
>

I have marked this conversation with a star in gmail, so I will get back to it.
Otherwise keep reminding me, later next week :)

PS: When we do some internal refactorings/optimization in the camel
routing engine. Then doing this adviceWith would become easier as the
engine supports this fully dynamically.


>
> On Fri, Jul 1, 2011 at 10:13 AM, woggle23 <ma...@yahoo.co.uk> wrote:
>> Hi Claus
>>
>> I tried moving the adviceWith() to the actual test method, still no joy I'm
>> afraid. It still works fine with a single interceptor, adding the 2nd still
>> causes problems though; the message is still intercepted but the error
>> handling doesn't work (as before).
>>
>> Did you try running this yourself? If so, what version of Camel were you
>> using? The above error description relates to version 2.7.0. Running with
>> version 2.8-SNAPSHOT yields the following stackdump:
>>
>> java.lang.NoSuchMethodError:
>> org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
>>        at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)
>>        at
>> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:609)
>>        at
>> org.woggle23.DatabaseErrorTest.createCamelContext(DatabaseErrorTest.java:69)
>>        at org.apache.camel.test.CamelTestSupport.setUp(CamelTestSupport.java:115)
>>        at junit.framework.TestCase.runBare(TestCase.java:132)
>>        at org.apache.camel.test.TestSupport.runBare(TestSupport.java:65)
>>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>>        at junit.framework.TestResult.run(TestResult.java:113)
>>        at junit.framework.TestCase.run(TestCase.java:124)
>>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>>        at junit.framework.TestSuite.run(TestSuite.java:227)
>>        at
>> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>>        at
>> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>>        at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>>        at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>>        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>>        at
>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>>
>> Updated test case:
>> http://camel.465427.n5.nabble.com/file/n4541328/unittestissue.zip
>> unittestissue.zip
>>
>> Cheers
>>
>> Matt
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/intercept-using-adviceWith-tp4520468p4541328.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



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

Re: intercept using adviceWith()

Posted by Claus Ibsen <cl...@gmail.com>.
I dont have the time currently to look into this. Will likely get time
later next week.
The adviceWith has some limitations, and you may have hit such.


On Fri, Jul 1, 2011 at 10:13 AM, woggle23 <ma...@yahoo.co.uk> wrote:
> Hi Claus
>
> I tried moving the adviceWith() to the actual test method, still no joy I'm
> afraid. It still works fine with a single interceptor, adding the 2nd still
> causes problems though; the message is still intercepted but the error
> handling doesn't work (as before).
>
> Did you try running this yourself? If so, what version of Camel were you
> using? The above error description relates to version 2.7.0. Running with
> version 2.8-SNAPSHOT yields the following stackdump:
>
> java.lang.NoSuchMethodError:
> org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
>        at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)
>        at
> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:609)
>        at
> org.woggle23.DatabaseErrorTest.createCamelContext(DatabaseErrorTest.java:69)
>        at org.apache.camel.test.CamelTestSupport.setUp(CamelTestSupport.java:115)
>        at junit.framework.TestCase.runBare(TestCase.java:132)
>        at org.apache.camel.test.TestSupport.runBare(TestSupport.java:65)
>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>        at junit.framework.TestResult.run(TestResult.java:113)
>        at junit.framework.TestCase.run(TestCase.java:124)
>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>        at junit.framework.TestSuite.run(TestSuite.java:227)
>        at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>        at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>        at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>        at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>
> Updated test case:
> http://camel.465427.n5.nabble.com/file/n4541328/unittestissue.zip
> unittestissue.zip
>
> Cheers
>
> Matt
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/intercept-using-adviceWith-tp4520468p4541328.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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

Re: intercept using adviceWith()

Posted by Claus Ibsen <cl...@gmail.com>.
The JIRA is
https://issues.apache.org/jira/browse/CAMEL-4184

And I am currently testing a possible fix. Keep an eye on the JIRA
ticket for updates.
And when/if a commit with a fix is committed then please give a test
on your system with the latest source code.

On Thu, Jul 7, 2011 at 12:27 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> I have reproduced the issue. The problem is when you use context
> scoped onException.
> If you define the onException on each route, then it works.
>
> I will log a JIRA and see what can be done.
>
>
>
> On Fri, Jul 1, 2011 at 10:13 AM, woggle23 <ma...@yahoo.co.uk> wrote:
>> Hi Claus
>>
>> I tried moving the adviceWith() to the actual test method, still no joy I'm
>> afraid. It still works fine with a single interceptor, adding the 2nd still
>> causes problems though; the message is still intercepted but the error
>> handling doesn't work (as before).
>>
>> Did you try running this yourself? If so, what version of Camel were you
>> using? The above error description relates to version 2.7.0. Running with
>> version 2.8-SNAPSHOT yields the following stackdump:
>>
>> java.lang.NoSuchMethodError:
>> org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
>>        at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)
>>        at
>> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:609)
>>        at
>> org.woggle23.DatabaseErrorTest.createCamelContext(DatabaseErrorTest.java:69)
>>        at org.apache.camel.test.CamelTestSupport.setUp(CamelTestSupport.java:115)
>>        at junit.framework.TestCase.runBare(TestCase.java:132)
>>        at org.apache.camel.test.TestSupport.runBare(TestSupport.java:65)
>>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>>        at junit.framework.TestResult.run(TestResult.java:113)
>>        at junit.framework.TestCase.run(TestCase.java:124)
>>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>>        at junit.framework.TestSuite.run(TestSuite.java:227)
>>        at
>> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>>        at
>> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>>        at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>>        at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>>        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>>        at
>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>>
>> Updated test case:
>> http://camel.465427.n5.nabble.com/file/n4541328/unittestissue.zip
>> unittestissue.zip
>>
>> Cheers
>>
>> Matt
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/intercept-using-adviceWith-tp4520468p4541328.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



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

Re: intercept using adviceWith()

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I have reproduced the issue. The problem is when you use context
scoped onException.
If you define the onException on each route, then it works.

I will log a JIRA and see what can be done.



On Fri, Jul 1, 2011 at 10:13 AM, woggle23 <ma...@yahoo.co.uk> wrote:
> Hi Claus
>
> I tried moving the adviceWith() to the actual test method, still no joy I'm
> afraid. It still works fine with a single interceptor, adding the 2nd still
> causes problems though; the message is still intercepted but the error
> handling doesn't work (as before).
>
> Did you try running this yourself? If so, what version of Camel were you
> using? The above error description relates to version 2.7.0. Running with
> version 2.8-SNAPSHOT yields the following stackdump:
>
> java.lang.NoSuchMethodError:
> org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
>        at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)
>        at
> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:609)
>        at
> org.woggle23.DatabaseErrorTest.createCamelContext(DatabaseErrorTest.java:69)
>        at org.apache.camel.test.CamelTestSupport.setUp(CamelTestSupport.java:115)
>        at junit.framework.TestCase.runBare(TestCase.java:132)
>        at org.apache.camel.test.TestSupport.runBare(TestSupport.java:65)
>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>        at junit.framework.TestResult.run(TestResult.java:113)
>        at junit.framework.TestCase.run(TestCase.java:124)
>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>        at junit.framework.TestSuite.run(TestSuite.java:227)
>        at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>        at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>        at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>        at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>        at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>
> Updated test case:
> http://camel.465427.n5.nabble.com/file/n4541328/unittestissue.zip
> unittestissue.zip
>
> Cheers
>
> Matt
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/intercept-using-adviceWith-tp4520468p4541328.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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