1. Startup failure
Spring-boot uses version 1.4.3, of which the default hibernate-jpa jar is version 2.1, jboss-logging is version 3.3.0, but hibernate-jpa under Jboss EAP6.4 is 2.0; jboss-logging is version 3.1.5, causing conflicts.
Solution: one is to replace the jar of jboss itself and audit these two versions; the other is to replace the jar of the project, which involves a lot of jars of the project, but because the jboss on the server cannot be moved, only the local and pom can be modified. As follows:
Remove the jar that comes with the boot itself. There are also some modifications to jboss-deployment-structrue.xml during this period, all of which are invalid.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <exclusions> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jdbc</artifactId> </exclusion> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-juli</artifactId> </exclusion> <exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> </exclusion> <exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.2.21.Final</version> <exclusions> <exclusion> <groupId>org.jboss.logging</groupId> <artifactId>jboss-logging</artifactId> </exclusion> </exclusions> </dependency>
Add version matching jar package:
<dependency> <groupId>org.jboss.logging</groupId> <artifactId>jboss-logging</artifactId> <version>3.1.3.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>4.2.21.Final</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> <version>4.2.21.Final</version> </dependency> <dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.0-api</artifactId> <version>1.0.1.Final</version> </dependency>
Why not directly reduce the version of spring-boot here, mainly because the packages that spring-boot depends on are relatively new. After 1.1, they basically refer to the latest dependency packages at that time.
2. jboss EAP6.4 does not support deployment without web.xml
This is very important. At that time, because of this problem for several days, I couldn't find the problem. Finally, I found this problem in a spring configuration related answer on stackoverflow, spring -boot itself is not configured, so I didn't consider this aspect at the beginning, and finally added the web startup method, the project was successfully deployed, and the access was normal.
@Configuration public class WebApplicationInitializerImpl implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { XmlWebApplicationContext appContext = new XmlWebApplicationContext(); appContext.setConfigLocation("classpath:dispatcher-servlet.xml"); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(appContext)); dispatcher.setLoadOnStartup(1); //This must be /*, otherwise it will be redirected wirelessly under jboss dispatcher.addMapping("/*"); } }