05 November 2013

No More Commercial Support for GlassFish - So What?

"GlassFish reduced to toy product" and "R.I.P. GlassFish" are some of the headlines regarding Oracle's announcement to withdraw commercial support for the application server acting as Java EE reference implementation.

Oh well, I've stopped using GlassFish 3.x on a regular basis about a year ago when it became apparent that GlassFish 3.1.2.2 was a dead end for the Java EE 6 Open Source product (see comments of the linked blog post), and I've never really started using GlassFish 4.0 except for quick demos, knowing the release policy would be just the same as for 2.x and 3.x, where the Open Source release was more of a public beta for the closed-source commercial product.

It's nice to know you can get commercial support for a server if you need it and if somebody is willing to pay for it. On the other hand, lots of companies run successful businesses with applications built on Open Source web containers or application servers without any commercial support, because commercial support is not affordable in their business models. Moreover, commercial support is not a guarantee for getting a hot-fix when you need it, if the vendor's priorities happen to differ from your own.

Like many others, I've turned from GlassFish to JBoss AS/WildFly (after evaluating and dismissing TomEE for lack of stability and documentation). JBoss AS 7 has surpassed GlassFish in terms of usability and reliability, and it's just a shame that RedHat has now converted JBoss AS to a Not-So-Open Source project, hiding branches and tags in a private repository and no longer publishing Community binaries. But that's another story...

08 July 2013

Browsing a Lucene 4.x index with Luke

Luke is a small desktop client for browsing Lucene indices. It is very useful for troubleshooting when you work with Lucene directly embedded in your application.

While upgrading an application from Lucene 3.4 to Lucene 4.3.1, I realized that Luke is not quite up-to-date with Lucene, it is stuck somewhere in 4.0.0 alpha.

But the good thing about Open Source is, if the original project owners lose time, resources or interest, others may show up and fork or continue the work.

A number of people have forked or copied Luke to GitHub. tarzanek/luke also offers binary builds on java.net, and this version works fine for me with Lucene 4.3.1 so far.

11 December 2012

Eclipse Juno Patch for XML Editor Performance

Eclipse Juno has a number of performance regressions compared to Indigo. Switching back and forth between XML and Java editors can be tediously slow even in Juno SR1.

The patch provided for bug 394588 solves the issue or at least significantly improves the response time of the IDE.

In my team, we have tested the patch successfully on Windows 32 bit and Ubuntu Linux 64 bit with Oracle Java 6 and 7.

The patch can be installed from a special update site via Help | Install New Software.

23 November 2012

Logging with SLF4J and Logback in Tomcat and TomEE

Logging in Java would be a lot easier if every open source project out there would use SLF4J logging API, but of course this will never happen.

The fact that java.util.logging made it into the JRE does not make it any better than it is, so there's a good reason to hide it behind a facade and never use it directly. But there is no reason for everyone to invent their own logging facades instead of simply using SLF4J.

In my own applications, I always use SLF4J with Logback. Working with Tomcat, this means I'm getting an ugly mixture of log messages in different formats from my web application logging to System.out with Logback, and from Tomcat itself logging to System.err via JULI and java.util.logging, not to mention any third-party libraries contained in my application which use log4j, Apache Commons Logging or whatever.

There are two independent but similar approaches of replacing the official Tomcat JULI libraries by an SLF4J or Logback adapter: tomcat-slf4j and tomcat-slf-logback.

I've tried both, but in the end, I think it's easier to use nothing but the JUL-to-SLF4J bridge and other standard artifacts.

20 October 2012

Using the Maven 3 API with Maven 2 Components

Working on a Maven plugin, I was trying to upgrade the Maven API from 2.x to 3.0.4. After the upgrade, the plugin would no longer compile due to an unsatisfied transitive dependency of the maven-archiver used by the plugin: The class org.apache.maven.artifact.DependencyResolutionRequiredException could not be resolved.

The same issue was posted on the Maven Users list, but never answered.

Solution: Add a dependency on maven-core, or on maven-compat which should handle all compatibility issues with Maven 2.

20 August 2012

New OSGi Console in Equinox 3.8.0

Equinox 3.8.0, the OSGi framework running Eclipse Juno, comes with a new console built on top of Apache Felix Gogo Shell.

It is debatable whether or not this is an improvement. Veteran Equinox users are greeted with the following message when trying to activate the console:

08 August 2012

Maven Build Info for Web Applications

Problem

* You want to include build info like build number, revision number etc. as a web resource in your web applications.
* You have a multi-module Maven project with more than one WAR module and a number of JAR modules.
* You want to minimize copy-and-paste configuration in your POMs.
* The mechanism should not depend on a CI server.

Solution

This can be achieved using the Build Number Maven Plugin and the overlay feature of the Maven WAR plugin.

18 July 2012

OSGi and CDI Combined

Pax CDI is a new OPS4J community project I've started to combine the best of OSGi and CDI.

Once you've worked with CDI or with an up-to-date annotation-based flavour of Spring, the service registry API or XML-based dependency injection in the Blueprint or Declarative Services style suddenly appears rather verbose.

On the other hand, even though Java EE 6 is more lightweight than ever, its monolithic nature feels rather a burden when you're used to OSGi.

Why not have the best of both worlds? The idea is not new, it has been implemented to some extent both in weld-osgi and in the FighterFish subproject of GlassFish.

Unlike these two projects, Pax CDI is independent of any given CDI, Java EE or OSGi implementation. The first proof-of-concept release is based on Apache OpenWebBeans and Equinox. In contrast to weld-osgi, which required some modifications in Weld itself, Pax CDI works with an unmodified version of OpenWebBeans.

Trying to do the same with Weld is one of the next goals for Pax CDI.

An alpha release Pax CDI 0.1.0 is available from Maven Central.

28 June 2012

Fixing Editor Tab Fonts in Eclipse Juno

Eclipse Juno is out! It starts a good deal faster than Indigo, shows a more colourful (but ill-proportioned) splash screen, and then opens a workbench window with oversized and truncated labels in all editor tabs.

This applies to Ubuntu 12.04 with KDE and the QtCurve GTK+ theme.
This issue is not due to QtCurve or SWT, as I had first suspected, but to the new CSS-based widget styling of the e4 platform. There is an E4 CSS Editor which is not included in Juno by default, but can be installed via the Update Manager.

With this editor, you can change the font-size and font-family properties of the MPartStack style used by the editor tabs.
Much better!

Update 14 Aug 2012: If you develop web applications and edit CSS files in Eclipse, you'd better deinstall the E4 CSS editor after customizing the workbench layout to fall back to the standard WTP CSS editor. The XText-based E4 editor does not recognize some legal syntax like unquoted URLs.

Actually, you don't need any Eclipse plugin to change the CSS, you can directly edit the CSS file in your Eclipse installation at plugins/org.eclipse.platform_4.2.0.v20120608140/css/e4_default_gtk.css.



25 June 2012

Pax JDBC: An OSGi JDBC Service

Pax JDBC is a new project under the OPS4J umbrella which simplifies the use of JDBC drivers in OSGi applications by providing a generic driver extender and various native driver adapters for your favourite database.

This project aims at compliance with the OSGi Enterprise Release 5.0 specification.

Pax JDBC 0.1.0 is available from Maven Central, with native adapters for Apache Derby and PostgreSQL. Since this first release, support for H2 and MySQL has been added, and further contributions are always welcome.