Friday, February 10, 2017

Tomcat/java



How to check java/tomcat version on cpanel 


+++
[root@ns1 /]# /etc/init.d/tomcat version

Server version: Apache Tomcat/7.0.65
Server built:   Jan 6 2016 18:50:03 UTC
Server number:  7.0.65.0
OS Name:        Linux
OS Version:     2.6.32-573.26.1.el6.x86_64
Architecture:   amd64
JVM Version:    1.7.0_101-mockbuild_2016_04_21_13_21-b00
JVM Vendor:     Oracle Corporation
++++


Below is the code for test.jsp   testing script when java/tomcat is enabled on server.


++++

    Test JSP page
   
       

Working JSP page!


        This is a page to verify that .jsp support has been enabled


       
           
               
               
           
           
               
               
           
           
               
               
           
           
               
               
           
       
Date:<%= new java.util.Date() %>
Remote Address:<%= request.getRemoteAddr() %>
Request Method:<%= request.getMethod() %>
Servlet Path:<%= request.getServletPath() %>

   

++++

htaccess code 


As the servlet mapping only works on port 8080 and doesn't work on the Apache mod_jk proxy on port 80, we have to add below two lines needed for these to work with Apache into the user's .htaccess file at /home/user/public_html location:


+++
SetHandler jakarta-servlet
SetEnv JK_WORKER_NAME ajp13
+++

Script to print tomcat version 


++++++++++++++
[root@ns1 public_html]# cat version.jsp

Server info: <%= application.getServerInfo() %>

Servlet version: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %>

JSP version: <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() %>

Java version: <%= System.getProperty("java.version") %>
++++++++

You can view this script using http://website/version.jsp