Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => all application on unix knowledges by golfreeze => Topic started by: golfreeze on กันยายน 04, 2013, 10:19:54 PM

Title: debian + JDK + tomcat5.5
Post by: golfreeze on กันยายน 04, 2013, 10:19:54 PM
http://www.debianadmin.com/how-to-setup-apache-tomcat-55-on-debian-etch.html
Title: Re: debian + JDK + tomcat5.5
Post by: golfreeze on กันยายน 27, 2013, 05:07:06 PM
http://www.thaemlitz.com/john/debian_apache2_mod_jk_tomcat5_install.shtml
Title: Re: debian + JDK + tomcat5.5
Post by: golfreeze on กันยายน 27, 2013, 05:13:45 PM
http://blog.alexcollins.org/2007/11/20/howto-apache-2-tomcat-5525-and-mod_jk-under-debian/
Title: Re: debian + JDK + tomcat5.5
Post by: golfreeze on กันยายน 27, 2013, 10:25:29 PM
http://anders.com/projects/sysadmin/tomcat.html
Title: Re: debian + JDK + tomcat5.5
Post by: golfreeze on กันยายน 30, 2013, 01:55:07 PM
JDK on DA = http://forum.directadmin.com/showthread.php?t=2227
Title: Re: debian + JDK + tomcat5.5
Post by: golfreeze on ตุลาคม 01, 2013, 01:15:19 AM
ทำ ln -s จาก /usr/share/tomcat5.5/webapps /var/www/virtual/xxx.com/htdocs/webapps

แก้ต่อที่
bean class cannot be found in the runtime classpath

/usr/share/tomcat5.5/webapps
Title: Re: debian + JDK + tomcat5.5
Post by: golfreeze on ตุลาคม 01, 2013, 04:03:51 PM
org.apache.jasper.JasperException: Unable to load class for JSP
   org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:599)
   org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137)
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:314)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:592)
   org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
   java.security.AccessController.doPrivileged(Native Method)
   javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
   org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
   org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)

root cause

java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
   java.net.URLClassLoader$1.run(URLClassLoader.java:200)
   java.security.AccessController.doPrivileged(Native Method)
   java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:131)
   org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
   org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:597)
   org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137)
   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:314)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   java.lang.reflect.Method.invoke(Method.java:592)
   org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
   java.security.AccessController.doPrivileged(Native Method)
   javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
   org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
   org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
Title: Re: debian + JDK + tomcat5.5
Post by: golfreeze on ตุลาคม 05, 2013, 02:49:55 PM
สำหรับ debian ที่ต้องการลง apache-tomcat + apache
ขั้นแรกติดตั้ง
ติดต่อชุดคำสั่งของ java ก่อนครับ
#apt-get install sun-java5-jdk sun-java5-fonts

ทำการเพิ่ม path JAVA_HOME ลงไปในเครื่องที่ os = debian
#vi /etc/profile
export JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun"

### ต่อไปทำการลง apache-tomcat และ module และ library ที่ java ต้องการ
#apt-get install tomcat5 tomcat5-webapps tomcat5-admin apache-utils

ปกติผมใช้งาน apache ที่ port 80
ส่วน apache-tomcat เป็น 8180 => http://www.aaaa.com:8180/webapps

ต่อไปทำการติดตั้ง libapache2-mod-jk (module ของ java ที่ใช้กับ apache)
#apt-get install libapache2-mod-jk
configure เพิ่มเติมครับ
#vi /etc/libapache2-mod-jk/workers.properties
workers.tomcat_home=/usr/share/tomcat5
workers.java_home=/usr/lib/jvm/java-1.5.0-sun

worker.list=ajp13_worker
worker.ajp13_worker.port=8009
worker.ajp13_worker.host=localhost
worker.ajp13_worker.type=ajp13

เสร็จทำการเพิ่ม configure ของ module jk.conf ไปที่ path ของ apache
#cd /etc/apache2
#cp /usr/share/doc/libapache2-mod-jk/httpd_example_apache2.conf mods-available/jk.conf
#ln -s /etc/apache2/mods-available/jk.conf mods-enabled/jk.conf

#### configure ในส่วนของ /etc/tomcat5.5/server.xml เพิ่มส่วนนี้ลงไป
 <Host name="www.aaaa.com">
                <Alias>mrthaijob.com</Alias>
                <Context path="" docBase="/usr/share/tomcat5.5/webapps/webtest" debug="1"/>
                <Context path="/manager" docBase="/usr/share/tomcat5.5/server/webapps/manager" debug="0" privileged="true"/>
                <Logger className="org.apache.catalina.logger.FileLogger" directory="/var/log/apache2/aaaa.com-jsp.log" prefix="context_log." suffix=".log" timestamp="true"/>
                <WatchedResource>WEB-INF/web.xml</WatchedResource>
        </Host>

เพิ่มเติมถ้านำไปใช้งานกับ apache
#ln -s /usr/share/tomcat5.5/webapps /var/www/html/aaaa.com/html/webapps

ทำการสั่ง restart webserver apache และ apache-tomcat
#/etc/init.d/apache2 restart
#/etc/init.d/tomcat restart

ทำการอัฟโหลดไฟล์ jsp เข้าไปใน path ที่เก็บไฟล์หลัก
ก็จะเข้าเรียกหน้าได้ปกติครับ

http://www.aaaa.com:8180/webapps/testweb
ถ้าท่านใดติดปัญหาในการ ลง ก็โฟสไว้ได้นะครับผม ขอให้สนุกกับ java นะครับ