users@jaxb.java.net

Re: XJC Plugin

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 23 Apr 2008 08:47:48 +0200

Hi.

> I downloaded a plugin jar from JAXB2_Commons and have had problems getting
> it to run.
> XJC finds the plugin but throws an exception that the plugin provider can
> not be cast to the com.sun.xjc.tools.Plugin class.

This is a known problem. You're probably using Ant to build and Java 1.6?
There are some class loading problems, this should be resolved in the
latest Java 1.6 releases (however I have not tried that myself).

> After many different tries I decided I needed to debug this problem.
> I downloaded the source for xjc and built it and the same issue existed.
> I downloaded the plugin source, built it within the same project as xjc and
> the same issue still existed.
> I then moved the plugin from the package
> "org.jvnet.jaxb2_commons.defaultvalueplugin" to the
> "com.sun.tools.xjc.addon.defaultvalueplugin" package in the xjc project.
> This move got the plugin to work.
> What do I need to configure to get these plugins to work without performing
> the above process and using my own build of xjc?
> I'm using jaxb-ri-20071219 and associated xjc.

The most reasonable approach there's right now is to use Maven. We've
addressed the class loading issue in maven-jaxb2-plugin and JAXB2
plugins do work there. Alternatively, if you want to stay with Ant,
try building with Java 1.5.

Bye.
/lexi