我的应用程序在开发中运行良好,但是当我在生产中将它部署到EC2时,我得到一个异常,它将无法启动。 POM文件是:
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<groupId>com.example.app</groupId>
<artifactId>app</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>app</name>
<description>My App</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!-- Add project specific below here -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-solr</artifactId>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>
我得到的例外是:
线程“main”java.lang.reflect.InvocationTargetException中的异常 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 在org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) 在org.springframework.boot.loader.Launcher.launch(Launcher.java:87) 在org.springframework.boot.loader.Launcher.launch(Launcher.java:50) 在org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) 引起:java.lang.IllegalArgumentException:无法实例化 interface org.springframework.context.ApplicationContextInitializer: org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer 在org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:414) 在org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:394) 在org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:385) 在org.springframework.boot.SpringApplication.initialize(SpringApplication.java:261) 在org.springframework.boot.SpringApplication。(SpringApplication.java:237) 在org.springframework.boot.SpringApplication.run(SpringApplication.java:1191) 在org.springframework.boot.SpringApplication.run(SpringApplication.java:1180) 在com.example.MyApplication.main(TemplatesApplication.java:16) ... 8更多引起:java.lang.NoSuchMethodException:org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer。() 在java.lang.Class.getConstructor0(Class.java:3082) 在java.lang.Class.getConstructor(Class.java:1825) 在org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:409) ......还有15个
注意:此问题"NoClassDefFoundError: GenericApplicationListener" when switching from Spring Boot 1.3.0M1 to 1.3.0M2指的是某人DID覆盖版本的不同情况。但我没有。