The bug that I found just related to the RouterBuilder not the Spring configuration part. After adding spring test[1] and went though the code revision, I found James already fixed the Spring part of configuration in CAMEL-662[2]. Please make sure you are using the official Apache Camel 1.4.0 release.

[1]https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/ErrorHandlerTest.java
[2]https://issues.apache.org/activemq/browse/CAMEL-662

Willem

Willem Jiang wrote:
Hi  Marc
FYI  I just did a quick fix for your issue.
Please check out the latest camel snapshot for verification.

Cheers,

Willem
Willem Jiang wrote:
Hi ,

I just dug the code, you can't set the errorHandler from CamelContext in Camel1.4.0, I just fill a JIRA[1] for this issue.
You can walk around it by using the DSL.

[1]https://issues.apache.org/activemq/browse/CAMEL-751

Willem
mcobery wrote:
Hi,

I am attempting to upgrade from Camel 1.3 to Camel 1.4 so we can use its
exception handling features and configuration.  I have been trying to
configure the DeadLetterChannel all day via errorHandlerRef attribute on the Camel Context and on the route element within the Camel context to no avail.

My setup is as follows:
-Defined Spring configuration file that defines my Camel CXF endpoints and Camel Context with its routes. -Run the application through the Maven Jetty Plugin. -Make a web service request via SOAPUI to the create method on the Archetype Web Service with an error in XML payload of the request. This error in the payload causes the JAXB unmarshall to pass null to the archetypeBSO bean
defined in Camel route.
-The DAO within the BSO throws an exception when it attempts to save a null object. -The stacktrace shows that the Camel Route is being followed but the DeadLetterChannel configuration is not. Any suggestions? What am I doing wrong? Any help will be greatly
appreciated.

Regards,
Marc

Here is my configuration.

<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://www.springframework.org/schema/beans";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:jaxws="http://cxf.apache.org/jaxws";
  xmlns:soap="http://cxf.apache.org/bindings/soap";
  xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint";
  xmlns:lang="http://www.springframework.org/schema/lang";
  xmlns:camel="http://activemq.apache.org/camel/schema/spring";
  xsi:schemaLocation="
    http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/camel/schema/cxfEndpoint http://activemq.apache.org/camel/schema/cxfEndpoint/camel-cxf.xsd
    http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
    http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
    http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
    http://www.springframework.org/schema/lang
http://www.springframework.org/schema/lang/spring-lang-2.5.xsd";>

  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<!-- ******************************************************************
-->
<!-- ********* CXF ENDPOINTS ********
-->
<!-- ******************************************************************
-->
  <cxf:cxfEndpoint
    id="archetypeService"
    serviceClass="com.rulestream.ws.knowledge.ArchetypeWebService"
    address="/ArchetypeService"
    endpointName="t:ArchetypeService"
    serviceName="t:archetypeService"
    xmlns:t="http://core.rulestream.com";>
  </cxf:cxfEndpoint>


<!-- ******************************************************************
-->
<!-- ********* CXF ENDPOINTS ********
-->
<!-- ******************************************************************
-->

<!-- ******************************************************************
-->
<!-- ********* CAMEL ROUTING ********
-->
<!-- ******************************************************************
-->
  <camel:camelContext id="main.context"
errorHandlerRef="cxfDeadLetterErrorHandler">
    <camel:jmxAgent id="agent" disabled="true"/>
    <camel:route>
      <camel:from uri="cxf://bean:archetypeService" />
      <camel:process ref="cxfIn" />
      <camel:choice>
        <camel:when>
          <camel:groovy>exchange.in.headers.operationName ==
'create'</camel:groovy>
          <camel:to uri="bean:archetypeBSO?methodName=create" />
          <camel:process ref="archetypeProcessor" />
        </camel:when>
        <camel:when>
          <camel:groovy>exchange.in.headers.operationName ==
'delete'</camel:groovy>
          <camel:to uri="bean:archetypeBSO?methodName=delete" />
          <camel:process ref="booleanProcessor" />
        </camel:when>
        <camel:when>
          <camel:groovy>exchange.in.headers.operationName ==
'find'</camel:groovy>
          <camel:to uri="bean:archetypeBSO?methodName=find" />
          <camel:process ref="archetypeListProcessor" />
        </camel:when>
        <camel:when>
          <camel:groovy>exchange.in.headers.operationName ==
'save'</camel:groovy>
          <camel:to uri="bean:archetypeBSO?methodName=save" />
          <camel:process ref="archetypeProcessor" />
        </camel:when>
        <camel:otherwise>
          <camel:recipientList>
            <camel:groovy>
'bean:archetypeBSO?methodName='+exchange.in.headers.operationName
            </camel:groovy>
          </camel:recipientList>
          <camel:process ref="archetypeProcessor" />
        </camel:otherwise>
      </camel:choice>
      <camel:to
uri="bean:facetSpecConverter?methodName=clearPreviouslyConvertedDTOs" />
      <camel:to
uri="bean:facetSpecConverter?methodName=clearPreviouslyConvertedDomainObjects"
/>
      <camel:to
uri="bean:facetSpecGraphBuilder?methodName=clearPreviouslyBuiltObjects" />
    </camel:route>
  </camel:camelContext>
<bean id="exceptionProcessor" class="com.rulestream.ws.shared.processors.CxfOutExceptionProcessor"/>
    <bean id="cxfDeadLetterErrorHandler"
        class="org.apache.camel.builder.DeadLetterChannelBuilder">
    <property name="defaultDeadLetterEndpointUri"
value="bean:exceptionProcessor" />
    <property name="redeliveryPolicy" ref="rsRedeliveryPolicyConfig" />
  </bean>

  <bean id="rsRedeliveryPolicyConfig"
        class="org.apache.camel.processor.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="1" />
<property name="initialRedeliveryDelay" value="30000"/> <property name="useExponentialBackOff" value="true"/> </bean> <!-- ******************************************************************
-->
<!-- ********* CAMEL ROUTING ********
-->
<!-- ******************************************************************
-->
</beans>

Here is the stacktrace:

[RULESTREAM] ERROR [btpool0-1] BaseEntityBSO.create(124) | 60002 : Error
saving the version!!!!
[RULESTREAM] ERROR [btpool0-1] DeadLetterChannel.log(189) | Failed delivery for exchangeId: ID-mcobery/3170-1216852528171/0-0. On delivery attempt: 5 caught: com.rulestream.core.shared.exceptions.RSRuntimeException: 60002 :
Error saving the version!!!!
com.rulestream.core.shared.exceptions.RSRuntimeException: 60002 : Error
saving the version!!!!
    at
com.rulestream.core.shared.bso.BaseEntityBSO.create(BaseEntityBSO.java:126)
    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:585)
    at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy76.create(Unknown Source)
    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:585)
at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:124) at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:68)
    at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:110)
    at
org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:92)
    at
org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:66)
    at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:75)
    at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
    at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
    at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:57)
    at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:50)
    at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:50)
    at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
    at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
    at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
    at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
    at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
    at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
    at
org.apache.camel.component.cxf.CamelInvoker.invoke(CamelInvoker.java:167)
    at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
    at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
    at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
    at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
    at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
    at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
    at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:279)
    at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:161)
    at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:174)
    at
org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:152)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
    at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
    at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at
org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
    at
org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    at
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at
org.appfuse.webapp.filter.LocaleFilter.doFilterInternal(LocaleFilter.java:74)
    at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at
com.opensymphony.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:42)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
    at
org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    at
org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:52)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:109)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:173)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:271)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
    at
org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at
org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    at
org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
    at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
    at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
    at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
    at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
Caused by: java.lang.NullPointerException
    at
com.rulestream.core.shared.dao.GenericDAOImpl.save(GenericDAOImpl.java:68)
    at
com.rulestream.core.shared.dao.GenericDAOImpl.save(GenericDAOImpl.java:1)
    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:585)
    at
com.rulestream.core.util.InvocationHandlerDelegate.invoke(InvocationHandlerDelegate.java:42)
    at
com.rulestream.core.shared.dao.GenericDAOFactoryBean$GenericDAOInvocationHandler.invoke(GenericDAOFactoryBean.java:227)
    at $Proxy56.save(Unknown Source)
    at
com.rulestream.core.shared.bso.BaseEntityBSO.create(BaseEntityBSO.java:119)
    ... 120 more
[RULESTREAM] ERROR [btpool0-1] DeadLetterChannel.process(78) |
Exchange[BodyType:org.apache.xerces.dom.DocumentImpl, Body:<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:core="http://core.rulestream.com";>
   <soapenv:Header/>
   <soapenv:Body/></soapenv:Envelope>]
Regards,
Marc





Reply via email to