Discussion:
Problems with WSDL2Java
Christian Pöcher
2006-07-19 09:44:30 UTC
Permalink
Hi there,

since I am still very fresh to the area of webservices, I'm not sure, if
my problem is related to a bug in the code gerneration of Axis2 or if I
made an error.

I try to write a simple webservie that adds two integers and gives back
the sum. After writing the WSDL file and and generating code with
WSDL2Java, I notice errors in the code. I tried both Axis2 1.0 and the
nightly build of today. In 1.0 I get an error about newXMLStreamReader()
as described in http://issues.apache.org/jira/browse/AXIS2-760?page=all
and in the nightly I get totally funny code like this:
wrappedParam =
()fromOM(
msgContext.getEnvelope().getBody().getFirstElement(),
.class,
getEnvelopeNamespaces(msgContext.getEnvelope()));

I'd appriciate an explaination and a workaround very much.

I used the following WSDL file:

<?xml version="1.0"?>
<definitions name="mathWS"

targetNamespace="http://chris.math.ut.ee/plus.wsdl"
xmlns:tns="http://chris.math.ut.ee/plus.wsdl"
xmlns:xsd1="http://chris.math.ut.ee/plus.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">

<types>
<schema xmlns="http://www.w3.org/2000/10/XMLSchema">
<element name="sum" type="integer"/>
<element name="summands">
<complexType>
<all>
<element name="summand0" type="integer"/>
<element name="summand1" type="integer"/>
</all>
</complexType>
</element>
</schema>
</types>

<message name="getSum">
<part name="rightHandSide" type="sum"/>
</message>

<message name="getSummands">
<part name="leftHandSide" type="summands"/>
</message>

<portType name="mathWSPortType">
<operation name="plus">
<input message="tns:getSummands"/>
<output message="tns:getSum"/>
</operation>
</portType>

<binding name="mathWSSoapBinding" type="tns:mathWSPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="plus">
<soap:operation soapAction="http://chris.math.ut.ee/plus"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>

<service name="MathWS">
<documentation>Does your maths</documentation>
<port name="MathWSPort" binding="tns:mathWSSoapBinding">
<soap:address location="http://example.com/mathws"/>
</port>
</service>

</definitions>

Afterwards, I decided to try the example WSDL file from the spec
(http://www.w3.org/TR/wsdl#_wsdl), which gives an exception with both
versions of Axis2.
Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:123)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
Caused by: org.apache.axis2.AxisFault: null; nested exception is:
java.lang.NullPointerException
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:226)
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:114)
... 2 more
Caused by: java.lang.NullPointerException
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.generateWrapperSchema(WSDL11ToAxisServiceBuilder.java:888)
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:192)
... 3 more

Any suggestions?

TIA, Chris
Christian Pöcher
2006-07-19 16:35:42 UTC
Permalink
Just for the archive: I resolved the problem. It was of course my fault,
although I wished the WSDL2Java tool would do a validity check, before
generating code.

In <types> I defined elements like <element name="sum" type="integer"/>
while in <message> I used a type attribute.
<message name="getSum">
<part name="rightHandSide" type="sum"/>
</message>

I also seem to have referenced an old version of the Schema namespace.
Changing <schema xmlns="http://www.w3.org/2000/10/XMLSchema"> to <schema
xmlns="http://www.w3.org/2001/XMLSchema"> finally helped.

-Chris
Anne Thomas Manes
2006-07-20 22:03:45 UTC
Permalink
And just for clarity -- the sample WSDL in the WSDL spec is not valid...

Anne
Post by Christian Pöcher
Just for the archive: I resolved the problem. It was of course my fault,
although I wished the WSDL2Java tool would do a validity check, before
generating code.
In <types> I defined elements like <element name="sum" type="integer"/>
while in <message> I used a type attribute.
<message name="getSum">
<part name="rightHandSide" type="sum"/>
</message>
I also seem to have referenced an old version of the Schema namespace.
Changing <schema xmlns="http://www.w3.org/2000/10/XMLSchema"> to <schema
xmlns="http://www.w3.org/2001/XMLSchema"> finally helped.
-Chris
---------------------------------------------------------------------
郝俊杰
2006-07-21 01:49:08 UTC
Permalink
hi all,
I have deployed my service on axis2 ,could I use it with a cpp client and how ?
Kinichiro Inoguchi
2006-07-21 01:57:13 UTC
Permalink
Hi,

Add "Web reference" to your project from menu, if you use Visual Studio
.NET.
Post by 郝俊杰
hi all,
I have deployed my service on axis2 ,could I use it with a cpp client and how ?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Anne Thomas Manes
2006-07-21 15:59:52 UTC
Permalink
Pick one of the C++ SOAP toolkits (Axis for C++, gSOAP, Systinet for
C++, etc) and use the supplied tool to generate a C++ client stub from
your service's WSDL.

Anne
Post by 郝俊杰
hi all,
I have deployed my service on axis2 ,could I use
robert lazarski
2006-07-19 16:57:23 UTC
Permalink
Your WSDL doesn't validate - try using one of the many wsdl validators
and that should point you in the right direction. In the w3 case, you
also need to supply the external schema reference.

HTH,
Robert
http://www.braziloutsource.com/
Post by Christian Pöcher
Hi there,
since I am still very fresh to the area of webservices, I'm not sure, if
my problem is related to a bug in the code gerneration of Axis2 or if I
made an error.
I try to write a simple webservie that adds two integers and gives back
the sum. After writing the WSDL file and and generating code with
WSDL2Java, I notice errors in the code. I tried both Axis2 1.0 and the
nightly build of today. In 1.0 I get an error about newXMLStreamReader()
as described in http://issues.apache.org/jira/browse/AXIS2-760?page=all
wrappedParam =
()fromOM(
msgContext.getEnvelope().getBody().getFirstElement(),
.class,
getEnvelopeNamespaces(msgContext.getEnvelope()));
I'd appriciate an explaination and a workaround very much.
<?xml version="1.0"?>
<definitions name="mathWS"
targetNamespace="http://chris.math.ut.ee/plus.wsdl"
xmlns:tns="http://chris.math.ut.ee/plus.wsdl"
xmlns:xsd1="http://chris.math.ut.ee/plus.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema xmlns="http://www.w3.org/2000/10/XMLSchema">
<element name="sum" type="integer"/>
<element name="summands">
<complexType>
<all>
<element name="summand0" type="integer"/>
<element name="summand1" type="integer"/>
</all>
</complexType>
</element>
</schema>
</types>
<message name="getSum">
<part name="rightHandSide" type="sum"/>
</message>
<message name="getSummands">
<part name="leftHandSide" type="summands"/>
</message>
<portType name="mathWSPortType">
<operation name="plus">
<input message="tns:getSummands"/>
<output message="tns:getSum"/>
</operation>
</portType>
<binding name="mathWSSoapBinding" type="tns:mathWSPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="plus">
<soap:operation soapAction="http://chris.math.ut.ee/plus"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MathWS">
<documentation>Does your maths</documentation>
<port name="MathWSPort" binding="tns:mathWSSoapBinding">
<soap:address location="http://example.com/mathws"/>
</port>
</service>
</definitions>
Afterwards, I decided to try the example WSDL file from the spec
(http://www.w3.org/TR/wsdl#_wsdl), which gives an exception with both
versions of Axis2.
Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:123)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
java.lang.NullPointerException
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:226)
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:114)
... 2 more
Caused by: java.lang.NullPointerException
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.generateWrapperSchema(WSDL11ToAxisServiceBuilder.java:888)
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:192)
... 3 more
Any suggestions?
TIA, Chris
---------------------------------------------------------------------
Derek
2006-07-19 18:38:24 UTC
Permalink
I still think that the original poster (below) has found an error worth
logging in JIRA. Either Axis should generate a compilable webservice from
his WSDL, or it should emit an error message explaining why it can't. It
appears that neither is happening in this case.

In general, I think errors of that sort should be fixed, so that Axis at
least emits reasonable error messages when people do something wrong.

I'm going to get on a soapbox for a moment, because this is starting to
become a pet peeve of mine. It seems to be pretty common on this mailing
list to have dialogues of the form:

A: When I do <blah>, I get a NullPointerException from WSDL2Java!
B: Your WSDL is broken. Don't do <blah>. Do <blargh> instead.
A: OK. I fixed the WSDL. But now, WSDL2Java produces uncompilable code!
B: I noticed another way that your WSDL is broken. Don't do <foo>. Do <bar>
instead.
A: OK. I fixed that too. Now everything works great. Thanks!

with the implication being that a NullPointerException or producing
uncompilable code is a perfectly valid way for WSDL2Java to tell the user
that something is wrong, and that fixing the user's WSDL is therefore enough
to fix the problem. Thus, the original user's problem is solved with no JIRA
having been created, so that Axis never gets fixed. This means that the next
person who does <blah> hits the same problem, and MAYBE eventually resolves
it by searching the mailing list archive, or maybe just wanders off and
finds another SOAP server with a less user-hostile interface. This is part
of why there is so much traffic and so many confused people on the Axis
mailing lists.

I would like to see more dialogue like the following:
A: When I do <blah>, I get a NullPointerException from WSDL2Java!
B: WSDL2Java should never throw a NullPointerException under any
circumstances. Please file a JIRA. Also, I noticed that your WSDL is broken.
Don't do <blah>. Do <blargh> instead.
A: OK. I filed JIRA #1234. But now, WSDL2Java produces uncompilable code!
B: WSDL2Java should never produce uncompilable code under any circumstances.
Please file a JIRA. Also, I noticed another way that your WSDL is broken.
Don't do <foo>. Do <bar> instead.
A: OK. I filed JIRA #5678. Also, fixing my WSDL as per your suggestion fixed
my problem. Thanks!
C: I fixed JIRA #1234 by having WSDL2Java detect attempts to use <blah>, and
emit an error message suggesting <blargh> instead.
D: I fixed JIRA #5678 by having WSDL2Java detect attempts to use <foo>, and
emit an error message stating that <foo> is not supported.

I'm guilty of this myself a bit -- I have seen some bizarre Axis WSDL2Java
behavior that I haven't reported to JIRA yet because I found a workaround.
In particular, WSDL that isn't WS-I compliant seems to frequently produce
malignant chaos of one sort or another instead of nice, comprehensible error
messages. I'm going to report the bugs that I found when I get a chance. I
encourage others to do likewise.

It seems to me that if WSDL2Java or similar tools EVER fail due to a
NullPointerException, ClassCastException or other RuntimeException, or if
they appear to run but produce uncompilable code, a JIRA should be filed in
every case.

Derek
-----Original Message-----
Sent: Wednesday, July 19, 2006 9:57 AM
Subject: Re: Problems with WSDL2Java
Your WSDL doesn't validate - try using one of the many wsdl
validators and that should point you in the right direction.
In the w3 case, you also need to supply the external schema reference.
HTH,
Robert
http://www.braziloutsource.com/
Post by Christian Pöcher
Hi there,
since I am still very fresh to the area of webservices, I'm
not sure,
Post by Christian Pöcher
if my problem is related to a bug in the code gerneration
of Axis2 or
Post by Christian Pöcher
if I made an error.
I try to write a simple webservie that adds two integers and gives
back the sum. After writing the WSDL file and and
generating code with
Post by Christian Pöcher
WSDL2Java, I notice errors in the code. I tried both Axis2
1.0 and the
Post by Christian Pöcher
nightly build of today. In 1.0 I get an error about
newXMLStreamReader() as described in
http://issues.apache.org/jira/browse/AXIS2-760?page=all
wrappedParam =
()fromOM(
msgContext.getEnvelope().getBody().getFirstElement(),
.class,
getEnvelopeNamespaces(msgContext.getEnvelope()));
I'd appriciate an explaination and a workaround very much.
<?xml version="1.0"?>
<definitions name="mathWS"
targetNamespace="http://chris.math.ut.ee/plus.wsdl"
xmlns:tns="http://chris.math.ut.ee/plus.wsdl"
xmlns:xsd1="http://chris.math.ut.ee/plus.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema xmlns="http://www.w3.org/2000/10/XMLSchema">
<element name="sum" type="integer"/>
<element name="summands">
<complexType>
<all>
<element name="summand0" type="integer"/>
<element name="summand1" type="integer"/>
</all>
</complexType>
</element>
</schema>
</types>
<message name="getSum">
<part name="rightHandSide" type="sum"/>
</message>
<message name="getSummands">
<part name="leftHandSide" type="summands"/>
</message>
<portType name="mathWSPortType">
<operation name="plus">
<input message="tns:getSummands"/>
<output message="tns:getSum"/>
</operation>
</portType>
<binding name="mathWSSoapBinding" type="tns:mathWSPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="plus">
<soap:operation
soapAction="http://chris.math.ut.ee/plus"/>
Post by Christian Pöcher
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MathWS">
<documentation>Does your maths</documentation>
<port name="MathWSPort" binding="tns:mathWSSoapBinding">
<soap:address location="http://example.com/mathws"/>
</port>
</service>
</definitions>
Afterwards, I decided to try the example WSDL file from the spec
(http://www.w3.org/TR/wsdl#_wsdl), which gives an exception
with both
Post by Christian Pöcher
versions of Axis2. Exception in thread "main"
Error parsing WSDL
Post by Christian Pöcher
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(Code
GenerationEngine.java:123)
Post by Christian Pöcher
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
java.lang.NullPointerException
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.popula
teService(WSDL11ToAxisServiceBuilder.java:226)
Post by Christian Pöcher
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(Code
GenerationEngine.java:114)
Post by Christian Pöcher
... 2 more
Caused by: java.lang.NullPointerException
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.genera
teWrapperSchema(WSDL11ToAxisServiceBuilder.java:888)
Post by Christian Pöcher
at
org.apache.axis2.description.WSDL11ToAxisServiceBuilder.popula
teService(WSDL11ToAxisServiceBuilder.java:192)
Post by Christian Pöcher
... 3 more
Any suggestions?
TIA, Chris
---------------------------------------------------------------------
---------------------------------------------------------------------
Davanum Srinivas
2006-07-19 18:56:55 UTC
Permalink
Post by Derek
It seems to me that if WSDL2Java or similar tools EVER fail due to a
NullPointerException, ClassCastException or other RuntimeException, or if
they appear to run but produce uncompilable code, a JIRA should be filed in
every case.
ABSOLUTELY +1!!!! With the wsdl in question of course.

thanks,
dims
Derek
2006-07-19 22:39:19 UTC
Permalink
Hi, folks.

I just ran WSDL2Java (from yesterday's nightly build), and generated a bunch
of output files. Now, I am trying to test a client which is written with
those output files. Whenever I try, however, I get the following exception:

Exception in thread "main" java.lang.ExceptionInInitializerError
at
crc.ieee1512import.xmlbeans.im.IMWrapper$Factory.newInstance(IMWrapper.java:
79)
at
crc.importtestclient.IEEE1512Client.createIMWrapper(IEEE1512Client.java:67)
at
crc.importtestclient.IEEE1512Client.runTest(IEEE1512Client.java:50)
at crc.importtestclient.ClientMain.main(ClientMain.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.RuntimeException: Cannot load SchemaTypeSystem. Unable
to load class with name
schemaorg_apache_xmlbeans.system.s3F178E0A50CC587BC745803A994CE78D.TypeSyste
mHolder. Make sure the generated binary files are on the classpath.
at
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:781)
at
crc.ieee1512import.xmlbeans.im.IMWrapper.<clinit>(IMWrapper.java:18)
... 9 more
Caused by: java.lang.ClassNotFoundException:
schemaorg_apache_xmlbeans.system.s3F178E0A50CC587BC745803A994CE78D.TypeSyste
mHolder
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)
... 10 more

I have verified that the generated 'resources' directory is in my classpath.
I have also verified that there exists a subdirectory of it named
schemaorg_apache_xmlbeans/system/s3F178E0A50CC587BC745803A994CE78D. However,
there is no TypeSystemHolder class in that directory (although there are a
bunch of .xsb files in it).

I am rather flummoxed as to what to do. Has anybody seen this before?

Derek
robert lazarski
2006-07-20 16:20:15 UTC
Permalink
When you run WSDL2Java with xmlbeans, there will indeed be a
TypeSystemHolder class generated and you have to somehow get that
class into you classpath. From the codegen guide:

http://ws.apache.org/axis2/tools/1_0/CodegenToolReference.html

"An important detail is that an XMLBean class file is also generated
by WSDL2Java, TypeSystemHolder.class. That file is placed into
build/classes by the above ant task and will be needed to compile the
generated sources. A frequent problem is users get an error such as:

ClassNotFoundException : Cannot load SchemaTypeSystem. Unable to load
class with name
schemaorg_apache_xmlbeans.system.s68C41DB812F52C975439BA10FE4FEE54.TypeSystemHolder.
Make sure the generated binary files are on the classpath.

The TypeSystemHolder.class generated by WSDL2Java must be placed in
your classpath in order to avoid this error."

For example, when I run WSDL2Java, I do it thru an ant task:

<target name="wsdl2java" depends="clean,prepare">
<delete dir="output" />
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<classpath refid="axis.classpath"/>
<arg value="-d"/>
<!-- none ??? -->
<arg value="xmlbeans"/>
<arg value="-uri"/>
<arg file="wsdl/Maragato.wsdl"/>
<arg value="-ss"/>
<arg value="-ssi"/>
<arg value="-g"/>
<arg value="-sd"/>
<arg value="-o"/>
<arg file="output"/>
<arg value="-p"/>
<arg value="br.com.atlantico.maragato.webservices.endpoint"/>
</java>

<!-- Move the schema folder to classpath-->
<move todir="${build.classes}">
<fileset dir="output/resources">
<include name="*schema*/**/*.class"/>
<include name="*schema*/**/*.xsb"/>
</fileset>
</move>

</target>

In this case, I get:

build/classes/schemaorg_apache_xmlbeans/system/sC4DADC577FF83F46C2C248EE4254F70D/TypeSystemHolder.class

I just confirmed that still works with todays svn.

HTH,
Robert
http://www.braziloutsource.com/
Post by Derek
Hi, folks.
I just ran WSDL2Java (from yesterday's nightly build), and generated a bunch
of output files. Now, I am trying to test a client which is written with
Exception in thread "main" java.lang.ExceptionInInitializerError
at
79)
at
crc.importtestclient.IEEE1512Client.createIMWrapper(IEEE1512Client.java:67)
at
crc.importtestclient.IEEE1512Client.runTest(IEEE1512Client.java:50)
at crc.importtestclient.ClientMain.main(ClientMain.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.RuntimeException: Cannot load SchemaTypeSystem. Unable
to load class with name
schemaorg_apache_xmlbeans.system.s3F178E0A50CC587BC745803A994CE78D.TypeSyste
mHolder. Make sure the generated binary files are on the classpath.
at
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:781)
at
crc.ieee1512import.xmlbeans.im.IMWrapper.<clinit>(IMWrapper.java:18)
... 9 more
schemaorg_apache_xmlbeans.system.s3F178E0A50CC587BC745803A994CE78D.TypeSyste
mHolder
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)
... 10 more
I have verified that the generated 'resources' directory is in my classpath.
I have also verified that there exists a subdirectory of it named
schemaorg_apache_xmlbeans/system/s3F178E0A50CC587BC745803A994CE78D. However,
there is no TypeSystemHolder class in that directory (although there are a
bunch of .xsb files in it).
I am rather flummoxed as to what to do. Has anybody seen this before?
Derek
---------------------------------------------------------------------
Derek
2006-07-20 18:59:57 UTC
Permalink
Thanks for your response, Robert.

I did some more looking, and found that my IDE (IntelliJ Idea) was hiding
the class file that was generated from me, so I didn't know it existed. I
also found that the specific run target that I was using wasn't including
the resources directory in the class path like I thought it was. I had set
up Idea to include the directory in the source path for compilation, not the
class path, assuming that what was going to be generated was Java source
code rather than a class file. I am still a bit surprised that an actual
class file is being generated here, particularly after looking at the code
in WSDL2Java which does it by copying and modifying an existing class file
(!). With the directory now properly included in my runtime class path, the
code now seems to run correctly.

Derek
-----Original Message-----
Sent: Thursday, July 20, 2006 9:20 AM
Subject: Re: Cannot load SchemaTypeSystem
When you run WSDL2Java with xmlbeans, there will indeed be a
TypeSystemHolder class generated and you have to somehow get
http://ws.apache.org/axis2/tools/1_0/CodegenToolReference.html
"An important detail is that an XMLBean class file is also
generated by WSDL2Java, TypeSystemHolder.class. That file is
placed into build/classes by the above ant task and will be
needed to compile the generated sources. A frequent problem
ClassNotFoundException : Cannot load SchemaTypeSystem. Unable
to load class with name
schemaorg_apache_xmlbeans.system.s68C41DB812F52C975439BA10FE4F
EE54.TypeSystemHolder.
Make sure the generated binary files are on the classpath.
The TypeSystemHolder.class generated by WSDL2Java must be
placed in your classpath in order to avoid this error."
<target name="wsdl2java" depends="clean,prepare">
<delete dir="output" />
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<classpath refid="axis.classpath"/>
<arg value="-d"/>
<!-- none ??? -->
<arg value="xmlbeans"/>
<arg value="-uri"/>
<arg file="wsdl/Maragato.wsdl"/>
<arg value="-ss"/>
<arg value="-ssi"/>
<arg value="-g"/>
<arg value="-sd"/>
<arg value="-o"/>
<arg file="output"/>
<arg value="-p"/>
<arg
value="br.com.atlantico.maragato.webservices.endpoint"/>
</java>
<!-- Move the schema folder to classpath-->
<move todir="${build.classes}">
<fileset dir="output/resources">
<include name="*schema*/**/*.class"/>
<include name="*schema*/**/*.xsb"/>
</fileset>
</move>
</target>
build/classes/schemaorg_apache_xmlbeans/system/sC4DADC577FF83F
46C2C248EE4254F70D/TypeSystemHolder.class
I just confirmed that still works with todays svn.
HTH,
Robert
http://www.braziloutsource.com/
Post by Derek
Hi, folks.
I just ran WSDL2Java (from yesterday's nightly build), and
generated a
Post by Derek
bunch of output files. Now, I am trying to test a client which is
written with those output files. Whenever I try, however, I get the
Exception in thread "main" java.lang.ExceptionInInitializerError
at
crc.ieee1512import.xmlbeans.im.IMWrapper$Factory.newInstance(IMWrapper
Post by Derek
79)
at
crc.importtestclient.IEEE1512Client.createIMWrapper(IEEE1512Cl
ient.java:67)
Post by Derek
at
crc.importtestclient.IEEE1512Client.runTest(IEEE1512Client.java:50)
at crc.importtestclient.ClientMain.main(ClientMain.java:39)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Post by Derek
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
orImpl.java:39
Post by Derek
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
odAccessorImpl
Post by Derek
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.RuntimeException: Cannot load
SchemaTypeSystem. Unable
Post by Derek
to load class with name
schemaorg_apache_xmlbeans.system.s3F178E0A50CC587BC745803A994C
E78D.TypeSyste
Post by Derek
mHolder. Make sure the generated binary files are on the classpath.
at
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans
.java:781)
Post by Derek
at
crc.ieee1512import.xmlbeans.im.IMWrapper.<clinit>(IMWrapper.java:18)
... 9 more
schemaorg_apache_xmlbeans.system.s3F178E0A50CC587BC745803A994C
E78D.TypeSyste
Post by Derek
mHolder
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at
java.security.AccessController.doPrivileged(Native Method)
Post by Derek
at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
Post by Derek
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
Post by Derek
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans
.java:767)
Post by Derek
... 10 more
I have verified that the generated 'resources' directory is in my
classpath. I have also verified that there exists a
subdirectory of it
Post by Derek
named
schemaorg_apache_xmlbeans/system/s3F178E0A50CC587BC745803A994CE78D.
However, there is no TypeSystemHolder class in that directory
(although there are a bunch of .xsb files in it).
I am rather flummoxed as to what to do. Has anybody seen
this before?
Post by Derek
Derek
---------------------------------------------------------------------
Christian Pöcher
2006-07-20 07:47:25 UTC
Permalink
Post by Derek
This means that the next
person who does <blah> hits the same problem, and MAYBE eventually resolves
it by searching the mailing list archive, or maybe just wanders off and
finds another SOAP server with a less user-hostile interface.
Actually, I did. I wandered off to Axis 1 and found the error output of
the old WSDL2Java more helpful, which eventually led me to those online
validators.

-Chris
Loading...