在tomcat下运行jax-ws 异常

注意事项:
1.出现异常

Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 10 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://tempuri.org/}getprice_Five". Use @XmlType.name and @XmlType.namespace to assign different names to them.
这个就有点杯具,避免这种事情最好是在你implement类中加上‍targetNamespace,自己一个个找,手动改起来很麻烦。
2.客户端调用方法时,总是返回null,集合的话所有元素都是空。但服务器端确是有值的,这个较郁闷。出现这个问题时搞了我好久。
解决方法:最好在implement类中用数组,不要用List.相关的其它问题可以参考‍http://gavin-chen.iteye.com/blog/347704,这位仁兄已经整理出来了。
3.客户端在调用服务时出现
java.lang.IllegalStateException: Could not initialize Service
at org.codehaus.xfire.jaxws.ServiceDelegate.<init>(ServiceDelegate.java
:77)
    at org.codehaus.xfire.jaxws.Provider.createServiceDelegate(Provider.java
:32)
    at javax.xml.ws.Service.<init>(Service.java:57)
    at com.z.ns.dur.ws.internal.MetadataService.<init>(MetadataService.java
:41)
.........
Caused by: java.lang.NoSuchMethodException:com.xx.xxService.getPortClassMap()
当时我单独调用时没发现这个问题,但将client的jar包放入web项目中就报上面的错误,奇怪的是我就没用过xfire,怎么会报xfire的错。google了一下,而来项目是有xfire-jaxws-1.2.6.jar这个包的存在,干掉后就可以了。

你可能感兴趣的:(java,tomcat,xml,Security,Google)