Question

I am developing a webapp using GWT. When I try to run it under eclipse ("Run as web application"), I get a java.lang.ClassNotFoundException pointing to my RPC async class.

I am experienced with development in Java but not with GWT. I did research this issue but the advice I found did not work for me, or I did not know how to apply it to my own webapp. I am hoping someone will be able to provide some insight.

The error

java.lang.ClassNotFoundException:gov.nist.toolkit.xdstools3.server.InterfaceClientServerImpl
--- stack trace of some more Jetty and GWT stuff that fails because of the error above ---

javax.servlet.UnavailableException: gov.nist.toolkit.xdstools3.server.InterfaceClientServerImpl
--- same thing ---

My implementation

I implemented the RPC logic:

client > InterfaceClientServer
       > InterfaceClientServerAsync
server > InterfaceClientServerImpl

and modified the web.xml to point to my service class.

InterfaceClientServer.java

package gov.nist.toolkit.xdstools3.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("service")
public interface InterfaceClientServer extends RemoteService {
    public void logMeIn(String username, String password);
}

InterfaceClientServerAsync.java

package gov.nist.toolkit.xdstools3.client;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

public interface InterfaceClientServerAsync {

    public void logMeIn(String username, String password, AsyncCallback<Void> callback);
}

InterfaceClientServerImpl.java

package gov.nist.toolkit.xdstools3.server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import gov.nist.toolkit.xdstools3.client.InterfaceClientServer;

public class InterfaceClientServerImpl extends RemoteServiceServlet implements InterfaceClientServer {
    private static final long serialVersionUID = 1L;

    public void logMeIn(String username, String password){
        Caller.getInstance().logMeIn(username, password);
    }
}

web.xml

    <web-app>
    <display-name>Document Sharing Toolkit</display-name>

    <!-- Default page to serve -->
    <welcome-file-list>
        <welcome-file>Xdstools3.html</welcome-file>
    </welcome-file-list>

    <!-- Example servlet loaded into servlet container -->
    <servlet>
        <servlet-name>InterfaceClientServer</servlet-name>
        <servlet-class>gov.nist.toolkit.xdstools3.server.InterfaceClientServerImpl</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>InterfaceClientServer</servlet-name>
        <url-pattern>/xdstools3/service</url-pattern>
    </servlet-mapping>

</web-app>

Main tutorial I used

http://www.gwtproject.org/doc/latest/tutorial/RPC.html

Similar issues

I also found a few similar issues on Stackoverflow, such as this one: GWT question on RPC. This post would suggest that something is wrong with my web.xml and the linking to the async class, but I could not figure out what.

Other technologies used and versions

In case it ends up being relevant: GWT 2.5.1, Maven (m2e), Smartgwt.

Any help will be very welcome.

Was it helpful?

Solution

Server side classes may not be compiled.

Please ensure server side classes are present under target. Check your project's class-path also.


Please confirm from below screenshots:

  • WAR directory src/main/webapp
  • Launch and deploy from this directory is unchecked
  • Default output folder project/target/classes

enter image description here

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top