Search code examples
javagwtrpcgxt

GWT returning custom objects that implement interfaces from external jars


I'm trying to implement an application that would read some path from the server and show it as a tree in web. For the client side I'm using Sencha GXT Tree that uses a TreeStore.

I saw this question that is very close to what I'm having as code: GWT Simple RPC use case problem : Code included The difference on my side would be that my TestObject class is implementing also TreeStore.TreeNode along with Serializable. This TreeStore.TreeNode is located in the gxt-3.0.1.jar that I added both to buildpath and to classpath.

import java.util.List;
import java.io.Serializable;
import com.sencha.gxt.data.shared.TreeStore;
import com.sencha.gxt.data.shared.TreeStore.TreeNode;

@SuppressWarnings("serial")
public class TestObject implements TreeStore.TreeNode<TestCase>, Serializable {
  public TestObject() {
    
  }
[...]

I'm trying to return from server side a TreeStore object containing the data about the content of the directories at the given path. But the execution of the async call fails with java.lang.NoClassDefFoundError: com/sencha/gxt/data/shared/TreeStore$TreeNode

What should I do to have the server side to see this object that is actually more client side specific, given it comes from the gxt jar?


Solution

  • Make sure the gxt jar is on the server classpath - it should be located in WEB-INF/lib/ for the server to find it. Simply having it on the project classpath isn't enough to make sure that the war application can find it.