users@jaxb.java.net

Plugin problem

From: Patrick BRUNETON <patrick.bruneton_at_eads.com>
Date: Wed, 17 Aug 2005 10:54:15 +0200

Hi,

I have a problem to integrate a plugin with JAXB 2.0. It is a very simple
plugin which does nothing. Problem is xjc doesn't instanciate it.
I put my plugin in a separated jar and launch xjc with the command line :
java -Dcom.sun.tools.xjc.Options.findServices=true -classpath
"jaxb-ri-20050815\lib\jaxb-xjc.jar;plug.jar" com.sun.tools.xjc.XJCFacade

I got the error :
java.lang.ArrayStoreException
        at java.lang.System.arraycopy(Native Method)
        at java.util.ArrayList.toArray(ArrayList.java:305)
        at com.sun.tools.xjc.Options.findServices(Options.java:590)
        at com.sun.tools.xjc.Options.findServices(Options.java:527)

I looked at the sources, and it seems there is a problem with classloaders,
the Plugin class is loaded two times.
Then I looked in the mailing list and found, somebody already had this
problem and solved it.
However I don't know what to do !
I downloaded the latest version and now the error is :
plugin.Custom is not a subclass of class com.sun.tools.xjc.Plugin. Skipping

I tried to put my plugin directly into jaxb-xjc.jar with standard plugins.
I thought only one Classloader would be used.
But I still have the error !

What is the standard way to add a plugin ? Is there any example (which does
not use Ant task) ?
Thanks.