2014-12-23 9 views
7

अद्यतन tomcat8 इस परिदृश्य में काम करता प्रतीत होता है क्योंकि मैं आवश्यकतानुसार/प्रबंधक/पृष्ठ खोल सकता हूं। हालांकि यह मूल समस्या स्थिति को हल नहीं करता है, लेकिन मैं आपको इस परिदृश्य में डेबियन बैकपोर्ट से tomcat8 का उपयोग करने की सलाह देता हूं!रास्पबेरी पाई पर जावा 8 के साथ टोमकैट 7

Raspbian बिल्ला 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) 

में मौजूदा जावा 8 उद्धार मैं डेबियन backports द्वारा प्रदान की tomcat7 संस्करण है जो

[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 not compiling jsp examples के अनुसार काम करना चाहिए है पर वापिस कर दिए। हालांकि, प्रबंधक पृष्ठ के रूप में ऐसा नहीं है मुझे निम्न त्रुटि के साथ छोड़ देता है:

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

क्या आप जावा एसडीके या जावा जेआरई चला रहे हैं? –

+1

oracle-java8-jdk raspbian में डिफ़ॉल्ट रूप से स्थापित के रूप में। जैसा कि अभी अपडेट किया गया है, tomcat8 चलता है। –

+0

@ col.panic आप कैसे रास्पबेरी पर रास्पबेरी पर tomcat8 मिला? क्या आपको इसे स्वयं संकलित करना पड़ा? – flindeberg

उत्तर

19

जैसा कि सवाल में बताया गया है, रास्पियन द्वारा प्रदान की गई टोमकैट जावा 8 के साथ काम नहीं करता है। this blog पर दिए गए निर्देशों के बाद मैं टोमकैट 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.

सभी क्रेडिट शुक्रवार रात परियोजना में जाते हैं।

एक बात यह इंगित करने के लिए: मुझे कट्टर लिनक्स उपयोगकर्ता के रूप में, यह समाधान थोड़ा हैकी लगता है, उपयोगकर्ता की होम निर्देशिका में सॉफ़्टवेयर इंस्टॉल करता है, लेकिन यह काम करता है।

+2

+1 एक आकर्षण की तरह काम करता है, केवल एक छोटा कदम गायब है, मुझे नई टोमकैट स्क्रिप्ट को $ sudo chmod 755 /etc/init.d/tomcat का उपयोग करके सही अनुमतियां देना पड़ा। –

संबंधित मुद्दे