2

I have created zuul proxy application using spring boot and I am able to deploy it as a spring boot and war in Wildfly server by making some changes in pom and SpringApplication class file.

Structure of my ear :

  MyEE.ear
  |
  |__gatewayzull.war
        |_WEB-INF/lib/all jar for spring boot application
  |
  |__EJB.jar
  |
  |__XX.war
  |
  |lib/all jar (which also includes spring jars)

I have done some changes in pom.xml to deploy spring application war in WildFly server and It is working as expected.

When I tried to add gatewayzull.war in MyEE.ear and deploy it in Wildfly server, I am getting this exception

10:08:47,108 INFO  [com.hummingbird.gateway.HbgatewayApplication] (MSC service thread 1-4) No active profile set, falling back to default profiles: default
10:08:47,119 INFO  [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (MSC service thread 1-4) Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@51640e39: startup date [Thu Jun 01 10:08:47 UTC 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@50b75933
....
....
....
....
10:08:56,635 WARN  [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (MSC service thread 1-4) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$TransactionManagementConfiguration]; nested exception is java.lang.IllegalArgumentException: class org.springframework.transaction.annotation.TransactionManagementConfigurationSelector is not assignable to interface org.springframework.context.annotation.ImportSelector
10:08:56,711 ERROR [org.springframework.boot.SpringApplication] (MSC service thread 1-4) Application startup failed: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$TransactionManagementConfiguration]; nested exception is java.lang.IllegalArgumentException: class org.springframework.transaction.annotation.TransactionManagementConfigurationSelector is not assignable to interface org.springframework.context.annotation.ImportSelector
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:546) [spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:286) [spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
.....
.....
.....
Caused by: java.lang.IllegalArgumentException: class org.springframework.transaction.annotation.TransactionManagementConfigurationSelector is not assignable to interface org.springframework.context.annotation.ImportSelector
    at org.springframework.util.Assert.isAssignable(Assert.java:376) [spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.util.Assert.isAssignable(Assert.java:359) [spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:124) [spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:511) [spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    ... 30 more

WildFly was trying to start Gatewayapplication but failed to start it.

jar inside gatewayzull.war.WEB-INF.lib not loaded. deployment.MyEE.ear.lib also has spring related jar. I have added exclusion tag in jboss-deplyment-structure.xml inorder to exclude while loading but this also did not helps.

Snipper of jboss.xml :

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
        ..
        ..
        <sub-deployment name="gateway.war">
        <exclusions>
            <module name="deployment.MyEE.ear.XX.war" />
            <module name="deployment.MyEE.ear.EJB.jar" />
            <module name="deployment.MyEE.ear.lib" />
            <module name="javax.ws.rs.api" />
        </exclusions>
        <exclude-subsystems>
            <subsystem name="jaxrs" />
        </exclude-subsystems>
    </sub-deployment>
</jboss-deployment-structure>

I am assuming that core issue would be due to application server not able to load jar inside war/web-inf/lib and in turn server not intializing SpringBootServeletIntializer.

Any idea to resolve this ?

Abdul Razak AK
  • 405
  • 1
  • 7
  • 17

0 Answers0