SpringBoot - ClassCastException

时间:2014-08-20 14:00:38

标签: java spring spring-batch spring-boot spring-xd

我正在尝试使用YAML文件来外部化配置属性。我成功地阅读了属性并使用Spring Boot应用程序单独运行它。

但是当我在Spring批处理作业项目中集成相同的类,并尝试部署作业时,我得到以下异常。这个例外是什么意思?如何禁用不正确的类转换?

这些是我的maven依赖项:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.1.1.RELEASE</version>
</parent>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
     <groupId>org.springframework.batch</groupId>
     <artifactId>spring-batch-core</artifactId>
     <version>${springbatch.version}</version>
     <scope>provided</scope>
</dependency>

[2014-08-20 15:14:13.511] boot - 5604 ERROR [DeploymentsPathChildrenCache-0] --- ContainerRegistrar: Exception deploying module
java.lang.IllegalStateException: java.lang.ClassCastException: org.springframework.boot.logging.logback.LogbackLoggingSystem cannot be cast to org.springframework.boot.logging.LoggingSystem
        at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:85)
        at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:160)
        at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:122)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
        at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:92)
        at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:58)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:275)
        at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:130)
        at org.springframework.xd.module.core.SimpleModule.initialize(SimpleModule.java:191)
        at org.springframework.xd.dirt.module.ModuleDeployer.deploy(ModuleDeployer.java:127)
        at org.springframework.xd.dirt.module.ModuleDeployer.deployAndStore(ModuleDeployer.java:117)
        at org.springframework.xd.dirt.module.ModuleDeployer.deployAndStore(ModuleDeployer.java:107)
        at org.springframework.xd.dirt.server.ContainerRegistrar.deployModule(ContainerRegistrar.java:237)
        at org.springframework.xd.dirt.server.ContainerRegistrar.deployJob(ContainerRegistrar.java:512)
        at org.springframework.xd.dirt.server.ContainerRegistrar.onChildAdded(ContainerRegistrar.java:442)
        at org.springframework.xd.dirt.server.ContainerRegistrar.access$800(ContainerRegistrar.java:96)
        at org.springframework.xd.dirt.server.ContainerRegistrar$DeploymentListener.childEvent(ContainerRegistrar.java:807)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503)
        at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92)
        at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
        at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500)
        at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: org.springframework.boot.logging.logback.LogbackLoggingSystem cannot be cast to org.springframework.boot.logging.LoggingSystem
        at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:81)
        ... 31 more
[2014-08-20 15:14:13.601] boot - 5604  INFO [DeploymentsPathChildrenCache-0] --- ContainerRegistrar: Path cache event: /deployments/modules/a6acf7b1-32de-408a-ab96-4ece1df91115/NewJob3.job.database-sy
nchronizer-0, type: CHILD_REMOVED
[2014-08-20 15:14:13.602] boot - 5604  INFO [DeploymentsPathChildrenCache-0] --- ContainerRegistrar: Undeploying module [ModuleDescriptor@6436d9c4 moduleName = 'database-synchronizer', moduleLabel = [
null], group = 'NewJob3', sourceChannelName = [null], sinkChannelName = [null], sinkChannelName = [null], index = 0, type = job, parameters = map[[empty]], children = list[[empty]]]
[2014-08-20 15:14:13.605] boot - 5604 ERROR [JobDeploymentsPathChildrenCache-0] --- PathChildrenCache:
java.lang.IllegalStateException: Container a6acf7b1-32de-408a-ab96-4ece1df91115 experienced the following error deploying module database-synchronizer-0 of type job: java.lang.IllegalStateException: j
ava.lang.ClassCastException: org.springframework.boot.logging.logback.LogbackLoggingSystem cannot be cast to org.springframework.boot.logging.LoggingSystem
        at org.springframework.xd.dirt.server.ModuleDeploymentWriter.validateResults(ModuleDeploymentWriter.java:543)
        at org.springframework.xd.dirt.server.JobDeploymentListener.deployJob(JobDeploymentListener.java:146)
        at org.springframework.xd.dirt.server.JobDeploymentListener.onChildAdded(JobDeploymentListener.java:113)
        at org.springframework.xd.dirt.server.JobDeploymentListener.childEvent(JobDeploymentListener.java:97)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:503)
        at org.apache.curator.framework.listen.ListenerContainer$1.run(ListenerContainer.java:92)
        at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:297)
        at org.apache.curator.framework.listen.ListenerContainer.forEach(ListenerContainer.java:83)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache.callListeners(PathChildrenCache.java:500)
        at org.apache.curator.framework.recipes.cache.EventOperation.invoke(EventOperation.java:35)
        at org.apache.curator.framework.recipes.cache.PathChildrenCache$10.run(PathChildrenCache.java:762)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案
相关问题