background preloader

GlassFish

Facebook Twitter

GlassFish Intro. Update: Since this post was published, RebelLabs has completed the full version of The Great Java Application Server Debate with Tomcat, JBoss, GlassFish, Jetty and Liberty Profile. Feel free to check it out! Download the full PDF report from RebelLabs This blog post continues the Great Application Server Debate series, in which we have already covered IBM Liberty Profile, Jetty, Tomcat and JBoss. Today we’re talking about GlassFish. As with previous posts, we will be reviewing the application server purely from a developers point of view.

GlassFish is the reference implementation for Java EE, originally developed by Sun Microsystems, and now owned by Oracle. Introduction Aaah good ol’ GlassFish! Why was I freaked out? So, what makes GlassFish so special? Read the complete Java Application Server Report where we discuss the pros and cons of App servers such as: Tomcat, Jetty, GlassFish, IBM WAS Liberty Profile and JBoss (aka WildFly): Go and get it! Start, run and stop sigmar$ . Lets manage! Monitoring with JMX. Lately I was struggling with the JMX configuration of the glassfish application server (version 3.2.1) longer than initially expected. Maybe I should have read the glassfish documentation first but I was kind of lazy and started with trial and error. So if someone else wants to do the same thing here are the problems I faced and the steps to solve them. In my case I wanted to read out the number of active HTTP sessions of a remote glassfish server using JMX.

I started with JConsole to check which concrete JMX beans and attributes are offered by glassfish. I looked up the JMX connection port in the glassfish admin (default port is 8686) and tried to connect to the server: After a little while I found out that you have to tell glassfish with certain JVM parameters that it should accept remote JMX connections (to make things easy no authentication was activated): After a restart of the application server the connection with JConsole was successful. Monitor session data in glassfish - Heiko. Monitoring via REST. Recently i have spent some time thinking how i can integrate active monitoring of Glassfish critical resources into my reactive Performance Reports.

I was having a performance report showing me both response times and throughput, but i needed to know why, at some points in time, my throughput was decreasing. There could have been several reasons, like JMS, JDBC, too many open connections , etc… I needed to have those values in my report, so i could easily identify problems without proactively monitoring while testing. So i started thinking about ways to do it. At first, i wanted to monitor the following resources (there are lots to follow, but now i’ll just stick to these ones, as these ones were the ones i needed in the beginning) I also needed to develop a solution that would allow me adding new monitoring statistics later, in a “plug-in” fashion. Basically, there are three ways (of which i am aware of at least) that you can do it: The result lookis like this: And now bean monitoring: Alex.

SSL b/w glassfish and mod_jk. Loadbalancing with mod_jk. Since GlassFish V1, it has been possible to front-end a GlassFish instance with Apache's httpd web server, after following a few simple configuration steps, which include defining the com.sun.enterprise.web.connector.enableJK system property on the GlassFish instance, and specifying the port number of the mod_jk listener on the GlassFish instance as its value. By specifying this system property, the mod_jk connector, which comes standard with GlassFish (minus the JAR files that need to be copied from a Tomcat installation as per the configuration steps referenced above), will be started automatically and will listen on the specified port to any traffic sent by the httpd front-end over the AJP protocol.

(Please notice that when you follow the configuration steps referenced above, you must use the tomcat-ajp.jar from Tomcat 5.5.23. Using the tomcat-ajp.jar bundled with a more recent Tomcat release will not work.) The remainder of this blog covers important configuration aspects. Configure https listener. Use the create-ssl subcommand in remote mode to create and configure an SSL element in the specified listener.

This enables secure communication for the listener. Ensure that the server is running. Remote subcommands require a running server. Configure an HTTP listener by using the create-ssl(1) subcommand. Example 16–14 Configuring an HTTP Listener for SSL This example enables the HTTP listener named http-listener-1 for SSL: See Also You can also view the full syntax and options of the subcommand by typing asadmin help create-ssl at the command line. SSL from browser to mod_jk. Throwing Light on GlassFish Webserver Plugins and Proxying.

We Recommend These Resources Inspired by an article done by Lincoln Baxter III about running JBoss on port 80, I decided to have a more detailed look at what's possible and necessary for GlassFish to utilize proxying and load-balancing. Let's look at the basics front up. First of all we have to separate two kinds of problems here. The one addressed by Lincoln which talks about general Unix/Linux security restriction which prevents non-root users from binding to privileged-ports (in this case port 80). Binding GlassFish to port 80 (HTTP) There are occasions when it is convenient to allow non-root users to run services, binding to "privileged ports". Using a firewall(iptables) to redirect packets This technique configures the firewall to send all port 80 traffic to port 8080 (Normal GF Application Port). 1.iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 2.iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080 1.. 6.