我已将Spring MVC应用程序部署到Heroku。它在本地工作正常,但不会在Heroku上运行并给我一个应用程序错误页面。我检查了日志,这就是我所看到的。我无法弄清楚如何解决错误。
2016-11-29T15:15:00.658819+00:00 app[web.1]: Nov 29, 2016 3:15:00 PM org.apache.jasper.servlet.TldScanner scanJars
2016-11-29T15:15:00.658847+00:00 app[web.1]: INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2016-11-29T15:15:00.731991+00:00 app[web.1]: Nov 29, 2016 3:15:00 PM org.apache.catalina.core.ApplicationContext log
2016-11-29T15:15:00.731995+00:00 app[web.1]: INFO: No Spring WebApplicationInitializer types detected on classpath
2016-11-29T15:15:00.785546+00:00 app[web.1]: Nov 29, 2016 3:15:00 PM org.apache.catalina.core.ApplicationContext log
2016-11-29T15:15:00.785550+00:00 app[web.1]: INFO: Initializing Spring root WebApplicationContext
2016-11-29T15:15:00.786501+00:00 app[web.1]: Nov 29, 2016 3:15:00 PM org.springframework.web.context.ContextLoader initWebApplicationContext
2016-11-29T15:15:00.786502+00:00 app[web.1]: INFO: Root WebApplicationContext: initialization started
2016-11-29T15:15:01.022800+00:00 app[web.1]: Nov 29, 2016 3:15:01 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
2016-11-29T15:15:01.078904+00:00 app[web.1]: Nov 29, 2016 3:15:01 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
2016-11-29T15:15:01.022811+00:00 app[web.1]: INFO: Refreshing Root WebApplicationContext: startup date [Tue Nov 29 15:15:01 UTC 2016]; root of context hierarchy
2016-11-29T15:15:01.078908+00:00 app[web.1]: INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
2016-11-29T15:15:01.651920+00:00 app[web.1]: Nov 29, 2016 3:15:01 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
2016-11-29T15:15:01.726018+00:00 app[web.1]: Nov 29, 2016 3:15:01 PM org.springframework.security.core.SpringSecurityCoreVersion <clinit>
2016-11-29T15:15:01.651932+00:00 app[web.1]: INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
2016-11-29T15:15:01.726021+00:00 app[web.1]: INFO: You are running with Spring Security Core 3.1.4.RELEASE
2016-11-29T15:15:01.726773+00:00 app[web.1]: Nov 29, 2016 3:15:01 PM org.springframework.security.core.SpringSecurityCoreVersion <clinit>
2016-11-29T15:15:01.726775+00:00 app[web.1]: SEVERE: *** Spring Major version '3' expected, but you are running with version: 4.1.4.RELEASE. Please check your classpath for unwanted jar files.
2016-11-29T15:15:01.727522+00:00 app[web.1]: Nov 29, 2016 3:15:01 PM org.springframework.security.config.SecurityNamespaceHandler <init>
2016-11-29T15:15:01.727524+00:00 app[web.1]: INFO: Spring Security 'config' module version is 3.1.4.RELEASE
2016-11-29T15:15:01.952894+00:00 app[web.1]: Nov 29, 2016 3:15:01 PM org.springframework.security.config.http.HttpSecurityBeanDefinitionParser checkFilterChainOrder
2016-11-29T15:15:01.952905+00:00 app[web.1]: INFO: Checking sorted filter chain: [Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 200, Root bean: class [org.springframework.security.web.authentication.logout.LogoutFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 400, <org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0>, order = 800, Root bean: class [org.springframework.security.web.authentication.www.BasicAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1200, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1300, Root bean: class [org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1400, Root bean: class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1700, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1800, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1900, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 2000]
2016-11-29T15:15:02.986085+00:00 app[web.1]: Nov 29, 2016 3:15:02 PM org.springframework.web.context.ContextLoader initWebApplicationContext
2016-11-29T15:15:02.986094+00:00 app[web.1]: SEVERE: Context initialization failed
2016-11-29T15:15:02.986095+00:00 app[web.1]: java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.clearCache()V
2016-11-29T15:15:02.986096+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.resetCommonCaches(AbstractApplicationContext.java:906)
2016-11-29T15:15:02.986097+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567)
2016-11-29T15:15:02.986098+00:00 app[web.1]: at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
2016-11-29T15:15:02.986099+00:00 app[web.1]: at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
2016-11-29T15:15:02.986100+00:00 app[web.1]: at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
2016-11-29T15:15:02.986100+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
2016-11-29T15:15:02.986101+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
2016-11-29T15:15:02.986102+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2016-11-29T15:15:02.986103+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
2016-11-29T15:15:02.986103+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
2016-11-29T15:15:02.986105+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2016-11-29T15:15:02.986105+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2016-11-29T15:15:02.986106+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2016-11-29T15:15:02.986107+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:745)
2016-11-29T15:15:02.986108+00:00 app[web.1]:
2016-11-29T15:15:02.986963+00:00 app[web.1]: Nov 29, 2016 3:15:02 PM org.apache.catalina.core.StandardContext listenerStart
2016-11-29T15:15:02.986965+00:00 app[web.1]: SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
2016-11-29T15:15:02.986966+00:00 app[web.1]: java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.clearCache()V
2016-11-29T15:15:02.986967+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.resetCommonCaches(AbstractApplicationContext.java:906)
2016-11-29T15:15:02.986968+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567)
2016-11-29T15:15:02.986968+00:00 app[web.1]: at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
2016-11-29T15:15:02.986969+00:00 app[web.1]: at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
2016-11-29T15:15:02.986970+00:00 app[web.1]: at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
2016-11-29T15:15:02.986971+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
2016-11-29T15:15:02.986971+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
2016-11-29T15:15:02.986972+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2016-11-29T15:15:02.986973+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
2016-11-29T15:15:02.986987+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
2016-11-29T15:15:02.986989+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2016-11-29T15:15:02.986990+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2016-11-29T15:15:02.986990+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2016-11-29T15:15:02.986995+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:745)
2016-11-29T15:15:02.986996+00:00 app[web.1]:
2016-11-29T15:15:02.987555+00:00 app[web.1]: Nov 29, 2016 3:15:02 PM org.apache.catalina.core.StandardContext startInternal
2016-11-29T15:15:02.987557+00:00 app[web.1]: SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
2016-11-29T15:15:03.001111+00:00 app[web.1]: Nov 29, 2016 3:15:03 PM org.apache.catalina.core.StandardContext startInternal
2016-11-29T15:15:03.001114+00:00 app[web.1]: SEVERE: Context [] startup failed due to previous errors
2016-11-29T15:15:03.004786+00:00 app[web.1]: SEVERE: Context [] failed in [org.apache.catalina.core.StandardContext] lifecycle. Allowing Tomcat to shutdown.
2016-11-29T15:15:03.006237+00:00 app[web.1]: INFO: Closing Spring root WebApplicationContext
2016-11-29T15:15:03.006234+00:00 app[web.1]: Nov 29, 2016 3:15:03 PM org.apache.catalina.core.ApplicationContext log
2016-11-29T15:15:03.006887+00:00 app[web.1]: Nov 29, 2016 3:15:03 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
2016-11-29T15:15:03.006889+00:00 app[web.1]: INFO: Closing Root WebApplicationContext: startup date [Tue Nov 29 15:15:01 UTC 2016]; root of context hierarchy
2016-11-29T15:15:03.009660+00:00 app[web.1]: Nov 29, 2016 3:15:03 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
2016-11-29T15:15:03.009662+00:00 app[web.1]: WARNING: Exception thrown from LifecycleProcessor on context close
2016-11-29T15:15:03.009665+00:00 app[web.1]: java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Tue Nov 29 15:15:01 UTC 2016]; root of context hierarchy
2016-11-29T15:15:03.009666+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:417)
2016-11-29T15:15:03.009666+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1002)
2016-11-29T15:15:03.009667+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:961)
2016-11-29T15:15:03.009668+00:00 app[web.1]: at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:581)
2016-11-29T15:15:03.009668+00:00 app[web.1]: at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:116)
2016-11-29T15:15:03.009683+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4859)
2016-11-29T15:15:03.009684+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478)
2016-11-29T15:15:03.009685+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
2016-11-29T15:15:03.009686+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
2016-11-29T15:15:03.009686+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
2016-11-29T15:15:03.009687+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
2016-11-29T15:15:03.009688+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2016-11-29T15:15:03.009689+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2016-11-29T15:15:03.009689+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2016-11-29T15:15:03.009690+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:745)
2016-11-29T15:15:03.009691+00:00 app[web.1]:
这是我的pom.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.adamsashburneducation</groupId>
<artifactId>adamsashburneducation</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- =====================
1. Spring Web MVC
====================== -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<!-- ================================
3. Spring Core and Spring ORM
================================= -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<!-- ======
2. JSTL
======= -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- ============
4. Hibernate
============= -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<!-- =============
5. H2 Database
============== -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.192</version>
</dependency>
<!-- =============
MySQL
============== -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
</dependency>
<!-- ===================
6. Image File Upload
==================== -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<!-- ============
7. Validation
============= -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<!-- =================
8. Spring Security
================== -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>adamsashburnedu</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>8.0.30.2</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我的lib文件夹中包含的lib列表:
aopalliance-1.0.jar
commons-logging-1.2.jar
spring-aop-4.3.3.RELEASE.jar
spring-aspects-4.3.3.RELEASE.jar
spring-beans-4.3.3.RELEASE.jar
spring-context-4.3.3.RELEASE.jar
spring-context-support-4.3.3.RELEASE.jar
spring-core-4.3.3.RELEASE.jar
spring-expression-4.3.3.RELEASE.jar
spring-instrument-4.3.3.RELEASE.jar
spring-instrument-tomcat-4.3.3.RELEASE.jar
spring-jdbc-4.3.3.RELEASE.jar
spring-jms-4.3.3.RELEASE.jar
spring-messaging-4.3.3.RELEASE.jar
spring-orm-4.3.3.RELEASE.jar
spring-oxm-4.3.3.RELEASE.jar
spring-test-4.3.3.RELEASE.jar
spring-tx-4.3.3.RELEASE.jar
spring-web-4.3.3.RELEASE.jar
spring-webmvc-4.3.3.RELEASE.jar
spring-webmvc-portlet-4.3.3.RELEASE.jar
spring-websocket-4.3.3.RELEASE.jar
答案 0 :(得分:0)
java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.clearCache()V
这可能意味着您有不兼容的依赖关系。
你可以试试这些:
答案 1 :(得分:-1)
我在heroku中遇到了同样的问题。该问题与我的代码或应用程序相关的配置文件(包括pom.xml)无关。因为我的应用程序工作正常,突然间我看到容器崩溃,当我尝试启动它时,我不断收到此线程中描述的错误。大约24小时后,tomcat开始独立工作,我没有更改代码或pom.xml中的任何内容。所以,虽然我不知道问题的根本原因,但我知道这不是我做过的事情。这与环境有关。