users@jax-rpc.java.net

NoSuchMethodError

From: Julian Gantner <kontakt_at_itloesungen.com>
Date: Tue, 18 Mar 2003 00:57:26 +0100

Hello list,

i am somewhat familiar with webservices, but i have the following
problem. I am user the actual jwsdp from SUN, which uses tomcat:

i have a package A and a package B. in package A i define my jax-rpc
webservice consisting of TestIF (the interface definition, see below)
and my TestImpl (the implementation). In Package B i have my class
B.User with the two private variables "username" (String) and "roles".
The latter is a java.util.Vector(). The class B.User has the required
getter and setter methods.

TestIF:
------------
package A;
import B.User;

public interface TestIF extends Remote {
  public String printUser(User user) throws RemoteException;
}


TestImpl:
-----------
package A;
import B.User;

public class TestImpl implements TestIF {
  public String printUser(User user) throws RemoteException {
    return user.getUsername();
  }
}

When I now deploy my webservice using the deploytool (wsdeploy) and
restart the server, i can access the WSDL and the webservice site. now I
compile the client (stubs). The config.xml-file hat as packageName="A".
Then I jar the generated classes in a jarfile. When I then implement a
client (see below) and try to run it, i get the NoSuchMethodError. My
suspicion is, that it is not allowed to use self made classes out of
diffrent packages as the interface declaration is.

package A;

import B.User; // (but that package does not exist in the packed jarfile
containing the stubs?!

public class Client {
  public static void main(String ars[]) {
    try {
        Stub stub = (Stub)createProxy();
        TestIF inst = (TestIF)stub;
        inst.printUser(new User("username")); // here the compiles
says "NoSuchMethodError", although the method exists in the packed
jarfile
    } catch (Exception e) {
        e.printstacktrace();
    }
  }

    private static Stub createProxy() {
      return (Stud)(new Test_Impl().getTestIFPort());
    }
}


I would be very happy, if someone can give me a hint how to solve this
problem.

Many many thanks in advance.

    Julian Gantner, Karlsruhe