Archive for the Tomcat Category

Check Tomcat,Java,JSP And Servlet Version Online

If you  recently  installed Apache-Tomcat on your system and wants to check  the Java, JSP , Servlet and Tomcat versions then just put the below code in .jsp file ::

 

<html>

Apache-Tomcat Version : <%=getServletConfig().getServletContext().getServerInfo()%> <br>

Servlet Version : <%= session.getServletContext().getMajorVersion() %>.<%= session.getServletContext().getMinorVersion() %><br>

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

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

</html> 

And now you can access the above information online as http://www.domain.com/info.jsp .

How to enable Tomcat Manager

Tomcat Manager Web application is packaged with the Tomcat server and you can access Tomcat Manager by browsing the URL http://yourserverip:8080/manager.

 

Tomcat Manager allows you the ability to start , stop, reload , deploy and undeploy a Web Application.

 

By default Tomcat Manager access is not configured and you have to setup a admin user to access Tomcat Manager on a newly installed tomcat server.
Continue reading How to enable Tomcat Manager

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined.

If  you are getting the  above error while stopping  or starting Tomcat  service from shell as ./shutdown.sh  or ./startup.sh then it  means that the

JAVA_HOME

variable is either not defined or incorrectly defined.
You can fixed this by running the below commands from Shell as root user :

[email protected][#] which java

you will get the below output :
/usr/local/jdk/bin/java

then run this command

[email protected][#] export JAVA_HOME=/usr/local/jdk

after that try running the command

[email protected][#] cd /usr/local/jakarta/tomcat/bin
[email protected][#] ./shutdown.sh or ./startup.sh

you will get the output for ./shutdown.sh
Using CATALINA_BASE: /usr/local/jakarta/tomcat
Using CATALINA_HOME: /usr/local/jakarta/tomcat
Using CATALINA_TMPDIR: /usr/local/jakarta/tomcat/temp
Using JRE_HOME: /usr/local/jdk
Aug 3, 2010 11:46:26 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.(Socket.java:366)
at java.net.Socket.
(Socket.java:180)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:344)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:435)

and for ./startup.sh
Using CATALINA_BASE: /usr/local/jakarta/tomcat
Using CATALINA_HOME: /usr/local/jakarta/tomcat
Using CATALINA_TMPDIR: /usr/local/jakarta/tomcat/temp
Using JRE_HOME: /usr/local/jdk
Using CLASSPATH: /usr/local/jakarta/tomcat/bin/bootstrap.jar

That’s all you are done.