工具Myeclipse tomcat 模拟调用WebService客服端 报错如下
Exception in thread "main" java.lang.NoSuchMethodError: javax.jws.WebService.portName()Ljava/lang/String;
at org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations.getWebServiceAnnotation(Jsr181WebAnnotations.java:55)
at org.codehaus.xfire.annotations.AnnotationsValidatorImpl.validateClass(AnnotationsValidatorImpl.java:15)
at org.codehaus.xfire.annotations.AnnotationsValidatorImpl.validate(AnnotationsValidatorImpl.java:90)
at org.codehaus.xfire.annotations.AnnotationServiceFactory.create(AnnotationServiceFactory.java:190)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.create(ObjectServiceFactory.java:374)
at test.test.MateriaContractServiceClient.create0(MateriaContractServiceClient.java:59)
at test.test.MateriaContractServiceClient.<init>(MateriaContractServiceClient.java:26)
at test.Test.main(Test.java:34)
Exception in thread "main" java.lang.NoSuchMethodError: javax.jws.WebService.portName()Ljava/lang/String;
at org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations.getWebServiceAnnotation(Jsr181WebAnnotations.java:55)
at org.codehaus.xfire.annotations.AnnotationsValidatorImpl.validateClass(AnnotationsValidatorImpl.java:15)
at org.codehaus.xfire.annotations.AnnotationsValidatorImpl.validate(AnnotationsValidatorImpl.java:90)
at org.codehaus.xfire.annotations.AnnotationServiceFactory.create(AnnotationServiceFactory.java:190)
at org.codehaus.xfire.service.binding.ObjectServiceFactory.create(ObjectServiceFactory.java:374)
at test.test.MateriaContractServiceClient.create0(MateriaContractServiceClient.java:59)
at test.test.MateriaContractServiceClient.<init>(MateriaContractServiceClient.java:26)
at test.Test.main(Test.java:34)
这个错误一般是因为你的jar有多个版本造成的。删除那些重复的,保留那个编译能通过的jar版本