3

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\

4 Answers 4

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

shame on me. i should start learning java from the very beginning.
2

It looks like the generated class has a package mywebservice, not bin.mywebservice. Make sure the bin directory is on the classpath, and drop bin from the packages.

Comments

0

If you sure that your file located in bin directory, you have check the class file that for call mywebservice.myClass_Service

same at the bin directory. because when both file not the same location, it will be error. or you can check your package location on the top of code.

package bin;

look and compare the two.

Comments

-1

This makefile may help if you are using packages:

CLASS_PATH = ../bin

vpath %.class $(CLASS_PATH)

all : HelloJNI.h

HelloJNI.h : com/my/package/HelloJNI.class
    javah -classpath $(CLASS_PATH) com.my.package.$*

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.