【发布时间】:2015-04-11 09:27:14
【问题描述】:
我正在开发一个带有单独模块的项目。 admins 的 backend,users 的 client 和 core 之间的共享 DAO 层 后端和客户端。
backend 模块使用 GWT,client 使用 Spring MVC。在 backend 模块中,core 模块被 deployment assembly 包含。我的服务器端,DAO 是由 Spring 注入的。
core 模块中创建的所有 bean(POJO)。我的问题是我想在我的 gwt 项目(backend 模块)中或在使用 RPC 调用时使用来自 core 模块的这些 bean。
我尝试作为How can share bean from external library to GWT client? 问题的答案,但还不满意。我得到以下错误
没有可用于类型的源代码 com.mycom.core.business.bean.TestBean; [错误] 提示:检查 来自您的模块的继承链;它可能没有继承 所需模块或模块可能未添加其源路径条目 正确的
这是我努力的代码...
TestBean.java
public class TestBean {
private int id;
public final int getId() {
return id;
}
public final void setId(int id) {
this.id = id;
}
}
beans.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module>
<inherits name='com.google.gwt.user.User'/>
<source path="com.mycom.core.business.bean.TestBean"/>
</module>
在我的 App.gwt.xml 中将 beans.gwt.xml 继承为 <inherits name='com.mycom.backend.beans'/> 。我错过了什么?
编辑:添加示例项目文件
现在我创建并上传了示例模块。您可以从 google-drive URL 下载它。这个存档文件包含 backend 和 core 模块。
core 模块从 Eclipse IDE 创建为简单的 java 项目。
backend 模块由 gwt-ecliplse 插件创建(2.7 gwt 版本并包含生成的代码)并添加 Dynamic Web Module 2.5 项目面。
最后,我使用 GWT-Eclipse 插件 构建和运行,您可以检查屏幕截图
类路径
源查找路径
模块
以下是我控制台中的错误日志
Super Dev Mode starting up
workDir: /var/folders/mt/5287l4j94jd9rfqwqdqxr9zw0000gq/T/gwt-codeserver-7296341534601698800.tmp
Loading Java files in com.mycom.backend.App.
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Finding entry point classes
Tracing compile failure path for type 'com.mycom.backend.client.Backend'
[ERROR] Errors in 'file:/Applications/springsource/workspace/backend/src/com/mycom/backend/client/Backend.java'
[ERROR] Line 41: No source code is available for type com.mycom.core.business.bean.TestBean; did you forget to inherit a required module?
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[WARN] Server class 'com.google.gwt.dev.shell.jetty.JDBCUnloader' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/Users/cataclysm/Desktop/eclipse%20(Luna)/Datas/gwt-2.7.0/gwt-dev.jar' to the web app classpath for this session
For additional info see: file:/Users/cataclysm/Desktop/eclipse%20(Luna)/Datas/gwt-2.7.0/doc/helpInfo/webAppClassPath.html
【问题讨论】:
标签: java gwt javabeans gwt-rpc