开发者

Tomcat cannot find class "InaccessibleWSDLException", glassfish can

I am working with webservices in Java, and right after opening the port and calling the service, I try to catch a "com.sun.xml.ws.wsdl.parser.InaccessibleWSDLException".

This worked fine on my dev Glassfish v2 server, but when I shifted my WAR file to Tomcat, I got a NoClassDefFoundError:

java.lang.NoClassDefFoundError: com/sun/xml/ws/wsdl/parser/InaccessibleWSDLEx开发者_开发问答ception

I did some Googled it and found out that the JAR jaxws-rt.jar had the InaccessibleWSDLException class. But including this JAR in my WAR only broke more things.

I would appreciate any help in eliminating this error.

Thanks.

Additional Info:

After adding jaxws-rt.jar, I get this on all services, irrespective of whether I catch InaccessibleWSDLException or not:

java.lang.ClassNotFoundException: com.sun.xml.stream.buffer.XMLStreamBuffer


The problem is probably that you're importing a class starting with com.sun.. This is generally bad: Why Developers Should Not Write Programs That Call 'sun' Packages

This class is not documented as part of the JAX-WS specification, so I expect this class is part of the JAX-WS implementation in Glassfish; it is unlikely to be present in any other implementation and you should not reference it if you want your code to be portable. I suggest you catch WebServiceException instead (which I believe is the parent type).


You need to add all WSDL dependencies, I'm not sure what they are but stream buffer looks like it is, jars can be found here:

http://download.java.net/maven/1/com.sun.xml.stream.buffer/jars/

It works in glassfish because it has all those jars installed by default while Tomcat does not.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜