我正在尝试使用Tomcat在Heroku上部署SpringMVC Java项目。该应用程序很小,但是当我尝试部署.war文件时出现以下错误:
2013-01-07T12:21:53+00:00 heroku[web.1]: Starting process with command `${PRE_JAVA}java ${JAVA_OPTS} -jar webapp-runner-7.0.29.3.jar --port ${PORT} ${WEBAPP_RUNNER_OPTS} web-movie-collector-1.0.0-BUILD-SNAPSHOT.war`
2013-01-07T12:21:54+00:00 app[web.1]: Adding Context / for web-movie-collector-1.0.0-BUILD-SNAPSHOT.war
2013-01-07T12:21:56+00:00 app[web.1]: Jan 7, 2013 12:21:56 PM org.apache.coyote.AbstractProtocol init
2013-01-07T12:21:56+00:00 app[web.1]: INFO: Initializing ProtocolHandler ["http-nio-21063"]
2013-01-07T12:21:56+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 45464, should be 21063 (see environment variable PORT)
2013-01-07T12:21:56+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-01-07T12:21:58+00:00 heroku[web.1]: Process exited with status 137
2013-01-07T12:21:58+00:00 heroku[web.1]: State changed from starting to crashed
2013-01-07T12:21:58+00:00 heroku[web.1]: State changed from crashed to starting
2013-01-07T12:22:00+00:00 heroku[web.1]: Starting process with command `${PRE_JAVA}java ${JAVA_OPTS} -jar webapp-runner-7.0.29.3.jar --port ${PORT} ${WEBAPP_RUNNER_OPTS} web-movie-collector-1.0.0-BUILD-SNAPSHOT.war`
2013-01-07T12:22:01+00:00 app[web.1]: Adding Context / for web-movie-collector-1.0.0-BUILD-SNAPSHOT.war
2013-01-07T12:22:01+00:00 app[web.1]: Jan 7, 2013 12:22:01 PM org.apache.coyote.AbstractProtocol init
2013-01-07T12:22:01+00:00 app[web.1]: INFO: Initializing ProtocolHandler ["http-nio-41469"]
2013-01-07T12:22:01+00:00 app[web.1]: Jan 7, 2013 12:22:01 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
2013-01-07T12:22:01+00:00 app[web.1]: INFO: Using a shared selector for servlet write/read
2013-01-07T12:22:01+00:00 app[web.1]: Jan 7, 2013 12:22:01 PM org.apache.catalina.core.StandardService startInternal
2013-01-07T12:22:01+00:00 app[web.1]: INFO: Starting service Tomcat
2013-01-07T12:22:01+00:00 app[web.1]: Jan 7, 2013 12:22:01 PM org.apache.catalina.core.StandardEngine startInternal
2013-01-07T12:22:01+00:00 app[web.1]: INFO: Starting Servlet Engine: Apache Tomcat/7.0.29
2013-01-07T12:22:01+00:00 heroku[web.1]: State changed from starting to up
2013-01-07T12:22:02+00:00 app[web.1]: Jan 7, 2013 12:22:02 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
2013-01-07T12:22:02+00:00 app[web.1]: INFO: No global web.xml found
2013-01-07T12:22:28+00:00 heroku[web.1]: Process running mem=745M(145.6%)
2013-01-07T12:22:28+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2013-01-07T12:22:50+00:00 heroku[web.1]: Process running mem=769M(150.4%)
2013-01-07T12:22:50+00:00 heroku[web.1]: **Error R14 (Memory quota exceeded)**
2013-01-07T12:22:57+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=web-movie-collector-new.herokuapp.com fwd=91.208.120.254 dyno=web.1 queue=0ms wait=0ms connect=2ms service=30000ms status=503 bytes=0
**2013-01-07T12:23:12+00:00 heroku[web.1]: Process running mem=793M(155.1%)
2013-01-07T12:23:12+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2013-01-07T12:23:34+00:00 heroku[web.1]: Process running mem=761M(148.8%)
2013-01-07T12:23:34+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)**
2013-01-07T12:23:37+00:00 app[web.1]: Jan 7, 2013 12:23:37 PM org.apache.catalina.core.ApplicationContext log
2013-01-07T12:23:37+00:00 app[web.1]: INFO: No Spring WebApplicationInitializer types detected on classpath
2013-01-07T12:23:37+00:00 app[web.1]: Jan 7, 2013 12:23:37 PM org.apache.catalina.core.ApplicationContext log
2013-01-07T12:23:37+00:00 app[web.1]: INFO: Initializing Spring root WebApplicationContext
2013-01-07T12:23:37+00:00 app[web.1]: INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
2013-01-07T12:23:38+00:00 app[web.1]: INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Mon Jan 07 12:23:38 UTC 2013]; root of context hierarchy
2013-01-07T12:23:38+00:00 app[web.1]: INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
2013-01-07T12:23:38+00:00 app[web.1]: INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7458e2a1: defining beans [infoSourceConfigLoader,htmlNodePathMapper]; root of factory hierarchy
2013-01-07T12:23:39+00:00 app[web.1]: INFO : org.springframework.beans.factory.config.PropertiesFactoryBean - Loading properties file from class path resource [xpath.properties]
2013-01-07T12:23:39+00:00 app[web.1]: INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 2062 ms
2013-01-07T12:23:39+00:00 app[web.1]: null
2013-01-07T12:23:39+00:00 app[web.1]: Jan 7, 2013 12:23:39 PM org.apache.catalina.core.StandardContext listenerStart
2013-01-07T12:23:39+00:00 app[web.1]: SEVERE: Exception sending context initialized event to listener instance of class ro.isdc.LanguageLoaderListener
2013-01-07T12:23:39+00:00 app[web.1]: java.lang.NullPointerException
2013-01-07T12:23:39+00:00 app[web.1]: at java.io.File.<init>(File.java:239)
2013-01-07T12:23:39+00:00 app[web.1]: at ro.isdc.controllers.LocaleAwareController.loadSupportedLanguages(LocaleAwareController.java:40)
2013-01-07T12:23:39+00:00 app[web.1]: at ro.isdc.LanguageLoaderListener.contextInitialized(LanguageLoaderListener.java:15)
2013-01-07T12:23:39+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
2013-01-07T12:23:39+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
2013-01-07T12:23:39+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2013-01-07T12:23:39+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
2013-01-07T12:23:39+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
2013-01-07T12:23:39+00:00 app[web.1]: at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
2013-01-07T12:23:39+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:166)
2013-01-07T12:23:39+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
2013-01-07T12:23:39+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
2013-01-07T12:23:39+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:636)
2013-01-07T12:23:39+00:00 app[web.1]: Jan 7, 2013 12:23:39 PM org.apache.catalina.core.StandardContext startInternal
2013-01-07T12:23:39+00:00 app[web.1]: SEVERE: Error listenerStart
2013-01-07T12:23:39+00:00 app[web.1]: Jan 7, 2013 12:23:39 PM org.apache.catalina.core.StandardContext startInternal
2013-01-07T12:23:39+00:00 app[web.1]: SEVERE: Context [/] startup failed due to previous errors
2013-01-07T12:23:39+00:00 app[web.1]: SEVERE: Context [/] failed in [org.apache.catalina.core.StandardContext] lifecycle. Allowing Tomcat to shutdown.
2013-01-07T12:23:39+00:00 app[web.1]: Jan 7, 2013 12:23:39 PM org.apache.catalina.core.ApplicationContext log
2013-01-07T12:23:39+00:00 app[web.1]: INFO: Closing Spring root WebApplicationContext
2013-01-07T12:23:39+00:00 app[web.1]: INFO : org.springframework.web.context.support.XmlWebApplicationContext - Closing Root WebApplicationContext: startup date [Mon Jan 07 12:23:38 UTC 2013]; root of context hierarchy
2013-01-07T12:23:39+00:00 app[web.1]: INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7458e2a1: defining beans [infoSourceConfigLoader,htmlNodePathMapper]; root of factory hierarchy
2013-01-07T12:23:40+00:00 app[web.1]: Jan 7, 2013 12:23:40 PM org.apache.coyote.AbstractProtocol start
2013-01-07T12:23:40+00:00 app[web.1]: INFO: Starting ProtocolHandler ["http-nio-41469"]
2013-01-07T12:23:42+00:00 heroku[web.1]: Process exited with status 0
2013-01-07T12:23:42+00:00 heroku[web.1]: State changed from up to crashed
2013-01-07T12:23:59+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=web-movie-collector-new.herokuapp.com fwd=91.208.120.254 dyno= queue= wait= connect= service= status=503 bytes=
我该如何解决这个或可能导致问题的原因?
答案 0 :(得分:0)
您是否注意到日志中的大NullPointerException
,您应该看一下,我认为这就是原因,启动无效。
根据Heroku Troubleshooting Memory Issues in Java Applications,您的应用程序可以在Heroku上使用超过512MB的内存,但它会被交换到磁盘,从而导致性能问题。
答案 1 :(得分:0)
看看
ro.isdc.controllers.LocaleAwareController.loadSupportedLanguages(LocaleAwareController.java:40)
它在java.io.File中传递null。