Friday, 15 March 2013

spring - Apache camel throwing linkage error -



spring - Apache camel throwing linkage error -

i have included apache camel within application forwards requests matching string pattern.

when seek deploy packaged web application within jetty application server (version 7.6.1.v20120215), application crashes out throwing linkage error.

i tried compile camel source few changes in camel-parent, pom.xml uses same version of dependencies used jetty server , web application.

below changes have done within camel-parent, pom.xml:

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupid>org.apache.camel</groupid> <artifactid>camel</artifactid> <version>2.10.3</version> </parent> <modelversion>4.0.0</modelversion> <groupid>org.apache.camel</groupid> <artifactid>camel-parent</artifactid> <version>2.10.3</version> <packaging>pom</packaging> <name>camel :: parent</name> <description>camel parent pom</description> <properties> <jetty-version>7.6.1.v20120215</jetty-version> <log4j-version>1.2.16</log4j-version> <slf4j-api-version>1.6.1</slf4j-api-version> <slf4j-version>1.6.1</slf4j-version>

below list of imported dependencies added web application's pom.xml:

<dependency> <groupid>org.apache.camel</groupid> <artifactid>camel-core</artifactid> <version>2.10.3</version> </dependency> <dependency> <groupid>org.apache.camel</groupid> <artifactid>camel-spring</artifactid> <version>2.10.3</version> </dependency> <dependency> <groupid>org.apache.camel</groupid> <artifactid>camel-servlet</artifactid> <version>2.10.3</version> </dependency>

the error everytime deploy webapp is:

2013-02-21 13:06:43.138: org.springframework.web.context.contextloader error - context initialization failed org.springframework.beans.factory.beandefinitionstoreexception: unexpected exception parsing xml document servletcontext resource [/web-inf/applicationcontext.xml]; nested exception org.springframework.beans.fatalbeanexception: invalid namespacehandler class [org.apache.camel.spring.handler.camelnamespacehandler] namespace [http://camel.apache.org/schema/spring]: problem handler class file or dependent class; nested exception java.lang.linkageerror: loader constraint violation: when resolving method "org.slf4j.impl.staticloggerbinder.getloggerfactory()lorg/slf4j/iloggerfactory;" class loader (instance of org/eclipse/jetty/webapp/webappclassloader) of current class, org/slf4j/loggerfactory, , class loader (instance of sun/misc/launcher$appclassloader) resolved class, org/slf4j/impl/staticloggerbinder, have different class objects type org/slf4j/iloggerfactory used in signature @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:412) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:334) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:302) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:174) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:209) @ org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:180) @ org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:125) @ org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:94) @ org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:131) @ org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:527) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:441) @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:383) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:283) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:111) @ org.eclipse.jetty.server.handler.contexthandler.startcontext(contexthandler.java:733) @ org.eclipse.jetty.servlet.servletcontexthandler.startcontext(servletcontexthandler.java:233) @ org.eclipse.jetty.webapp.webappcontext.startcontext(webappcontext.java:1214) @ org.eclipse.jetty.server.handler.contexthandler.dostart(contexthandler.java:676) @ org.eclipse.jetty.webapp.webappcontext.dostart(webappcontext.java:455) @ com.myclass.appserver.contextwrapper.dostart(contextwrapper.java:73) @ org.eclipse.jetty.util.component.abstractlifecycle.start(abstractlifecycle.java:59) @ com.myclass.appserver.jettyserver.starthandler(jettyserver.java:274) @ com.myclass.appserver.jettyserver.deployapp(jettyserver.java:203) @ com.myclass.appserver.jettyserver.deployapp(jettyserver.java:138) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ sun.reflect.misc.trampoline.invoke(methodutil.java:37) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ sun.reflect.misc.methodutil.invoke(methodutil.java:244) @ javax.management.modelmbean.requiredmodelmbean.invokemethod(requiredmodelmbean.java:1074) @ javax.management.modelmbean.requiredmodelmbean.invoke(requiredmodelmbean.java:955) @ com.sun.jmx.interceptor.defaultmbeanserverinterceptor.invoke(defaultmbeanserverinterceptor.java:836) @ com.sun.jmx.mbeanserver.jmxmbeanserver.invoke(jmxmbeanserver.java:761) @ javax.management.remote.rmi.rmiconnectionimpl.dooperation(rmiconnectionimpl.java:1427) @ javax.management.remote.rmi.rmiconnectionimpl.access$200(rmiconnectionimpl.java:72) @ javax.management.remote.rmi.rmiconnectionimpl$privilegedoperation.run(rmiconnectionimpl.java:1265) @ javax.management.remote.rmi.rmiconnectionimpl.doprivilegedoperation(rmiconnectionimpl.java:1360) @ javax.management.remote.rmi.rmiconnectionimpl.invoke(rmiconnectionimpl.java:788) @ sun.reflect.generatedmethodaccessor41.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ sun.rmi.server.unicastserverref.dispatch(unicastserverref.java:305) @ sun.rmi.transport.transport$1.run(transport.java:159) @ java.security.accesscontroller.doprivileged(native method) @ sun.rmi.transport.transport.servicecall(transport.java:155) @ sun.rmi.transport.tcp.tcptransport.handlemessages(tcptransport.java:535) @ sun.rmi.transport.tcp.tcptransport$connectionhandler.run0(tcptransport.java:790) @ sun.rmi.transport.tcp.tcptransport$connectionhandler.run(tcptransport.java:649) @ java.util.concurrent.threadpoolexecutor$worker.runtask(threadpoolexecutor.java:886) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:908) @ java.lang.thread.run(thread.java:662) caused by: org.springframework.beans.fatalbeanexception: invalid namespacehandler class [org.apache.camel.spring.handler.camelnamespacehandler] namespace [http://camel.apache.org/schema/spring]: problem handler class file or dependent class; nested exception java.lang.linkageerror: loader constraint violation: when resolving method "org.slf4j.impl.staticloggerbinder.getloggerfactory()lorg/slf4j/iloggerfactory;" class loader (instance of org/eclipse/jetty/webapp/webappclassloader) of current class, org/slf4j/loggerfactory, , class loader (instance of sun/misc/launcher$appclassloader) resolved class, org/slf4j/impl/staticloggerbinder, have different class objects type org/slf4j/iloggerfactory used in signature @ org.springframework.beans.factory.xml.defaultnamespacehandlerresolver.resolve(defaultnamespacehandlerresolver.java:139) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1414) @ org.springframework.beans.factory.xml.beandefinitionparserdelegate.parsecustomelement(beandefinitionparserdelegate.java:1409) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.parsebeandefinitions(defaultbeandefinitiondocumentreader.java:184) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.doregisterbeandefinitions(defaultbeandefinitiondocumentreader.java:140) @ org.springframework.beans.factory.xml.defaultbeandefinitiondocumentreader.registerbeandefinitions(defaultbeandefinitiondocumentreader.java:111) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.registerbeandefinitions(xmlbeandefinitionreader.java:493) @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:390) ... 55 more

i have looked around lot trying figure out linkage error, without result.

any help appreciated.

after lot of reading around, discovered error occurs because cannot slf4j staticlogger, refer post: http://www.slf4j.org/codes.html#staticloggerbinder

spring apache jetty apache-camel java.lang.linkageerror

No comments:

Post a Comment