users@jaxb.java.net

Re: simple question

From: jason white <jason_white_01_at_hotmail.com>
Date: Tue, 04 Apr 2006 16:03:19 +0000

I still am having problems because even though I follow the advice below of
adding an entry to the manifest pointing out the jar..xjc still does not see
that jar when running the plugin...any ideas?

here is the manifest file contents:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
Class-Path: ejb3-persistence.jar

This is true for any jar that I add that is foreign to jaxb. I have
experimented with others as well...And have also experimented with no
foreign jars and it works well so I feel this is isolated to jars that jaxb
does not know about...however why would it ignore my manifest?

-jason
------------------------------------------------------------------------------------------------------------------------------------------

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