Digital
Digital

Reputation: 591

IllegalAccessError with spring boot application start up

Getting Below error after upgrading spring boot version from 1.2.6.RELEASE to 1.3.4.RELEASE

Earlier application was started fine with spring boot, but after upgrading the version application not starting up, any modification done to the latest version which I need to take care in my application to start.

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)

Below are my gradle dependencies

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'
    }
}

Any suggestions on this?

Upvotes: 1

Views: 7118

Answers (1)

Gary Russell
Gary Russell

Reputation: 174484

Looks like you are overriding boot's Spring Framework version or you have an older spring version on the class path somehow.

addCollectionConverters was added to DefaultConversionService in Spring Framework 4.2.3.

Upvotes: 5

Related Questions