Saturday, 26 May 2018

How To Create Multiple Instences of Tomcat 9

Tomcat 9 Multiple Instences


If you want to deploye multiple web applications on a single tomcat server then follow these simple steps.


  1. First we need a fresh installation of Tomcat Server 9. 

  2. Now create a directory like [C:\Program Files\Apache Software Foundation\tomcat-1].

  3. Copy bin, conf, logs, webapps and work directories from tomcat’s root [C:\Program Files\Apache Software Foundation\Tomcat 9.0].

  4. Now first configure server.xml for new instance (tomcat-1) [C:\Program Files\Apache Software Foundation\tomcat-1\conf\server.xml].

  5. Deploy your web app in webapps directory [C:\Program Files\Apache Software Foundation\tomcat-1\webapps\MyWebApp].

  6. Now you need to install your tomcat instance as a windows service.

  7. Move into [C:\Program Files\Apache Software Foundation\tomcat-1\bin] directory and rename Tomcat9.exe to tomcat-1.exe and Tomcat9w.exe to tomcat-1w.exe

  8. Open cmd at path [C:\Program Files\Apache Software Foundation\tomcat-1\bin] and run this command.

  9. tomcat-1.exe //IS//tomcat-1

  10. After this you will see your newly created tomcat-1 windows service in Windows Task Manager.

  11. Now run tomcat-1w.exe and configure it like your root tomcat properties.

Sunday, 21 January 2018

Installation of Gradle Build Tool on Windows 10

This blog post only focuses on installation of Gradle Build Tool on Windows 10. We will separately discuss about the features of Gradle in another blog  in detail.

Download Gradle Build Tool:

First you need to download the latest version of Gradle Build Tool from here. I prefer to complete download with docs and sources.

Verify JAVA On Your System:

Before anything else, you need to have Java Software Development Kit (JDK) installed on your system. In order to verify, execute java -version command in your cmd.

Press <window key + R> and type <cmd> then hit <enter key>

If you already have JDK on your system, you will see java version (JDK and JRE) detail as shown below.



Now extracting the downloaded zip file as  C:\gradle\bin 


Setting up Enviroment Variable for Gradle:

Right click on This PC >> select Properties >> Advance system settings >> Environment Variables.




Create New System Variable and set the Variable Name and Value like shown below.





In order to set the Path for Environment Variable click on Edit...




Select New and then set your gradle build path as C:\gradle\bin as following.



Verify Gradle Installation:

Now last step is verification of your Gradle Build Tool Installation. In order to verify it, excute gradle -v  in your cmd as shown below.



Congratulations you have done it.
Happy Learning with TZN LAB...

Thursday, 11 January 2018

Configuration of Application Manager in Tomcat 9

If you want to configure Application Manager in your Tomcat 9 then this blog may help you.

During Tomcat 9 installation, set username and password as mention below. After completion of installation you can access manager application via http://localhost:8090/manager/html/


If you forgot to setup username and password during the installation process then you can set it manually in the file [TOMCAT_ROOT_DIR]/conf/tomcat-users.xml Put the following code in your tomcat-users.xml file.

<tomcat-users>
     <user username="tomcatadmin" password="tomcatadmin" roles="admin-gui,manager-gui"/>
</tomcat-users>   



After successfully login you must see the following page.


Now you don’t need to restart Tomcat Server in order to restart a single application or redeploy any single application. You can Start, Stop, Reload and Un-deploy any single application without restarting the whole TOMCAT SERVER. 

In order to deploy an application MyFirstApp, you must set the Context Path and Artifact Directory Path or you can directly deploye a WAR file as seen below.





By default application manager uses tomcat’s default appBase i.e. [TOMCAT_ROOT_DIR]/webapps/ directory for application deployment. 

After successfully deployment, you must see your application in the Application List with your Context Path. 

If anything goes wrong during the deployment process then you can look into the file [TOMCAT_ROOT_DIR]/logs/manager.<currentDate>.txt for Exception. 

By default application max-size limit is 50MB. If your application size exceeds this limit than you can edit max-size limit manually in the file 
[TOMCAT_ROOT_DIR]/webapps/manager/WEB-INF/web.xml find the following code and set the max-size limit as per your requirement. 

<multipart-config>
     <!--50MB max -->
     <max-file-size>52428800</max-file-size>
     <max-request-size>52428800</max-request-size>
     <file-size-threshold>0</file-size-threshold>
</multipart-config>
 



Note: If you find any mistake in above blog, kindly inform me in comment section. 

Friday, 5 January 2018

Apache Tomcat Server 9 Installation on Windows 10

This article may help you to install Tomcat Server on Windows 10. I will try to cover all the problems usually occur during the installation process. I hope it will be easy to learn in case of follow this article step by step. If you find any mistake in this article, kindly mention it in the comment section or email me at y.hussain09@gmail.com. Your feedback will be highly appreciable.

First you need to Download the leatest version of Tomcat Server and here we have version 9.0.2 at this time.

Step #1 - Follow the download link for windows installer.
Download Tomcat Server 9
Step # 1 - Follow the download link

Step # 2 - Just click on next button.
Tomcat Server 9 Installation
Step # 2 - Click on the Next > Button.

Step # 3 - Click on I Agree Button in order to Agree the License Agreement as usual.
Tomcat Server 9 Installation
Step # 3 - Click on I Agree Button.

Step # 4 - Before proceed to next, you must select the full option from the option list or manually
                 check marked every option as shown below.
Tomcat Server 9 Installation
Step # 4 - First Select Full Option then Click on Next > Button.

Step # 5 - Set User Name and Password before you proceed futher and don't edit or change anything
                 else at this stage. Later we will discuss Tomcat's Application Manager in detail. 
Tomcat Server 9 Installation
Step # 5 - Set User Name & Password and then click on Next > Button.

Step # 6 - If you have jdk on your machine, the path of jre will be set automatically. If you don't
                 have jdk then first install jdk on your machine.
Tomcat Server 9 Installation
Step # 6 - Click on the Next > Button.

Step # 7 - If you want to install Tomcat on custom path then click on the Browse Button and set the
                 path of your custom directory otherwise just click on Install Button. 
Tomcat Server 9 Installation
Step # 7 - Browse for custom directory and click on Install Button.

Step # 8 - If you want to start your Tomcat Server on the completion of installation then check Run
                 Apache Tomcat option. Click on Finish Button.
Tomcat Server 9 Installation


Step # 9 - Now you need to access your Tomcat Server's default page via http://localhost:8080.
                 Maybe something goes worng and you will see the follow page.
Tomcat Server 9 Installation
Access Error : 404 -- Resource Not Found.


By default Tomcat Server's Port is 8080 and sometimes another application used this port. Now you need to change your Tomcat Server's Port in [TOMCAT_ROOT]/conf/server.xml file. Find the Connector tag and change it to 8081 or somthing else. Here is 8090 as shown below.

Tomcat Server 9 Installation
Change port number in server.xml
Now you need to restart your Tomcat Server. When ever you edit your server.xml file, you need to restart your tomcat server in order to reflect changes. Server.xml is only load once when Tomcat starts.

In order to restart Tomcat Server. Search Configure Tomcat App and run.

Tomcat Server 9 Installation
Run Configure Tomcat App.
Tomcat Server Start and Stop
Tomcat Server Configuration App.
Now current Service Status: Stopped. Click on Start Button to start Tomcat Server and again access via http://localhost:8090/ and its done.
Tomcat Server Default Page
Congratulation!!! your Tomcat Server have been installed and running.