[groovy-user] GroovyWS client problem - fails w/ NoClassDefFoundError

已查看 40 次
跳至第一个未读帖子

Steve Tekell

未读,
2008年2月21日 17:08:062008/2/21
收件人 us...@groovy.codehaus.org

I am trying the demos here http://groovy.codehaus.org/GroovyWS
with public web services (just cutting and pasting)
but they fail with NoClassDefFoundError trying to create the proxy.

using groovyws-standalone-0.2.0.jar, Groovy 1.5.4 (and Java 1.5.10)

Is GroovyWS currently broken? Or the examples wrong? Or ?

thx,

Steve


---------------------
groovy> import groovyx.net.ws.WSClient;
groovy> def proxy = new
WSClient("http://terraservice.net/TerraService.asmx?WSDL",
this.class.classLoader)
groovy> // Create the Place object
groovy> def place = proxy.create("com.terraserver_usa.terraserver.Place")
groovy> // Initialize the Place object
groovy> place.city = "mountain view"
groovy> place.state = "ca"
groovy> place.country = "us"
groovy> // Geocode the place
groovy> def result = proxy.ConvertPlaceToLonLatPt(place)
groovy> println "Longitude: ${result.lon}"
groovy> println "Latitude: ${result.lat}"

Exception thrown: java.lang.NoClassDefFoundError

java.lang.NoClassDefFoundError
at
com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:25)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:89)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(RuntimeModelBuilder.java:42)
at
com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(ModelBuilder.java:114)
at
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:49)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:389)
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:253)
at
com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo.getJAXBContext(BindInfo.java:316)
at
com.sun.tools.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl$1.<init>(AnnotationParserFactoryImpl.java:63)
at
com.sun.tools.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl.create(AnnotationParserFactoryImpl.java:62)
at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.createAnnotationParser(NGCCRuntimeEx.java:320)
at
com.sun.xml.xsom.impl.parser.state.annotation.action0(annotation.java:48)
at
com.sun.xml.xsom.impl.parser.state.annotation.enterElement(annotation.java:68)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:378)
at
com.sun.xml.xsom.impl.parser.state.NGCCHandler.spawnChildFromEnterElement(NGCCHandler.java:74)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:213)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:378)
at
com.sun.xml.xsom.impl.parser.state.NGCCHandler.revertToParentFromEnterElement(NGCCHandler.java:111)
at
com.sun.xml.xsom.impl.parser.state.foreignAttributes.enterElement(foreignAttributes.java:50)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:378)
at
com.sun.xml.xsom.impl.parser.state.NGCCHandler.spawnChildFromEnterElement(NGCCHandler.java:74)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:436)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:378)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:205)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:378)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:181)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:378)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:372)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:378)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:388)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:378)
at com.sun.xml.xsom.impl.parser.state.Schema.enterElement(Schema.java:189)
at
com.sun.xml.xsom.impl.parser.state.NGCCRuntime.startElement(NGCCRuntime.java:219)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at com.sun.tools.xjc.util.SubtreeCutter.startElement(SubtreeCutter.java:68)
at
com.sun.tools.xjc.reader.ExtensionBindingChecker.startElement(ExtensionBindingChecker.java:128)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.tools.xjc.reader.xmlschema.parser.IncorrectNamespaceURIChecker.startElement(IncorrectNamespaceURIChecker.java:97)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.startElement(CustomizationContextChecker.java:172)
at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
at
com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.startElement(DOMForestScanner.java:125)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:224)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:261)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:230)
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:107)
at
com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:73)
at
com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:81)
at
com.sun.tools.xjc.reader.internalizer.DOMForestParser.parse(DOMForestParser.java:83)
at
com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:246)
at
com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:298)
at com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:87)
at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:147)
at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:136)
at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:497)
at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:216)
at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:69)
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:172)
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:143)
at groovyx.net.ws.WSClient.<init>(WSClient.java:126)
at Script2.run(Script2:2)


--
View this message in context: http://www.nabble.com/GroovyWS-client-problem---fails-w--NoClassDefFoundError-tp15620449p15620449.html
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Jason Brazile

未读,
2008年2月22日 02:43:052008/2/22
收件人 us...@groovy.codehaus.org
On Thu, Feb 21, 2008 at 11:08 PM, Steve Tekell <tek...@usgs.gov> wrote:
I am trying the demos here http://groovy.codehaus.org/GroovyWS
with public web services (just cutting and pasting)
but they fail with NoClassDefFoundError trying to create the proxy.

using groovyws-standalone-0.2.0.jar, Groovy 1.5.4 (and Java 1.5.10)

Is GroovyWS currently broken?  Or the examples wrong?  Or ?

I'm using the same versions of groovy/groovyws, (but java build 1.6.0-b105).
The example above works. I've also tried the apparently slightly newer terra interface:

import groovyx.net.ws.WSClient;

def proxy = new WSClient("http://terraserver-usa.com/TerraService2.asmx?WSDL",
  this.class.classLoader)
def place = proxy.create("com.terraservice_usa.Place")

place.city = "zurich"; place.state = ""; place.country = "ch"
def result = proxy.ConvertPlaceToLonLatPt(place)

println "Longitude: ${result.lon}"
println "Latitude: ${result.lat}"


Running it looks like this:

vocal(jason): groovy-1.5.4/bin/groovy terra2.groovy
22-Feb-2008 08:41:17 org.apache.cxf.endpoint.dynamic.DynamicClientFactory addSchemas
INFO: Loading the JAXB 2.1 simple binding for client.
22-Feb-2008 08:41:18 org.apache.cxf.endpoint.dynamic.DynamicClientFactory outputDebug
INFO: Created classes: com.terraservice_usa.AreaBoundingBox, com.terraservice_usa.AreaCoordinate, com.terraservice_usa.ArrayOfOverlappingThemeInfo, com.terraservice_usa.ArrayOfPlaceFacts, com.terraservice_usa.ArrayOfThemeBoundingBox, com.terraservice_usa.ConvertLonLatPtToNearestPlace, com.terraservice_usa.ConvertLonLatPtToNearestPlaceResponse, com.terraservice_usa.ConvertLonLatPtToUtmPt, com.terraservice_usa.ConvertLonLatPtToUtmPtResponse, com.terraservice_usa.ConvertPlaceToLonLatPt, com.terraservice_usa.ConvertPlaceToLonLatPtResponse, com.terraservice_usa.ConvertUtmPtToLonLatPt, com.terraservice_usa.ConvertUtmPtToLonLatPtResponse, com.terraservice_usa.CountPlacesInRect, com.terraservice_usa.CountPlacesInRectResponse, com.terraservice_usa.GetAreaFromPt, com.terraservice_usa.GetAreaFromPtResponse, com.terraservice_usa.GetAreaFromRect, com.terraservice_usa.GetAreaFromRectResponse, com.terraservice_usa.GetAreaFromTileId, com.terraservice_usa.GetAreaFromTileIdResponse, com.terraservice_usa.GetLatLonMetrics, com.terraservice_usa.GetLatLonMetricsResponse, com.terraservice_usa.GetPlaceFacts, com.terraservice_usa.GetPlaceFactsResponse, com.terraservice_usa.GetPlaceList, com.terraservice_usa.GetPlaceListInRect, com.terraservice_usa.GetPlaceListInRectResponse, com.terraservice_usa.GetPlaceListResponse, com.terraservice_usa.GetTheme, com.terraservice_usa.GetThemeResponse, com.terraservice_usa.GetTile, com.terraservice_usa.GetTileMetaFromLonLatPt, com.terraservice_usa.GetTileMetaFromLonLatPtResponse, com.terraservice_usa.GetTileMetaFromTileId, com.terraservice_usa.GetTileMetaFromTileIdResponse, com.terraservice_usa.GetTileResponse, com.terraservice_usa.LonLatPt, com.terraservice_usa.LonLatPtOffset, com.terraservice_usa.ObjectFactory, com.terraservice_usa.OverlappingThemeInfo, com.terraservice_usa.Place, com.terraservice_usa.PlaceFacts, com.terraservice_usa.PlaceType, com.terraservice_usa.ProjectionType, com.terraservice_usa.Scale, com.terraservice_usa.ThemeBoundingBox, com.terraservice_usa.ThemeInfo, com.terraservice_usa.TileId, com.terraservice_usa.TileMeta, com.terraservice_usa.UtmPt
Longitude: 8.543999671936035
Latitude: 47.3849983215332

--
Jason Brazile

Steve Tekell

未读,
2008年2月26日 16:48:212008/2/26
收件人 us...@groovy.codehaus.org

I still can't get GroovyWS to work. (I am still trying the TerraService
example.)
I tried jdk6 (jdk1.6.0_03) and the newer TerraService2.
The error messages are slightly different using jdk6, but it's basically the
same.
I did realize that the first time I run the script in GroovyConsole, I get a
linkage LinkageError, then subsequent runs give a NoClassDefFoundError.

Anybody have any clues?
Anybody got GroovyWS to run successfully with jdk1.5.0_10 and or jdk1.6.0_03
on Linux with Groovy 1.5.4?
I mucked around with the env to make sure Java in the path was the same as
JAVA_HOME, but that didn't help.

I just tried it on WinXP with Groovy 1.5.4 and Java jdk1.6.0_04. It fail,
but with a different error. It gets past the def proxy, but throws an NPE
because place is null.

How do I get GroovyWS to work?

---------------------------------
Here's snippts of the errors from running the example TerraServer script.

jdk1.5.0_10 : Linux
(first run)
Exception thrown: java.lang.LinkageError: loader constraints violated when
linking javax/xml/namespace/QName class

java.lang.LinkageError: loader constraints violated when linking
javax/xml/namespace/QName class
at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:186)
...


at groovyx.net.ws.WSClient.<init>(WSClient.java:126)

at Script0.run(Script0:2)

(all runs after first)
Exception thrown: java.lang.NoClassDefFoundError

java.lang.NoClassDefFoundError
at
com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:25)

...


at groovyx.net.ws.WSClient.<init>(WSClient.java:126)

at Script1.run(Script1:2)


jdk1.6.0_03 : Linux
(first run)
Exception thrown: java.lang.LinkageError: loader constraint violation: when
resolving field "DATETIME" the class loader (instance of
org/codehaus/groovy/tools/RootLoader) of the referring class,
javax/xml/datatype/DatatypeConstants, and the class loader (instance of
<bootloader>) for the field's resolved type, javax/xml/namespace/QName, have
different Class objects for that type

java.lang.LinkageError: loader constraint violation: when resolving field
"DATETIME" the class loader (instance of
org/codehaus/groovy/tools/RootLoader) of the referring class,
javax/xml/datatype/DatatypeConstants, and the class loader (instance of
<bootloader>) for the field's resolved type, javax/xml/namespace/QName, have
different Class objects for that type
at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:186)
...


at groovyx.net.ws.WSClient.<init>(WSClient.java:126)

at Script1.run(Script1:2)

(all runs after first)
Exception thrown: java.lang.NoClassDefFoundError: Could not initialize class
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl

java.lang.NoClassDefFoundError: Could not initialize class
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl


at
com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(RuntimeTypeInfoSetImpl.java:25)

...


at groovyx.net.ws.WSClient.<init>(WSClient.java:126)

at Script3.run(Script3:2)


jdk1.6.0_04 : WinXP
Exception thrown: java.lang.NullPointerException

java.lang.NullPointerException
at Script0.run(Script0:8)

--
View this message in context: http://www.nabble.com/GroovyWS-client-problem---fails-w--NoClassDefFoundError-tp15620449p15700859.html

Jason Brazile

未读,
2008年2月27日 09:02:582008/2/27
收件人 us...@groovy.codehaus.org
On Tue, Feb 26, 2008 at 10:48 PM, Steve Tekell <tek...@usgs.gov> wrote:

I still can't get GroovyWS to work.  (I am still trying the TerraService
example.)

How I got it to work is: downloaded groovy as a zip, unzipped it, downloaded the groovyWS jar (http://docs.codehaus.org/download/attachments/9242181/groovyws-standalone-0.2.0.jar?version=1)
and put it in the groovy-1.5.4/lib directory. It works for me under linux and XP.
I just tried the terra2 example i posted above and it still works.

No ideas about the errors you are seeing.  Could it be that your jar got corrupted during download? Sorry no other ideas.

Steve Tekell

未读,
2008年2月27日 10:56:152008/2/27
收件人 us...@groovy.codehaus.org

Jason Brazile-3 wrote:
>
> Could it be that your jar got corrupted during download? Sorry no other
> ideas.
>

I don't think so. I've downloaded again, making multiple different
downloads on two different OSs.
Maybe the first java.lang.LinkageError is more telling. Running the script
from the cmd line instead of GroovyConsole, it never becomes a
java.lang.NoClassDefFoundError, like it does after the first run in
GroovyConsole. While that might point to bug in the GroovyConsole, I'd be
happy to have it run anywhere.

Here's what it the Terra2 script looks like from the cmd line (instead of
the GroovyConsole).

Feb 27, 2008 8:54:45 AM org.apache.cxf.endpoint.dynamic.DynamicClientFactory


addSchemas
INFO: Loading the JAXB 2.1 simple binding for client.

Caught: java.lang.LinkageError: loader constraints violated when linking
javax/xml/namespace/QName class
at wstest.run(wstest.groovy:3)
at wstest.main(wstest.groovy)

Anyone else seen something like this? I can't see how I could be the only
one, unless there's just two of us using GroovyWS.

BTW, Why do we have to pass in a classLoader to create a WSClient?
GroovySoap didn't require it. Is there anything else I could try there?

thx,
Steve

--
View this message in context: http://www.nabble.com/GroovyWS-client-problem---fails-w--NoClassDefFoundError-tp15620449p15716200.html

Paul S

未读,
2008年2月27日 18:47:402008/2/27
收件人 us...@groovy.codehaus.org

Steve Tekell wrote:
>
> Anyone else seen something like this? I can't see how I could be the only
> one, unless there's just two of us using GroovyWS.
>

I tried running something simple:
import groovyx.net.ws.WSClient
proxy = new WSClient('http://www.webservicex.net/stockquote.asmx?WSDL',
this.class.classLoader)
quote = proxy.GetQuote('GOOG')
println quote

And I get the following running from the command line (XP) with Groovy
Version: 1.5.4 JVM: 1.5.0_14-b03:
Caught: java.lang.NoSuchMethodError:
org.w3c.dom.Node.getTextContent()Ljava/lang/String;
at stock.run(stock.groovy:2)

I thought there might be something in the classpath causing this, so I
opened a new command line, cleared the classpath and I get the same error:


Caught: java.lang.LinkageError: loader constraints violated when linking
javax/xml/namespace/QName class

at stock.run(stock.groovy:2)

-Paul
--
View this message in context: http://www.nabble.com/GroovyWS-client-problem---fails-w--NoClassDefFoundError-tp15620449p15726099.html

Paul S

未读,
2008年2月27日 19:25:012008/2/27
收件人 us...@groovy.codehaus.org

Steve Tekell wrote:
>
> Caught: java.lang.LinkageError: loader constraints violated when linking
> javax/xml/namespace/QName class
> at wstest.run(wstest.groovy:3)
> at wstest.main(wstest.groovy)
>

Steve,

I was able to resolve my similar problem by deleting
groovysoap-all-1.0-0.3-snapshot_jdk1.5.0.jar from groovy\lib.

-Paul
--
View this message in context: http://www.nabble.com/GroovyWS-client-problem---fails-w--NoClassDefFoundError-tp15620449p15726846.html

tog

未读,
2008年2月27日 23:11:052008/2/27
收件人 us...@groovy.codehaus.org
There might be some issues in running directly from the groovy console
(classpath issue) could you try using a groovy script and report if
you have any problem this way.

Cheers
Guillaume

--
Best Regards
Guillaume
PGP KeyID:C1A0A73F FingerPrint:A4A2 73C0 E7D4 6437 8185 D05E ECF2
AD84 C1A0 A73F
http://cheztog.blogspot.com

Steve Tekell

未读,
2008年2月28日 10:48:092008/2/28
收件人 us...@groovy.codehaus.org

That's was it!
I had groovysoap-all-jsr06-0.1.jar in the classpath (~/.groovy/lib).

Thank you so much!

This makes me wonder if Groovy should have some sort of package manager.


Paul S wrote:
>
>
> Steve Tekell wrote:
>>
>> Caught: java.lang.LinkageError: loader constraints violated when linking
>> javax/xml/namespace/QName class
>> at wstest.run(wstest.groovy:3)
>> at wstest.main(wstest.groovy)
>>
>
> Steve,
>
> I was able to resolve my similar problem by deleting
> groovysoap-all-1.0-0.3-snapshot_jdk1.5.0.jar from groovy\lib.
>
> -Paul
>

--
View this message in context: http://www.nabble.com/GroovyWS-client-problem---fails-w--NoClassDefFoundError-tp15620449p15739331.html

Danno Ferrin

未读,
2008年2月28日 10:50:352008/2/28
收件人 us...@groovy.codehaus.org
On 2/28/08, Steve Tekell <tek...@usgs.gov> wrote:

That's was it!
I had groovysoap-all-jsr06-0.1.jar in the classpath (~/.groovy/lib).

Thank you so much!

This makes me wonder if Groovy should have some sort of package manager.

Paul S wrote:
>
>
> Steve Tekell wrote:
>>
>> Caught: java.lang.LinkageError: loader constraints violated when linking
>> javax/xml/namespace/QName class
>>         at wstest.run(wstest.groovy:3)
>>         at wstest.main(wstest.groovy)
>>
>
> Steve,
>
> I was able to resolve my similar problem by deleting
> groovysoap-all-1.0-0.3-snapshot_jdk1.5.0.jar from groovy\lib.
>
> -Paul
>

--

View this message in context: http://www.nabble.com/GroovyWS-client-problem---fails-w--NoClassDefFoundError-tp15620449p15739331.html

Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
------------------------------------------------------
I'm Danno Ferrin, and I approved this message.
回复全部
回复作者
转发
0 个新帖子