users@jaxb.java.net

Java 6, JAXB, and XJC Plugins

From: McIlwee, Craig <craig.mcilwee_at_openroadsconsulting.com>
Date: Sun, 17 May 2009 19:36:21 -0400

Hi,

We have been using a modified version of the code injection plugin for xjc in several projects for years and have had no issues. We are now trying to migrate to Java 6 and its causing a bit of trouble. From the reading I've done on this list and through google searching, I've concluded that it is not possible to use the ant XJCTask with java 6 because of the following error:

java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: Provider com.orci.gateway.build.CodeInjector could not be instantiated: java.lang.ClassCastException

As a workaround I thought that I could use the xjc.exe bundled with the Java 6 SDK instead, so I put a branch in my build script that executes the XJCTask if compiled under java 5 or runs xjc through ant exec if java 6. This works fine for schemas that don't need the code injection plugin, but once I try to use the plugin I get a failure because of "unrecognized parameter -Xorci-inject". After reading through this list a bit more I found this post:

http://www.nabble.com/Re%3A-(JAXB-Plugin)-Customize-the-body-of-a-setter-method-to-fire-bound-properties-p8303769.html

which says that the xjc in java 6 doesn't support plugins and I'm shocked to hear this. Is it really true that xjc in java 6 doesn't support plugins? If so, are there any workarounds available?

Thanks,
Craig McIlwee