users@jaxb.java.net

Re: Java 6, JAXB, and XJC Plugins

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Mon, 18 May 2009 07:40:19 +0200

You can download JAXB RI from jaxb.dev.java.net and use the xjc that comes
with it. The runtime might still come from Java 6 SDK. I'm currently doing
just this, using the provided code insertion plugin in combination with one
of my own.

-W


On Mon, May 18, 2009 at 1:36 AM, McIlwee, Craig <
craig.mcilwee_at_openroadsconsulting.com> wrote:

> 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<http://www.nabble.com/Re%3A-%28JAXB-Plugin%29-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
>