Monday, October 18, 2010

New 'Java Application Server'

After a few days trying out various technologies to see what I liked and what would work, I finally got what I consider a cool new basis for a Java application server built.
  • Based on top of Tomcat 6
  • Deployed as a single simple expanded war file with minimal xml configuration
  • Integrates:
    • Spring 3.0 - all annotation based
      • Method/Database level Transactions (@Transactional)
      • JPA Entity Persistence (Hibernate based) (@Entity)
      • EntityManager / Container managed Datasource via JNDI (@PersistenceContext)
      • Lifecycle (@PostConstruct/@PreDestroy)
      • Injection (@Inject/@Provides/@Bean)
      • JMX beans (@ManagedResource)
    • Guice -  still not sure about this route, may just go with Spring for it
      • Guice-Servlet
    • Hessian for remote method calls
The key feature of all of this is that it cold starts up (with a connection to the database) on my laptop in under 4 seconds. Comparably, JBoss 6m5 default config without even connecting to a database or deploying any war files starts up in 22 seconds.

Next up, I'm probably going to integrate RESTeasy for JAX-RS support. I don't quite need to serve up html pages, but I could always just use jsp's or HTMLeasy.

The idea is that this will make a really good platform for developing enterprise Java applications without having to be tied to the slowness of JBoss startup times (and the way that a new release always breaks something), commercial products like tcServer or the dreadful thought of using Oracle's Glassfish. Sorry, not a Larry fan. I also tried Resin 4.x, but after getting no response regarding the JMX support on the mailing list and the general bugginess of it, I gave up. I'm also not sure that their CDI implementation is all that solid because of the way they extend your bean classes at startup.


mumbly said...

So how are you liking this setup a few months in? I'm starting a new personal project and am trying to come up with a good option for a dev/production JEE environment. I'd like to do JEE6 Web Profile + JAX-RS (why oh why was JAX-RS not included), in large part to do a real project with JEE6. And along with that, without Spring (not anti-Spring, just want to try building an modern app without it).

I'm currently using more or less what you listed. T6 + S3 + Jersey + Camel + EL and it works well, I'm just curious about the options. I really want to like Resin and it seems almost like a dream option, but JPA seems to be an afterthought and JAX-RS doesn't seem to play well with it. I'm looking at Glassfish, also. Not so down on it as you, but I'm still finding it hard to buy in to the lightweight argument, though embedded GF seems pretty nice and is something I've missed in Tomcat compared to Jetty.

Jon Scott Stevens said...

I *love* Tomcat + Spring (with annotations). I'm going to be converting all of our main() based applications over to war based deployment in order to make it easier to deploy and manage classpaths. Just 'aptitude install tomcat' and copy a war into a directory. Got to love that.

I still haven't gotten a chance to do anything with jax-rs yet, but that's the direction I'd go still.

I've been watching Resin's mailing lists for a while now. Resin is a pile of bugs and regressions on every release. I've given up on it completely. Not worth it. It is no wonder that they have never made it in the marketplace as a solid option.

Based on what Oracle just did to Hudson, I'm not going to base anything on top of their tech.