2017-05-07 114 views
0

你好,我想問關於我的java web應用程序在heroku上。需要幫助Java Web應用程序(webapp-runner,tomcat)heroku(應用程序崩潰)

我創建了一個運行網頁+服務器(apache jena fuseki)的web應用程序。使用教程從Heroku的網頁https://devcenter.heroku.com/articles/java-webapp-runner

它正常工作在localhost:使用java -jar target/dependency/webapp-runner.jar target/*.war

所以我Procfile推在Heroku這樣web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

IST出現了8080:3030(執行批處理文件)和本地主機當我嘗試訪問它時出現應用程序錯誤。 有什麼辦法可以解決這個問題嗎?感謝你的所有時間。

這是我的Heroku的日誌

[web.1]: at java.lang.Thread.run(Thread.java:745) 
[web.1]: May 07, 2017 7:27:56 PM org.apache.catalina.core.StandardContext listenerStart 
[web.1]: SEVERE: Exception sending context initialized event to listener instance of class org.apache.jena.fuseki.server.ShiroEnvironmentLoader 
[web.1]: org.apache.jena.fuseki.FusekiConfigException: Failed to create directory: /etc/fuseki 
[web.1]: at org.apache.jena.fuseki.server.FusekiServer.ensureDir(FusekiServer.java:363) 
[web.1]: at org.apache.jena.fuseki.server.FusekiServer.formatBaseArea(FusekiServer.java:132) 
[web.1]: at org.apache.jena.fuseki.server.ShiroEnvironmentLoader.contextInitialized(ShiroEnvironmentLoader.java:50) 
[web.1]: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727) 
[web.1]: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189) 
[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) 
[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) 
[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[web.1]: at java.lang.Thread.run(Thread.java:745) 
[web.1]: 
[web.1]: [2017-05-07 19:27:56] Server  ERROR Failed to initialize : Server not running 
[web.1]: May 07, 2017 7:27:56 PM org.apache.catalina.core.StandardContext startInternal 
[web.1]: SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file 
[web.1]: May 07, 2017 7:27:56 PM org.apache.catalina.core.StandardContext startInternal 
[web.1]: SEVERE: Context [] startup failed due to previous errors 
[web.1]: May 07, 2017 7:27:56 PM org.apache.catalina.core.ApplicationContext log 
[web.1]: SEVERE: Context [] failed in [org.apache.catalina.core.StandardContext] lifecycle. Allowing Tomcat to shutdown. 
[web.1]: INFO: Cleaning up Shiro Environment 
[web.1]: May 07, 2017 7:27:57 PM org.apache.coyote.AbstractProtocol start 
[web.1]: INFO: Starting ProtocolHandler [http-nio-55883] 
[web.1]: May 07, 2017 7:27:57 PM org.apache.coyote.AbstractProtocol pause 
[web.1]: INFO: Pausing ProtocolHandler ["http-nio-55883"] 
heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=lmaokid.herokuapp.com request_id=3250ba55-3f3d-4bfd-a2e7-034c47f7b8d1 fwd="110.139.88.158" dyno=web.1 connect=1ms service=3265ms status=503 bytes=0 protocol=https 
heroku[web.1]: Process exited with status 0 
heroku[web.1]: State changed from up to crashed 
heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=lmaokid.herokuapp.com request_id=90b84002-f43b-49f9-a88f-1e4df6a5e058 fwd="110.139.88.158" dyno= connect= service= status=503 bytes= protocol=https 

這是我的pom.xml

<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.example</groupId> 
<artifactId>my-app</artifactId> 
<version>1.0-SNAPSHOT</version> 
<packaging>war</packaging> 

<name>Maven Quick Start Archetype</name> 
<url>http://maven.apache.org</url> 
<dependencies> 
<dependency> 
    <groupId>org.apache.jena</groupId> 
    <artifactId>jena-fuseki</artifactId> 
    <type>pom</type> 
    <version>2.5.0</version> 
    </dependency> 

    <dependency> 
    <groupId>org.apache.jena</groupId> 
    <artifactId>jena-fuseki-war</artifactId> 
    <type>war</type> 
    <version>2.5.0</version> 
    </dependency> 

    <dependency> 
    <groupId>org.apache.jena</groupId> 
    <artifactId>jena-fuseki-server</artifactId> 
    <version>2.5.0</version> 
    </dependency> 

</dependencies> 

<build> 
    <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.5.11.3</version> 
           <destFileName>webapp-runner.jar</destFileName> 
          </artifactItem> 
         </artifactItems> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 
</project> 

回答

0

如果你仔細觀察,你會看到的主要錯誤:

Failed to create directory: /etc/fuseki 

我建議在Heroku上的/app下創建任何目錄,因爲這是用戶空間。