2017-10-25 18 views
1

私はCamelを使用してSpringブートプロジェクトに取り組んでいます。 GoogleによるとCamelでSpringブートでアプリケーションコンテキストを読み込めませんでした

java.lang.IllegalStateException: Failed to load ApplicationContext 
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) 
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) 
    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:189) 
    at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:131) 
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) 
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128) 
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203) 
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155) 
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) 
Caused by: org.apache.camel.RuntimeCamelException: java.lang.IllegalStateException: Locker is not reentrant 
    at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1831) 
    at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136) 
    at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:369) 
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:416) 
    at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:94) 
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) 
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) 
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) 
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) 
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) 
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) 
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) 
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) 
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) 
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) 
    ... 26 common frames omitted 
Caused by: java.lang.IllegalStateException: Locker is not reentrant 
    at org.eclipse.jetty.util.thread.Locker.lock(Locker.java:47) 
    at org.eclipse.jetty.server.AbstractConnector.removeConnectionFactory(AbstractConnector.java:465) 
    at org.eclipse.jetty.server.AbstractConnector.setConnectionFactories(AbstractConnector.java:488) 
    at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.createConnectorJetty(JettyHTTPServerEngine.java:653) 
    at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.createConnector(JettyHTTPServerEngine.java:616) 
    at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:398) 
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:187) 
    at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:53) 
    at org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:95) 
    at org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:893) 
    at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:123) 
    at org.apache.camel.component.cxf.CxfConsumer.doStart(CxfConsumer.java:129) 
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
    at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3688) 
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:4006) 
    at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3941) 
    at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3861) 
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3625) 
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3477) 
    at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:208) 
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3236) 
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3232) 
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3255) 
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3232) 
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3155) 
    at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) 
    ... 42 common frames omitted 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) 
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128) 
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203) 
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155) 
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) 

、それは桟橋サーバーとのエラーのようですが、私は欠けているものを見ていない...ここで私pom.xml次のとおりです。私はこの例外を取得するので、それを構築することはできません関連する依存関係:エラーから来るん

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.5.8.RELEASE</version> 
    <relativePath /> 
</parent> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
    <java.version>1.8</java.version> 
    <wildfly.maven.plugin.version>1.0.2.Final</wildfly.maven.plugin.version> 
    <commons-lang3.version>3.6</commons-lang3.version> 
    <camel.version>2.20.0</camel.version> 
    <cxf.version>3.2.0</cxf.version> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-activemq</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-spring-boot-starter</artifactId> 
     <version>${camel.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-stream</artifactId> 
     <version>${camel.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-jms</artifactId> 
     <version>${camel.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-cxf</artifactId> 
     <version>${camel.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-servlet</artifactId> 
     <version>${camel.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-jetty</artifactId> 
     <version>2.20.0</version> 
    </dependency> 


    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> 
     <version>${cxf.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-transports-http-jetty</artifactId> 
     <version>${cxf.version}</version> 
    </dependency> 

    <!-- <dependency> --> 
    <!-- <groupId>org.springframework.boot</groupId> --> 
    <!-- <artifactId>spring-boot-starter-tomcat</artifactId> --> 
    <!-- <scope>provided</scope> --> 
    <!-- </dependency> --> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

? 依存関係がありませんか? 旧バージョンですか?

答えて

0

春のブート親がpropablyあなたの依存関係を台無し:

<properties> 
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
<java.version>1.8</java.version> 
<wildfly.maven.plugin.version>1.0.2.Final</wildfly.maven.plugin.version> 
<commons-lang3.version>3.6</commons-lang3.version> 
<camel.version>2.20.0</camel.version> 
<cxf.version>3.2.0</cxf.version> 
</properties> 

<dependencies> 
<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-activemq</artifactId> 
    <version>1.5.8.RELEASE</version> 
</dependency> 

<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-spring-boot-starter</artifactId> 
    <version>${camel.version}</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-stream</artifactId> 
    <version>${camel.version}</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-jms</artifactId> 
    <version>${camel.version}</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-cxf</artifactId> 
    <version>${camel.version}</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-servlet</artifactId> 
    <version>${camel.version}</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-jetty</artifactId> 
    <version>2.20.0</version> 
</dependency> 


<dependency> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-spring-boot-starter-jaxrs</artifactId> 
    <version>${cxf.version}</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-rt-transports-http-jetty</artifactId> 
    <version>${cxf.version}</version> 
</dependency> 

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-test</artifactId> 
    <scope>test</scope> 
    <version>1.5.8.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-activemq</artifactId> 
    <version>1.5.8.RELEASE</version> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-expression</artifactId> 
    <version>4.3.12.RELEASE</version> 
</dependency> 
</dependencies> 

ありません手掛かりこれはまだwildfly上で実行されますが、テストは私のために働いたユニット内のアプリケーションのコンテキストを開始するかどうか。私はactivemq Stuffを削除し、Routeを次の場所に置き換えました。cxf To:mock

+0

ありがとうございます! – ggwtf

1

各Camelコンポーネントには独自の-starterの依存関係があります。だからではなく、定義する:

<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-stream</artifactId> 
    <version>${camel.version}</version> 
</dependency> 

をあなたが定義する必要があります:あなたが使用したいすべてのキャメルコンポーネントの

<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-stream-starter</artifactId> 
    <version>${camel.version}</version> 
</dependency> 

などを。

+0

ありがとうございましたが、問題は解決しませんでした – ggwtf

関連する問題