[ 
https://issues.apache.org/activemq/browse/CAMEL-2730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59401#action_59401
 ] 

Karl Palsson commented on CAMEL-2730:
-------------------------------------

Just to make things less clear, if I just run the test, instead of stepping 
through it, I instead get this sort of garbage...



---- more log above snipped, shows velocity running and the context starting up 
----
2010-05-17 17:30:04,243 DEBUG 
[org.apache.camel.management.DefaultManagementAgent:Camel thread 1: 
seda://makeErrorLog] - <Registered MBean with objectname: 
org.apache.camel:context=lt-karljp/camelContext,type=producers,name=Producer(0xe38fca)>
2010-05-17 17:30:04,243 DEBUG 
[org.apache.camel.component.mock.MockEndpoint$1:Camel thread 1: 
seda://makeErrorLog] - <Starting producer: Producer[mock://errorlog_365]>
2010-05-17 17:30:04,243 DEBUG [org.apache.camel.impl.ProducerCache:Camel thread 
1: seda://makeErrorLog] - <Adding to producer cache with key: 
Endpoint[mock://errorlog_365] for producer: Producer[mock://errorlog_365]>
2010-05-17 17:30:04,243 DEBUG 
[org.apache.camel.component.mock.MockEndpoint:Camel thread 1: 
seda://makeErrorLog] - <mock://errorlog_365 >>>> 1 : Exchange[Message: 
Mon May 17 17:30:04 2010
blah
Arbitrary Error from Fake conax module,1
] with body: null>
2010-05-17 17:30:04,243 DEBUG 
[org.apache.camel.processor.MulticastProcessor:Camel thread 1: 
seda://makeErrorLog] - <Done sequential processing 1 exchanges>
2010-05-17 17:30:04,243 DEBUG 
[org.apache.camel.component.mock.MockEndpoint:main] - <Took 281 millis to 
complete latch>
2010-05-17 17:30:04,243 DEBUG 
[org.apache.camel.component.mock.MockEndpoint:main] - <mock://errorlog_365 
failed and received[1]: Exchange[Message: 
Mon May 17 17:30:04 2010
blah
Arbitrary Error from Fake conax module,1
]>
2010-05-17 17:30:04,243 DEBUG [org.apache.camel.processor.Pipeline:Camel thread 
1: seda://makeErrorLog] - <Message exchange has failed so breaking out of 
pipeline: Exchange[Message: 
Mon May 17 17:30:04 2010
blah
Arbitrary Error from Fake conax module,1
] Exception: org.apache.camel.ResolveEndpointFailedException: Failed to resolve 
endpoint: Mon May 17 17:30:04 2010
blah
Arbitrary Error from Fake conax module due to: Illegal character in scheme name 
at index 3: Mon%20May%2017%2017:30:04%202010
blah
Arbitrary%20Error%20from%20Fake%20conax%20module>
2010-05-17 17:30:04,243 INFO 
[org.springframework.context.support.GenericApplicationContext:main] - <Closing 
org.springframework.context.support.genericapplicationcont...@bdb503: display 
name [org.springframework.context.support.genericapplicationcont...@bdb503]; 
startup date [Mon May 17 17:30:02 GMT 2010]; root of context hierarchy>
2010-05-17 17:30:04,259 DEBUG [org.apache.camel.spring.SpringCamelContext:main] 
- <onApplicationEvent: 
org.springframework.context.event.contextclosedevent[source=org.springframework.context.support.genericapplicationcont...@bdb503:
 display name 
[org.springframework.context.support.genericapplicationcont...@bdb503]; startup 
date [Mon May 17 17:30:02 GMT 2010]; root of context hierarchy]>
2010-05-17 17:30:04,259 ERROR 
[org.apache.camel.component.seda.SedaConsumer:Camel thread 1: 
seda://makeErrorLog] - <Error processing exchange. Exchange[Message: 
Mon May 17 17:30:04 2010
blah
Arbitrary Error from Fake conax module,1
]. Caused by: [org.apache.camel.ResolveEndpointFailedException - Failed to 
resolve endpoint: Mon May 17 17:30:04 2010
blah
Arbitrary Error from Fake conax module due to: Illegal character in scheme name 
at index 3: Mon%20May%2017%2017:30:04%202010
blah
Arbitrary%20Error%20from%20Fake%20conax%20module]>
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: 
Mon May 17 17:30:04 2010
blah
Arbitrary Error from Fake conax module due to: Illegal character in scheme name 
at index 3: Mon%20May%2017%2017:30:04%202010
blah
Arbitrary%20Error%20from%20Fake%20conax%20module
        at 
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:403)
        at 
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:46)
        at 
org.apache.camel.util.ExchangeHelper.resolveEndpoint(ExchangeHelper.java:82)
        at 
org.apache.camel.processor.RecipientList.resolveEndpoint(RecipientList.java:119)
        at 
org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:93)
        at 
org.apache.camel.processor.RecipientList.process(RecipientList.java:81)
        at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at 
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
        at 
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
        at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93)
        at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at 
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at 
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)
        at 
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at 
org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:161)
        at 
org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:109)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.URISyntaxException: Illegal character in scheme name at 
index 3: Mon%20May%2017%2017:30:04%202010
blah
Arbitrary%20Error%20from%20Fake%20conax%20module
        at java.net.URI$Parser.fail(URI.java:2809)
        at java.net.URI$Parser.checkChars(URI.java:2982)
        at java.net.URI$Parser.parse(URI.java:3009)
        at java.net.URI.<init>(URI.java:578)
        at org.apache.camel.util.URISupport.normalizeUri(URISupport.java:165)
        at 
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:401)
        ... 20 more
2010-05-17 17:30:04,259 INFO 
[org.springframework.beans.factory.support.DefaultListableBeanFactory:main] - 
<Destroying singletons in 
org.springframework.beans.factory.support.defaultlistablebeanfact...@14c5b37: 
defining beans 
[camelRouter,conaxRequestFilter,fakeOutputChooser,template,consumerTemplate,camelContext:beanPostProcessor,camelContext,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor];
 root of factory hierarchy>
2010-05-17 17:30:04,275 INFO [org.apache.camel.impl.DefaultCamelContext:main] - 
<Apache Camel 2.2.0 (CamelContext:camelContext) is stopping>
--- more shutdown log snipped ----


> test: Singleton bean creation not allowed while the singletons of this 
> factory are in destruction (Do not request a bean from a BeanFactory in
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2730
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2730
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-spring-integration
>    Affects Versions: 2.2.0
>            Reporter: Karl Palsson
>
> I have the following two routes...
> {code}
>      from("seda:errorQueue")
>                 .multicast()
>                 // unhappy with this, toooo fragile...
>                 .to("bean:fakeOutputChooser?method=chooseError", 
> "seda:makeErrorLog");
>         from("seda:makeErrorLog")
>                 .process(new Processor() {
>                     public void process(Exchange exchange) throws Exception {
>                         ErrorFileEntry efr =  new ErrorFileEntry("blah");
>                         exchange.getIn().setBody(efr);
>                     }
>                 })
>                 .to("velocity:/templates/ErrorLog.vm")
>         .recipientList().method("fakeOutputChooser", "chooseErrorLog");
> {code}
> I'm trying to test that when I send things into {{seda:errorQueue}} that the 
> text is written directly out 2 endpoints, the one chosen by the method 
> "chooseError" on the bean "fakeOutputChooser"   and _also_ that the velocity 
> templated error log gets written to the endpoint chosen by "chooseErrorLog" 
> on the same bean.
> In the past, I didn't use any of this "outputChoosing" and just straight up 
> to() routes using plain "file:" endpoints, and I tested it by hand.  I'm now 
> using  the spring test support, to try and automatically test that my output 
> choosing logic is working.  (I now have to pick a different file endpoint 
> based on some exchange headers)
> I've got the tests all working for most cases, but the following case fails 
> completely....
> {code}
>     @Test
>     @DirtiesContext
>     public void testErrorPath() throws Exception {
>         String someBody = "this will fail because of 4213 in the body";
>         errorOutput.expectedBodiesReceived(someBody);
>         ErrorFileEntry errorBody = new ErrorFileEntry("Mon Jul 26 14:11:25 
> 2010", "something", "awerawer", "1231");
>         errorLog.expectedBodiesReceived(errorBody);
>         directInput.sendBodyAndHeader("direct:input_365", someBody, 
> Exchange.FILE_NAME, "blah");
>         errorOutput.assertIsSatisfied();
>         errorLog.assertIsSatisfied();
>     }
> {code}
> the errorOutput check passes, but the errorLog check fails, it never received 
> any messages.  This is caused by the following debug from spring..
> {quote}
> [org.apache.camel.processor.Pipeline:Camel thread 1: seda://makeErrorLog] - 
> <Message exchange has failed so breaking out of pipeline: Exchange[Message: 
> Mon May 17 16:58:16 2010
> blah
> Arbitrary Error from Fake conax module,1
> ] Exception: org.apache.camel.language.bean.RuntimeBeanExpressionException: 
> Failed to invoke method: chooseErrorLog on fakeOutputChooser due to: 
> org.springframework.beans.factory.BeanCreationNotAllowedException: Error 
> creating bean with name 'fakeOutputChooser': Singleton bean creation not 
> allowed while the singletons of this factory are in destruction (Do not 
> request a bean from a BeanFactory in a destroy method implementation!)>
> {quote}
> The stack trace is gone by the time it gets logged, but it's thrown at 
> BeanExpression.evaluate() line 74 in the 2.2 release code.  
> (processor.process(newExchange)
> I suspect this is because the spring context is torn down, and camel test 
> support is just waiting for things to finish before it can start verifying?  
> If I'm just doing it completely wrong, by all means point me in the right 
> direction :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to