Hi Jay
No you don't have to use scomp. Actually there is a clue to what's wrong
in stack trace below. The line "Make sure the generated binary files are
on the classpath" tells you what you need.
The problem is that in older versions of generated XmlBeans there is a
hardcoded reference to the TypeSystemHolder class. The TypeSystemHolder
class is generated in the binary output directory. If you update your
ant call as follows
<xmlbean
schema="schema_file.xsd"
srcgendir="src"
classgendir="xxx"
javasource="1.5"
/>
and then put xxx also on the classpath when you are compiling the files,
then all should be fine.
Note that at runtime you will also need all the .xsb files which get
generated in the binary output directory which is why I removed the
srconly="true" attribute.
In later versions of XmlBeans that reference is by reflection so you
don't need the reference at compile time (although you still need it at
runtime and hence will still need srconly="false").
Cheers,
Lawrence
> -----Original Message-----
> From: Jay Dickon Glanville [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 09, 2006 10:00 AM
> To: [email protected]
> Subject: do I have to use the scomp to generate classes?
>
> Hello all.
>
> I have a situation here that I'd a little confused about.
>
> Do I have to use the schema compiler from XmlBeans to compile the java
> files into classes or can I use any compiler?
>
> The reason I ask this is because I'm using the scomp ant task to
> generate just the java files, and then using my IDE's compiler to
> compile them within my project. So, my ant task looks something like
> this:
>
> <xmlbean
> schema="schema_file.xsd"
> srconly="true"
> srcgendir="src"
> javasource="1.5"
> />
>
> It produces java files no problem. My IDE then compiles them without
> complaint. The problem is that when I try and run my application that
> uses this code, I get ClassNotFoundException (the full stack trace is
> included at the end of the email).
>
> Now, when I use scomp to generate the full set (java, class and jar),
> I have no problems at all.
>
> Is this because the compiler in scomp is including things in my
> classes that a regular compiler wouldn't? Why does compiling
> internally create a different result then compiling externally?
>
> Thanks
>
> JDG
>
> Stack Trace:
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at
>
org.xmlsoap.schemas.soap.envelope.EnvelopeDocument$Factory.parse(Envelop
eD
> ocument.java:59)
> at
com.nci.cv_02_08.ReadResponseTest.main(ReadResponseTest.java:11)
> Caused by: java.lang.RuntimeException: Cannot load SchemaTypeSystem.
> Unable to load class with name
>
schemaorg_apache_xmlbeans.system.s88F62AE3CA8827E50A463322427D3BC8.TypeS
ys
> temHolder.
> Make sure the generated binary files are on the classpath.
> at
>
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:781)
> at
>
org.xmlsoap.schemas.soap.envelope.EnvelopeDocument.<clinit>(EnvelopeDocu
me
> nt.java:20)
> ... 2 more
> Caused by: java.lang.ClassNotFoundException:
>
schemaorg_apache_xmlbeans.system.s88F62AE3CA8827E50A463322427D3BC8.TypeS
ys
> temHolder
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at
>
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:767)
> ... 3 more
>
> --
> Jay Dickon Glanville
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]