users@jaxb.java.net

Re: simple question

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 17 Mar 2006 18:15:36 -0800

jason white wrote:
> running with latest bits that you pointed out and with my valid
> xjchibernate.jar
>
> xjc -cp xjchibernate.jar -Xhibernate-java decodes.xsd
> unrecognized parameter -Xhibernate-java

A good way to debug the plugin boot issue is to use the debug
com.sun.tools.xjc.Options.findServices system property.

If I run XJC like this, I get the following error. So the issue is that
you are relying on EJB3 classes, so you need to have them in the
classpath as well.

A good way to do this is to have Class-Path entry in your jar's
META-INF/MANIFEST.MF like this:


Class-Path: ejb3.jar

(I don't know what jar file EJB3 uses, so replace it accordingly)

$ export XJC_OPTS="-Dcom.sun.tools.xjc.Options.findServices=true"
$ xjc.sh -cp xjchibernate.jar -help
...
Looking for META-INF/services/com.sun.tools.xjc.Plugin for add-ons
Checking
jar:file:/C:/kohsuke/Sun/JAXB/jaxb-ri/dist/lib/jaxb-xjc.jar!/META-INF/services/com.sun.tools.xjc.Plugin
for an add-on
Attempting to instanciate
com.sun.tools.xjc.addon.locator.SourceLocationAddOn
Attempting to instanciate
com.sun.tools.xjc.addon.sync.SynchronizedMethodAddOn
Attempting to instanciate com.sun.tools.xjc.addon.at_generated.PluginImpl
Checking
jar:file:/c:/kohsuke/Sun/jaxb/jaxb-ri/dist/bin/xjchibernate.jar!/META-INF/services/com.sun.tools.xjc.Plugin
for an add-on
Attempting to instanciate com.hb.XjcHibernatePlugin
java.lang.NoClassDefFoundError: javax/persistence/CascadeType
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
         at java.lang.Class.getConstructor0(Class.java:2640)
         at java.lang.Class.newInstance0(Class.java:321)
         at java.lang.Class.newInstance(Class.java:303)
         at com.sun.tools.xjc.Options.findServices(Options.java:763)
         at com.sun.tools.xjc.Options.getAllPlugins(Options.java:284)
         at com.sun.tools.xjc.Driver.usage(Driver.java:480)
         at
com.sun.tools.xjc.Driver$OptionsEx.parseArgument(Driver.java:448)
         at com.sun.tools.xjc.Options.parseArguments(Options.java:650)
         at com.sun.tools.xjc.Driver.run(Driver.java:214)
         at com.sun.tools.xjc.Driver.run(Driver.java:178)
         at com.sun.tools.xjc.Driver._main(Driver.java:103)
         at com.sun.tools.xjc.Driver.access$000(Driver.java:61)
         at com.sun.tools.xjc.Driver$1.run(Driver.java:83)


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com