2015-05-07 160 views
1

在我的基於Spring的Camel maven項目中,爲Jasper報表添加以下依賴項時,我在項目構建時面臨問題。在maven項目中添加jasper-report依賴項的問題

碧玉相關性:

<dependency> 
     <groupId>net.sf.jasperreports</groupId> 
     <artifactId>jasperreports</artifactId> 
     <version>6.0.4</version> 
    </dependency> 

下面是異常的堆棧跟蹤:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> RestBinding <<< in route: Route(route1)[[From[rest:post:/request:/addMultiple?inType=j... because of Error creating bean with name 'org.apache.camel.component.jackson.JacksonDataFormat': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.component.jackson.JacksonDataFormat]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z 
    at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1556) 
    at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:123) 
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:332) 
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151) 
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128) 
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331) 
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:773) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:483) 
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> RestBinding <<< in route: Route(route1)[[From[rest:post:/request:/addMultiple?inType=j... because of Error creating bean with name 'org.apache.camel.component.jackson.JacksonDataFormat': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.component.jackson.JacksonDataFormat]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z 
    at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1028) 
    at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:185) 
    at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:841) 
    at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2895) 
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2618) 
    at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:167) 
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2467) 
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2463) 
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2486) 
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2463) 
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2432) 
    at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:255) 
    at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121) 
    ... 19 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.camel.component.jackson.JacksonDataFormat': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.component.jackson.JacksonDataFormat]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z 
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1133) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1036) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:505) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:342) 
    at org.apache.camel.spring.spi.SpringInjector.newInstance(SpringInjector.java:39) 
    at org.apache.camel.impl.DefaultDataFormatResolver.resolveDataFormat(DefaultDataFormatResolver.java:57) 
    at org.apache.camel.impl.DefaultCamelContext.resolveDataFormat(DefaultCamelContext.java:3561) 
    at org.apache.camel.model.rest.RestBindingDefinition.createProcessor(RestBindingDefinition.java:109) 
    at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:505) 
    at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:217) 
    at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1025) 
    ... 32 more 
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.component.jackson.JacksonDataFormat]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z 
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) 
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122) 
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:270) 
    ... 44 more 
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z 
    at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:458) 
    at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:379) 
    at org.apache.camel.component.jackson.JacksonDataFormat.<init>(JacksonDataFormat.java:109) 
    at org.apache.camel.component.jackson.JacksonDataFormat.<init>(JacksonDataFormat.java:96) 
    at org.apache.camel.component.jackson.JacksonDataFormat.<init>(JacksonDataFormat.java:84) 
    at org.apache.camel.component.jackson.JacksonDataFormat.<init>(JacksonDataFormat.java:74) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
    at java.lang.reflect.Constructor.newInstance(Unknown Source) 
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) 
    ... 46 more 

我想支持傑克遜的依賴關係的碧玉報告與過去的依賴關係衝突。

以下是jasper報告的pom.xml的依賴關係層次。

enter image description here

但是如果我刪除了碧玉報告的依賴則是工作的罰款。

我無法將其整理出來。

回答

2

得到您的問題錯了,改回答

類上你的方法是發生是jackson.core 2.4.3的一部分。如果你明確地包含它,它應該可以解決你的問題。

添加下面的依賴關係:

<dependency> 
    <groupId>com.fasterxml.jackson.core</groupId> 
    <artifactId>jackson-core</artifactId> 
    <version>2.4.3</version> 
</dependency> 
<dependency> 
    <groupId>com.fasterxml.jackson.core</groupId> 
    <artifactId>jackson-annotations</artifactId> 
    <version>2.4.3</version> 
</dependency>