spring mvc root url map with tomcat

We typically use @RequestMapping(“/”) to map the root url. It might not work with tomcat sometimes. One reason was that that something (Tomcat?) was forwarding from “/” to “/index.jsp” when I had the file index.jsp in my WebContent directory. When I removed that, the request did not get forwarded anymore. So the important thing here is: Don’t…

get tomcat hot swap work with intellij

It usually takes a lot of time whenever you’re recompiling a Java web project. The IDE would usually recompile the entire project, package them into a war and have it redeployed on your  application server (i.e., Tomcat) then letting the server reinitialize itself. It takes a lot of time, and it just gets worse as your…

ssh to the ec2 instance(beanstalk)

Configure Security Group In the AWS console, open the EC2 tab. Select the relevant region and click on Security Group. You should have an elasticbeanstalk-default security group if you have launched an Elastic Beanstalk instance in that region. Edit the security group to add a rule for SSH access. The below will lock it down…

Servlet Container

1. What is a Web Server? To know what is a Servlet container, we need to know what is a Web Server first. A web server uses HTTP protocol to transfer data. In a simple situation, a user type in a URL (e.g. http://www.programcreek.com/static.html) in browser (a client), and get a web page to read….

tomcat max post size

Today I encountered some error when trying to post a xml whose size is about 3MB to the server from gwt client. Turns out the reason is from tomcat.   Apache Tomcat , by default, sets the maximum size of acceptable HTTP POST request to 2MB. You can reconfigure Tomcat to accept larger requests. This…

Tomcat Clustering Setup using mod_proxy

There are pretty much two ways to set up basic clustering, which use two different Apache modules. The architecture for both, is the same. Apache sits in front of the Tomcat nodes and acts as a load balancer. Traffic is passed between Apache and Tomcat(s) using the binary AJP 1.3 protocol. The two modules are mod_jk and mod_proxy….

Tomcat Clustering Setup using mod_jk

Apache Tomcat is a great performer on its own, but if you’re expecting more traffic as your site expands, or are thinking about the best way to provide high availability, you’ll be happy to know that Tomcat also shines in a clustered environment.  With built-in support for both synchronous and asynchronous in-memory and external session…

Tomcat Clustering Analysis

How Clustering Works Three parts: Load Balancer Tomcat server session replication Scalability Scalability and clustering are not the same thing. Rather, clustering is a method of achieving scalability. Scalability has to do with the ability of a server to efficiently process multiple concurrent requests simultaneously, with the stated goal that the time it takes to…

Java and tomcat class loader, priority & hierarchy

Java class loader hierarchy We have 3 main class loader : Bootstrap class loader, called primordial class loader. It’s a part of the JVM., and is responsible for loading classes from the core Java package (java.lang, java.util etc.) These classes are found in JAVA_HOME/jre/lib/rt.jar. Extension class loader. It monitors the JAVA_HOME/jre/lib/ext folder and load the existing…

IntelliJ tomcat context

IntelliJ use its own tomcat base under user/yourname/intellij… To get around this big mess and just use your Tomcat as if you ran it outside of IDEA you simply add a CATALINA_BASE environment variable to the configuration of Tomcat (within IDEA) pointing to your Tomcat directory:   Now when you start Tomcat within IDEA you…

maven auto deploy war to tomcat

Just go to the tomcat server’s conf/tomcat-users.xml, add: <tomcat-users>   <role rolename=”manager”/>   <role rolename=”admin”/>   <role rolename=”manager-gui”/>   <user username=”admin” password=”password” roles=”admin,manager,manager-gui”/> </tomcat-users>   And under the pom.xml’s plugins add: <plugin>                                 <groupId>org.codehaus.mojo</groupId>                                 <artifactId>tomcat-maven-plugin</artifactId>                                 <configuration>                                                 <url>http://127.0.0.1:8080/manager/html</url&gt;                                                 <username>admin</username>                                                 <password>password</password>                                                 <path>/cdip-dynoapp</path>                                                 <warFile>target/cdip-dynoapp.war</warFile>                                 </configuration>                 </plugin> If you…