2014-12-23 5 views
7

업데이트 tomcat8은 필요에 따라/manager/page를 열 수 있으므로이 시나리오에서 작동하는 것 같습니다. 이 방법으로 원래의 문제 상태를 해결할 수는 없지만이 시나리오에서는 debian 백 포트의 tomcat8을 사용하는 것이 좋습니다!Tomcat 7 with Java 8 with Raspberry Pi

Raspbian 내가 tomcat7 not compiling jsp examples에 따른 작동해야

[email protected]:/etc/apt# dpkg -l |grep tomcat 
ii libtomcat7-java      7.0.56-1~bpo70+2      all   Servlet and JSP engine -- core libraries 
ii tomcat7        7.0.56-1~bpo70+2      all   Servlet and JSP engine 
ii tomcat7-admin       7.0.56-1~bpo70+2      all   Servlet and JSP engine -- admin web applications 
ii tomcat7-common      7.0.56-1~bpo70+2      all   Servlet and JSP engine -- common files 

이다 데비안 백 포트에 의해 제공 tomcat7 버전으로 되돌릴 톰캣 (7)을 설치 한 후 버전

[email protected]:/etc/apt# java -version 
java version "1.8.0" 
Java(TM) SE Runtime Environment (build 1.8.0-b132) 
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode) 

에서 현재의 Java (8)을 제공한다. 관리자 페이지에서 다음과 같은 오류를 남기므로이 경우가 아닙니다.

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [1] in the generated java file: [/var/lib/tomcat7/work/Catalina/localhost/manager/org/apache/jsp/index_jsp.java] 
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files 

Stacktrace: 
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103) 
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366) 
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:477) 
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:379) 
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:354) 
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:341) 
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657) 
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) 
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) 
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 
    org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:213) 
    org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108) 

실제로 문제가 될 수있는 사람은 누구입니까?

+0

Java SDK 또는 Java JRE를 실행하고 있습니까? –

+1

oracle-java8-jdk는 기본적으로 raspbian에 설치되어 있습니다. 방금 업데이트되었으므로 tomcat8이 실행됩니다. –

+0

@ col.panic raspbian의 라스베리에서 tomcat8을 어떻게 얻었습니까? 직접 컴파일해야 했습니까? – flindeberg

답변

19

질문에서 언급했듯이 Raspbian에서 제공하는 Tomcat은 Java 8에서 작동하지 않습니다. this blog의 지침에 따라 Tomcat 8을 설치할 수있었습니다. linkrot를 방지하고 작은 실수를 해결하기 위해, 나는 (버전 8.0.24 업데이트) 거의 문자 그대로의 텍스트를 인용합니다 :

Installing Apache Tomcat 8 on a Raspberry Pi

On my Raspberry Pi I have already installed Apache 2 HTTP server and hence this article does a basic install and configuration of Tomcat. Firstly, update all installed packages:

$ sudo apt-get update 

Confirm that Java is already installed:

[email protected] /usr/bin $ java -version 
java version "1.8.0" 
Java(TM) SE Runtime Environment (build 1.8.0-b132) 
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode) 

Log in to the home directory for the pi user and download the desired release of Tomcat:

$ wget http://mirrors.axint.net/apache/tomcat/tomcat-8/v8.0.24/bin/apache-tomcat-8.0.24.tar.gz 

Extract the zipped tarball:

$ tar xvf apache-tomcat-8.0.24.tar.gz 

Add the following user XML element as the last child of the tomcat-users parent element of ~/apache-tomcat-8.0.24/conf/tomcat-users.xml (this creates an admin account called “system” who’s password is “raspberry”):

<user username="system" password="raspberry" roles="manager-gui"/> 

Change the directory permissions on the following directorys, since by default, the pi Linux user cannot write to them:

[NB: I didn't have to do this step, as in release 8.0.24, there was no directory apache-tomcat-8.0.24/work/Catalina ]

Add a startup script called tomcat to the /etc/init.d directory, which has the following contents:

#!/bin/sh 
# /etc/init.d/tomcat 
# starts the Apache Tomcat service 
### BEGIN INIT INFO 
# Provides:   tomcat 
# Required-Start: 
# Required-Stop: 
# Default-Start:  2 3 4 5 
# Default-Stop:  0 1 6 
# X-Interactive:  true 
# Short-Description: Start/stop tomcat application server 
### END INIT INFO 

export CATALINA_HOME="/home/pi/apache-tomcat-8.0.24" 
case "$1" in 
start) 
    if [ -f $CATALINA_HOME/bin/startup.sh ]; 
    then 
    echo $"Starting Tomcat" 
    /bin/su pi $CATALINA_HOME/bin/startup.sh 
    fi 
    ;; 
stop) 
    if [ -f $CATALINA_HOME/bin/shutdown.sh ]; 
    then 
    echo $"Stopping Tomcat" 
    /bin/su pi $CATALINA_HOME/bin/shutdown.sh 
    fi 
    ;; 
*) 
    echo $"Usage: $0 {start|stop}" 
    exit 1 
    ;; 
esac 

Use the update-rc.d command to add the appropriate links to the /etc/rc?.d directories:

$ sudo update-rc.d tomcat defaults 

Test that the tomcat server starts:

$ sudo /etc/init.d/tomcat start 

On a web client, point your browser at http://”Raspberry Pi IP Address”:8080

Tomcat screenshot

Test that the tomcat server stops:

$ sudo /etc/init.d/tomcat stop 

Finally, reboot the system and the Tomcat application server should now start automatically on startup, and likewise when the system shuts down.

모든 크레딧은 금요일 밤 프로젝트로 이동합니다.

하드 코어 Linux 사용자로서 나에게이 솔루션은 사용자의 홈 디렉토리에 소프트웨어를 설치하는 약간의 해킹 소리가 들리지만 작동합니다.

+2

+1은 매력처럼 작동합니다. 하나의 작은 단계가 빠졌습니다. $ sudo chmod 755 /etc/init.d/tomcat을 사용하여 새로운 tomcat 스크립트에 올바른 권한을 부여해야했습니다. –