Skip to main content

Posts

Showing posts from August, 2014

JavaMelody: Monitoring the Performance of Tomcat Application Server

Javamelody is an opensource (LGPL) application to monitor Java or Java EE application servers in QA and production environments. JavaMelody is mainly based on statistics of requests and on evolution charts. (Extract from the Javamelody home page) It allows to improve applications in QA and production Give facts about the average response times and number of executions Make decisions when trends are bad, before problems become too serious Optimize based on the more limiting response times Find the root causes of response times Verify the real improvement after optimization It includes summary charts showing the evolution over time of the following indicators: Number of executions, mean execution times and percentage of errors of http requests, sql requests, jsp pages or methods of business façades (if EJB3, Spring or Guice) Java memory Java CPU Number of user sessions Number of jdbc connections These charts can be viewed on the current day, week, month, year or cu

Tomcat Clustering: Loadbalancing with mod_jk and Apache

We already see how to run multiple tomcat instance in a single machine in my previous blog ( http://kmlsarwar.blogspot.com/2014/08/multiple-tomcat-instances-on-single.html ). In this post we will see how to configure load balancing with mod_jk and Apache on Ubuntu. Suppose we have two hosts, node1 and node2 . Node1 runs an Apache and a Tomcat instance. On node2 we’ve got another Tomcat. A browser will connect to the host that’s running the Apache. Since the load on a single server running a web application can be pretty severe, we’re going to share the burden of serving servlets with multiple hosts (in our case two hosts). And we’re going to make mod_jk to do that for us. Steps to Implement Virtual Host/Loadbalancer Concept in this Scenario: Install Apache httpd Web Server  Install mod_jk connector  Configure JK Connector  Configure Apache httpd server, apply loadbalancer concepts Step One—Install Apache We can install Apache web server in two way

Multiple Tomcat Instances on Single Machine

In this post we will see how to run multiple tomcat instances on a single machine and under a single user account. Setup We already see how to run tomcat in Ubuntu machine in my previous blog ( http://kmlsarwar.blogspot.com/2014/08/how-to-install-apache-tomcat-on-ubuntu.html ). Step One—Create folder Create two folder named " tomcat-instance1 " and " tomcat-instance2 " anywhere, and copy conf, logs, temp, webapps and work   folder from CATALINA_HOME folder and change conf/server.xml file in  tomcat-instance1 and tomcat-instance2 . we need to change 3 port shutdown port, connector port and ajp port. Shutdown port - this port is used for shutdown the tomcat. when we call the shutdown.sh script they send signal to shutdown port. this port listen by tomcat java process. if signal is received the that process then its cleanup and exit by itself. Connector Port -This port is actual port to expose the application to outside client.

Configure Tomcat Web Management Interface

We already see, how to install tomcat in ubuntu in my previous blog( http://kmlsarwar.blogspot.com/2014/08/how-to-install-apache-tomcat-on-ubuntu.html ) In order to use the manager webapp installed, we must add a login to our Tomcat server. We will do this by editing the tomcat-users.xml file: sudo nano /etc/tomcat7/tomcat-users.xml    This file is filled with comments which describe how to configure the file. You may want to delete all the comments between the following two lines, or you may leave them if you want to reference the examples: <tomcat-users> </tomcat-users>  You will want to add a user who can access the manager-gui and admin-gui (the management interface that we installed in Step Three). You can do so by defining a user similar to the example below. Be sure to change the password and username if you wish: <tomcat-users> <user username="admin" password="password" roles="manager-gui,admin-gui"

How To Install Apache Tomcat on Ubuntu

Apache tomcat is a Java based application server released by the Apache Software Foundation. It is a web server and a servlet container for Java web applications. Setup Tomcat installation on a virtual private server is relatively easy. Its single required dependency is Java and this tutorial will include a step on how to install that platform. You do need to have a user with sudo privileges for this tutorial. There are two basic ways to install Tomcat on Ubuntu: Install through apt-get. This is the simplest method.  Download the binary distribution from the Apache Tomcat site . Step One—Install Through apt-get   The first thing you will want to do is update your apt-get package lists:   sudo apt-get update The most recent version of Tomcat is 7, and it can be easily downloaded through apt-get sudo apt-get install tomcat7   Install additional packages sudo apt-get install tomcat7-docs tomcat7-admin tomcat7-examples     Step Two—Install Through Bi

How to install Oracle JDK on Ubuntu from repository

This package provides Oracle Java JDK 7 (which includes Java JDK, JRE and the Java browser plugin). However, you can't only install Oracle JRE - the PPA only provides the full Oracle JDK7 package. To install: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-jdk7-installer And to uninstall: sudo apt-get remove oracle-jdk7-installer And to verify your installation: java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode) And to verify the web browser installation: http://java.com/en/download/installed.jsp Verified Java Version Congratulations! You have the recommended Java installed (1.7.0_51). And to update: If for some reason, the Java version in use is not 1.7.0, you can try to run the following command: sudo update-java-alternatives -s java-7-oracle To Install and Set in environment variable: To

How to set JAVA_HOME environment variable in Ubuntu

Setting the JAVA_HOME variable can be done in several ways. 1. Globally and at System level, i.e. no user is required to be logged in. This is the preferred way if you are configuring a server and planning to use boot strapped program that needs JAVA_HOME variable. 2. Globally and set for all logged in user, i.e. one user is needed to be logged in, to have the JAVA_HOME variable set. 3. User specific. Then the variable is only set when the designated user is logged in. First open a Terminal (Applications → Accessories → Terminal), then enter: sudo gedit /etc/environment Append to the end of the file: JAVA_HOME=/usr/lib/jvm/java-7-oracle Check with this echo command. echo $JAVA_HOME