I'm trying to make a console application to test my webservice.
I successfully deployed a webservice at http://localhost:8080/WS/myWS
and i made proxy classes with wsimport:
wsimport -d bin -s src http://localhost:8080/WS/myWS?wsdl
Now my webservice classes are located in bin/mywebservice/ and i'm trying to compile my client class with classpath = ./
Here's the source code of my class:
import bin.mywebservice.myClass_Service;
public class TesterApp{
public static void main (String args[])
{
myClass_Service service = new myClass_Service();
}
}
And i have error:
TesterApp.java:1: error: cannot access myClass_Service
import bin.mywebservice_Service.myClass;
^
bad class file: .\bin\mywebservice\myClass_Service.class
class file contains wrong class: mywebservice.myClass_Service
Please remove or make sure it appears in the correct subdirectory of the classpath.
please help, what's wrong with myClass_Service?
i swear, myClass_Service.class exists in .\bin\mywebservice\
解决方案
You're incorrectly including the bin in the import declaration.
Rather put bin on the classpath and correct the import.
Unless (the poorly-named) myClass_Service.java file is package bin.mywebservice (which it isn't, according the the error message), you're trying to correct the problem in the wrong place.
博主尝试创建控制台应用测试Web服务,部署服务并生成代理类后,编译客户端类时出现错误,提示类文件包含错误类。解决方案指出,是导入声明中错误包含了bin,应将bin放在类路径并修正导入。
8999

被折叠的 条评论
为什么被折叠?



