Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7262

IAE with calling String.replaceAll via simple expression in Karaf

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.12.2, 2.12.3
    • Fix Version/s: 2.11.5, 2.12.4, 2.13.0
    • Component/s: camel-core, karaf
    • Labels:
      None
    • Environment:

      Karaf version: 2.3.3
      JDK/JRE: Oracle JDK 1.7.0_51
      OS: Windows 7 Pro

    • Estimated Complexity:
      Unknown

      Description

      I have a Camel route along which I do something like this:

      <setHeader headerName="CamelHttpPath">
        <simple>/resource/${headers.RESOURCE_ID.replaceAll("/", "%2F")}</simple>
      </setHeader>
      

      The header RESOURCE_ID is a String. I have JUnit test set up for the route and it passes OK. But when I deploy my bundle to Karaf I get the following exception:

      org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: .replaceAll("/", "%2F") on null due to: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: replaceAll("/", "%2F") on null due to: java.lang.IllegalArgumentException: name must be specified and not empty
      	at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:117)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:132)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:121)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.model.language.ExpressionDefinition.evaluate(ExpressionDefinition.java:113)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.builder.ExpressionBuilder$KeyedOgnlExpressionAdapter.evaluate(ExpressionBuilder.java:1814)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.builder.ExpressionBuilder$58.evaluate(ExpressionBuilder.java:1381)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.builder.SimpleBuilder.evaluate(SimpleBuilder.java:83)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.builder.ProcessorBuilder$4.process(ProcessorBuilder.java:103)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:215)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:215)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Splitter.process(Splitter.java:98)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:215)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:215)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Splitter.process(Splitter.java:98)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:58)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:401)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[73:org.apache.camel.camel-core:2.12.2]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_51]
      	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)[:1.7.0_51]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_51]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_51]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_51]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_51]
      	at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]
      Caused by: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: replaceAll("/", "%2F") on null due to: java.lang.IllegalArgumentException: name must be specified and not empty
      	at org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:285)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:114)[73:org.apache.camel.camel-core:2.12.2]
      	... 90 more
      Caused by: java.lang.IllegalArgumentException: name must be specified and not empty
      	at org.apache.camel.util.ObjectHelper.notEmpty(ObjectHelper.java:331)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.core.osgi.OsgiClassResolver.doLoadClass(OsgiClassResolver.java:87)[76:org.apache.camel.camel-spring:2.12.2]
      	at org.apache.camel.core.osgi.OsgiClassResolver.resolveClass(OsgiClassResolver.java:47)[76:org.apache.camel.camel-spring:2.12.2]
      	at org.apache.camel.component.bean.BeanHelper.isAssignableToExpectedType(BeanHelper.java:121)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.bean.MethodInfo$2.evaluateParameterValue(MethodInfo.java:515)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:472)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:239)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:278)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:180)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:148)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:67)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:189)[73:org.apache.camel.camel-core:2.12.2]
      	at org.apache.camel.language.bean.BeanExpression$OgnlInvokeProcessor.process(BeanExpression.java:281)[73:org.apache.camel.camel-core:2.12.2]
      	... 91 more
      

      The notable difference seems to be that the JUnit test uses DefaultClassResolver instead of OsgiClassResolver which is used in Karaf.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                njiang Willem Jiang
                Reporter:
                joni.nousiainen Joni Nousiainen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: