You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by yeandone <wi...@gmail.com> on 2015/01/24 02:50:47 UTC

Apache Camel Base64 Encoding Issue: java.lang.NoSuchMethodError

Hi, Claus and Camel Friends.

  I am encountering an issue with base64 marshal while my code is running on
QA server. When the code was deployed to dev server, it didn't have any
issues. But recently when it's deployed to QA server, it couldn't perform
base64 marshal which specified in my following route and prompted the
following error track log. It's very weird. I also checked the jars deployed
on QA server. The camel base64 jar was included and there was no apache
commons codec jar conflicts. 
  I am using Camel 2.12. Please let me know if  you have any idea why the
issue occurs in QA server.  Any help or idea will be really appreciated!

Dependency:
		<dependency>
		    <groupId>org.apache.camel</groupId>
		    <artifactId>camel-base64</artifactId>
		    <version>${camel-version}</version>
		</dependency>

Bean: 

         <bean id="base64"
class="org.apache.camel.model.dataformat.Base64DataFormat">
   	</bean>

Route:
       		<route id="Encode-Route">
			<from uri="direct:encode" />
			<marshal ref="base64" />
			<to uri="sftp:xxx?password=xxx" />
		</route>

Trace Log:
Issues:

 org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[MKP.txt]
        at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1368)
        at
org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:283)
        at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:224)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at
org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:111)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:60)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:166)
        at
org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:401)
        at
org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:99)
        at
org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201)
        at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165)
        at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)
        at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
        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:662)
Caused by: java.lang.NoSuchMethodError:
org.apache.commons.codec.binary.Base64.<init>(I[BZ)V
        at
org.apache.camel.dataformat.base64.Base64DataFormat.createCodec(Base64DataFormat.java:59)
        at
org.apache.camel.dataformat.base64.Base64DataFormat.marshal(Base64DataFormat.java:39)
        at
org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:81)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
        at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
        at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)
        at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)
        at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:215)
        ... 25 more



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Base64-Encoding-Issue-java-lang-NoSuchMethodError-tp5762074.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel Base64 Encoding Issue: java.lang.NoSuchMethodError

Posted by yeandone <wi...@gmail.com>.
Hi, Claus, Willem, and Camel Friends.

  Do you have any idea how to resolve the issue above? Any idea and help
will be greatly appreciated.


Thanks.
Will



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Base64-Encoding-Issue-java-lang-NoSuchMethodError-tp5762074p5762097.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel Base64 Encoding Issue: java.lang.NoSuchMethodError

Posted by yeandone <wi...@gmail.com>.
Hi, Willem.

  It seems there might be a different version of common codec in the class
patch. In our QA server, there are many different projects installed and
they share the same JVM\Classpath so it seems there may be another maven
project is currently using a lower version of commons codec jar. So when my
class is running and trying to call base64 jar, maven may refer to the
nearest commons codec which is the lower version. I wonder if I can fix this
jar issue in my class with maven/pom. I am not able to change other
projects' dependency as they are managed by developers and I do not want to
change or impact their commons codec jar as their projects may have to use a
lower version. So how can I change my class or maven so that my class will
use the particular higer version of commons codec while my code is running
base64 marshal.

Again thanks for the help!

谢谢大神!


My POM: 
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-base64</artifactId>
                    <version>${camel-version}</version>
                </dependency>

Bean: 

         <bean id="base64"
class="org.apache.camel.model.dataformat.Base64DataFormat">
    </bean>
 



--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Base64-Encoding-Issue-java-lang-NoSuchMethodError-tp5762074p5762126.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Apache Camel Base64 Encoding Issue: java.lang.NoSuchMethodError

Posted by Willem Jiang <wi...@gmail.com>.
It looks like you have different version of common codec in your class patch.
Can you use “mvn dependency:tree” to check if there is a lower version of common codec is included in your class path.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 24, 2015 at 9:51:53 AM, yeandone (willcoursera@gmail.com) wrote:
> > at java.lang.Thread.run(Thread.java:662)
> Caused by: java.lang.NoSuchMethodError:
> org.apache.commons.codec.binary.Base64.(I[BZ)V  
> at