启动Spring启动应用程序的IllegalAccessError

时间:2016-05-09 13:59:31

标签: spring-boot spring-integration

将spring boot版本从1.2.6.RELEASE升级到1.3.4.RELEASE

后出现以下错误

早期的应用程序在Spring启动时启动很好,但在升级版本应用程序未启动之后,对我的应用程序启动时需要注意的最新版本进行了任何修改。

Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.springframework.core.convert.support.DefaultConversionService.addCollectionConverters(Lorg/springframework/core/convert/converter/ConverterRegistry;)V from class org.springframework.boot.bind.RelaxedConversionService
    at org.springframework.boot.bind.RelaxedConversionService.<init>(RelaxedConversionService.java:52)
    at org.springframework.boot.bind.RelaxedDataBinder.modifyProperties(RelaxedDataBinder.java:148)
    at org.springframework.boot.bind.RelaxedDataBinder.doBind(RelaxedDataBinder.java:128)
    at org.springframework.validation.DataBinder.bind(DataBinder.java:631)
    at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:269)
    at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:241)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.bindToSpringApplication(ConfigFileApplicationListener.java:230)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:181)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:166)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:152)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:330)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:126)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:75)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:55)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:111)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:65)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:330)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
    at com.gap.mosaic.trailerevent.ebo.integration.service.configuration.Application.main(Application.java:19)

以下是我的gradle依赖项

dependencies {
    compile "org.springframework.integration:spring-integration-core"
    compile "org.springframework.integration:spring-integration-jms"
    compile "org.springframework.integration:spring-integration-xml"

    compile "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
    compile "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
    compile "org.springframework.boot:spring-boot-starter-integration:${springBootVersion}"

    compile "org.springframework.boot:spring-boot-starter:${springBootVersion}"
    compile "org.springframework.boot:spring-boot-autoconfigure:${springBootVersion}"
    compile "org.springframework.cloud:spring-cloud-config-client:1.0.2.RELEASE"

    compile "org.springframework:spring-jms"
    compile "org.springframework:spring-oxm"
    compile ("org.springframework.integration:spring-integration-mongodb"){
        exclude group: 'org.mongodb', module: 'mongo-java-driver'
    }

    compile "commons-io:commons-io:2.0.1"
    compile "org.apache.commons:commons-compress:1.4.1"
    compile "org.codehaus.castor:castor:${castor}"
    compile "xerces:xercesImpl:${xerces}"
    compile "xalan:xalan:${xalan}"
    compile "com.google.code.gson:gson:2.3.1"
    compile "org.skyscreamer:jsonassert:1.2.3"
    compile 'org.yaml:snakeyaml:1.8'

    compile "com.ibm:mq-jmqi:7.0.1"
    compile "dhbcore:dhbcore:7.0.1.5"
    compile "com.ibm.mqjms:com.ibm.mqjms:com.ibm.mqjms"
    compile group: 'jms', name: 'jms', version: 'jms'
    compile group: 'com.ibm.mq', name: 'com.ibm.mq', version: 'com.ibm.mq'
    compile group: 'com.ibm.mq.headers', name: 'com.ibm.mq.headers', version: 'com.ibm.mq.headers'
    compile group: 'com.ibm.mq.pcf', name: 'com.ibm.mq.pcf', version: 'com.ibm.mq.pcf'
    compile group: 'com.ibm', name: 'mq-commonservices', version: '7.0.1'
    compile 'org.mongodb:mongo-java-driver:3.2.0'

    testCompile("org.springframework.integration:spring-integration-test") {
        exclude group: 'org.objenesis', module: 'objenesis'
    }
    testCompile("org.mockito:mockito-core:1.9.5") {
        exclude group: 'org.hamcrest', module: 'hamcrest-core'
    }
    testCompile "com.github.fakemongo:fongo:2.0.4"
    testCompile ("com.mockrunner:mockrunner-jms:1.0.9") {
        exclude group: 'xerces', module: 'xerces'
    }
}

对此有何建议?

1 个答案:

答案 0 :(得分:5)

看起来你正在重写boot的Spring Framework版本,或者你在类路径上有一个较旧的spring版本。

$ sudo /opt/lampp/lampp restart 已添加到Spring Framework 4.2.3中的addCollectionConverters