简体   繁体   English

GWT返回实现来自外部jar的接口的自定义对象

[英]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. 我正在尝试实现一个应用程序,该应用程序将从服务器读取一些路径并将其显示为Web中的树。 For the client side I'm using Sencha GXT Tree that uses a TreeStore. 对于客户端,我正在使用使用TreeStore的Sencha GXT Tree。

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. 我看到的这个问题与我的代码非常接近: GWT简单RPC用例问题:包括代码我这一点的不同之处在于,我的TestObject类还实现了TreeStore.TreeNode和Serializable。 This TreeStore.TreeNode is located in the gxt-3.0.1.jar that I added both to buildpath and to classpath. 此TreeStore.TreeNode位于gxt-3.0.1.jar中,我将其添加到buildpath和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. 我试图从服务器端返回一个TreeStore对象,其中包含有关给定路径中目录内容的数据。 But the execution of the async call fails with java.lang.NoClassDefFoundError: com/sencha/gxt/data/shared/TreeStore$TreeNode 但是异步调用的执行失败,并出现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? 给定它来自gxt jar,我应该怎么做才能让服务器端看到这个实际上更特定于客户端的对象?

Make sure the gxt jar is on the server classpath - it should be located in WEB-INF/lib/ for the server to find it. 确保gxt jar位于服务器类路径上-它应该位于WEB-INF/lib/ ,以便服务器找到它。 Simply having it on the project classpath isn't enough to make sure that the war application can find it. 仅将其放在项目类路径上不足以确保war应用程序可以找到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM