Category Java Application Servers

Migrating from EJB to Spring and from JBoss to Apache Tomcat: A Real-Life Case Study of Hyperic v4.5 Release

This case study on migrating the open source web application monitoring and management software, Hyperic, to the Spring Framework and Apache Tomcat was originally delivered by Jennifer Hickey at the 2010 SpringOne 2GX conference. This migration work was done for Hyperic v4.5 release. Here are some of the advantages cited about this migration: 1. Improved […]

J2EE/Java EE File Formats: EAR vs WAR

Overview J2EE application server has two containers (run time environments) – one is web container and other is EJB container Web container hosts web applications based on JSP/Servlets API – designed specifically for web request handling – more of request/response distributed computing. Web container requires the web module to be packaged in WAR file that […]

How to run Java services (or background daemon processes) in an application server or web container?

I’ve presented here a simple example to illustrate how to convert stand-alone java programs (mostly, JARs) to WARs which can then be deployed in full-blown application servers (JBoss, WebSphere, etc.) or light weight web containers (Tomcat, Jetty, etc.). This’s generally done to avoid the hassle of managing background daemon processes separately. Also, deploying all of […]

JBoss App Server Memory and Thread Info Using JMX Console

JBoss AS (Application Server) provides some useful information through its JMX console that’d be helpful in understanding the deployed applications and doing some performance tuning. The provided information include server performance, how much memory is used, the total CPU time each thread has used etc.. How to know all this info? Open the below URL […]

How to reload an application WAR in JBoss using twiddle utility?

Enabling JMX in JBoss To enable JMX access to JBoss, add the following arguments to JBoss VM args: The above line will enable only local monitoring. To enable remote JMX connection we need to specify the port which the JMX server will listen for remote connections. (or any other port number) The JMX […]

java.lang.ClassCastException: [ServletName] cannot be cast to javax.servlet.Servlet: How to resolve?

When I was using tomcat-maven-plugin to test an app I worked on in embedded tomcat , it was erroring out with the following message: INFO: Marking servlet TestWebServiceServlet as unavailable Jun 17, 2011 4:01:48 PM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /cxf threw load() exception java.lang.ClassCastException: cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet( at org.apache.catalina.core.StandardWrapper.load( at […]

How to secure JMX Console in JBossAS?

JMX Console is a very useful/powerful administration console for JBossAS.  I’ve rarely seen admins making full use of it. Irrespective of the usage, I’d recommend that to be kept in the JBoss deploy directory. Fine. Let’s now think towards securing it, which is not often done. Here’re the step-by-step instructions. I’ve tried this with JBossAS […]

Multiple WARs using Hibernate (with c3p0 connection pool) in same app server

A C3P0Registry mbean is already registered. This probably means that an application using c3p0 was undeployed, but not all PooledDataSources were closed prior to undeployment. This may lead to resource leaks over time. Please take care to close all PooledDataSources. We had this problem when we were trying to deploy multiple applications within same app […]

How to deploy exploded war in JBoss?

If you’ve just started using JBoss, this question should have nagged you to search in google. It’s simple. If you generally deploy mywebapp.war in JBOSS_HOME/server/default/deploy/ (or deploy directory in all/ or minimal/) to get your app working, just do this to deploy it as an exploded archive: Unzip it, rename the directory ‘mywebapp’ to mywebapp.war and […]