Nagios JBoss Plugin

Perl script to check thread and memory usage of a Jboss server.

I didn't like the Jboss checks that I've found which require Java or remote-run, so I wrote this. It's a simple check that looks at memory usage and busy threads. I did this with percentage thresholds to make it dynamic.

Usage: check_jboss_status.pl [-H ] [-P ] [-t ]
[-m
] [-a ]
[-h
]
-H The host to connect to (default: localhost)
-P The port to connect to (default: 8080)
-a The AJP ports to check for (default: 8009)
-h
The HTTP ports to check for (default: 8080,8443)
-t The percentage of threads busy for warning
(default: 80,50)
-m
The percentage of memory used for warning
(default: 80,50) Continue reading “Nagios JBoss Plugin” »

Share

Deploying a J2EE application behind an Apache server in a production environment

You have created a Web application using a JBoss application server and you are going to put it in production. Great!

But deploying your application with JBoss serving the Web requests directly may not be the optimal solution. First because the Tomcat web server embedded within JBoss is not the best server to serve static files and second because configuring Tomcat and JBoss for best performance and security is in general a complex and tedious task.

Instead, it is a good practice to use an Apache server (2.0 or 2.2) in front of your JBoss/Tomcat. This Apache server can serve static files, take care of your SSL security and manage for you all the details of HTTP headers (Expires and other headers) and more….

In a production environment, you should not put your JBoss application as a Web front-end. Instead, you should use an Apache server and configure it to redirect specific Web application requests to your J2EE server. There are many many advantages in doing this:

    The Apache server can serve static files (CSS, images, javascript files) faster than JBoss/Tomcat.
    When you need it, you can activate SSL on Apache without having to change your application.
    The Apache SSL implementation is faster compared to the Tomcat implementation (and a lot easier to configure!).
    You can have a better control of HTTP headers. No need to develop any servlet filter for that.
    You can get compression out of the box. No need to develop another servlet filter either (no need to configure Tomcat connector either!).

I assume here that the Apache server is already installed with the following modules and these modules are enabled. Continue reading “Deploying a J2EE application behind an Apache server in a production environment” »

Share

Hiding X-Powered by on JBoss Application Server 4.22.x

JBoss can add headers in the HTTP response. The X-Powered-By header exposes what implementation is behind your site. This header is created by a servlet filter that is activated by default in JBoss web configuration files (…/usr/java/jboss-4.2.2.GA/server/default/deploy/jboss-web.deployer/conf/web.xml). You can either disable this filter by commenting the following lines:

   <filter>
      <filter-name>CommonHeadersFilter</filter-name>
      <filter-class>org.jboss.web.tomcat.filters.ReplyHeaderFilter</filter-class>
      <init-param>
         <param-name>X-Powered-By</param-name>
         <param-value>Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5</param-value>
      </init-param>
   </filter>

Now update <param-value> at your wish 🙂

Share