GWT-RPC 无法访问 servlet
我将 gwt 模块集成到现有的 Web 应用程序中并部署在 jboss 上。
当我尝试点击 gwt_servlet 时,我收到有关 asynccallback 失败方法的错误消息,即 请求的资源 (/warFileName/GWTAPPS/myGwtModuleName/GWTServletName) 不可用。
我的战争包含如下
GWTAPPS :
myGwtModuleName(folder) : (folder contains -->)advanced,css,gwt,images 文件夹和一些 *.cache.png文件 myGwtModule.html、myGwtModule.css
WEB-INF -> 部署 - myGwtModuleName
我将编译的 gwt_servlet 文件复制到 /warFileName/GWTAPPS/myGwtModuleName/ 中,仍然出现相同的错误,即资源不可用。
是否有必要将 WEB-INF/classes(复制的 *.class 文件)文件夹创建到 myGwtModuleName 中? 像 warfilename\GWTAPPS\mygwtmodule\WEB-INF\classes
在部署中有时也会出现异常
java.lang.NoClassDefFoundError: com/google/gwt/user/client/rpc/RemoteService
**gwt_servlet 条目在 web.xml 中制作 # **
这个 web.xml 不存在于 gwtmodule 中是这个问题吗?
< servlet> < servlet 名称>GWTServletName< /servlet 名称> < servlet-class>ui.mygwtmodule.server.BasicUpdateServiceImpl < /servlet 类> < /servlet> < servlet 映射 >
<前><代码>< servlet 名称>GWTServletName< /servlet 名称> < url-pattern>/GWTServletName< /url-pattern> < /servlet 映射>
还使用了 url 模式,如 myGwtModuleName/GWTServletName
BasicUpdateService 中添加的 RemoteServiceRelativePath
@RemoteServiceRelativePath("GWTServletName")
公共接口BasicUpdateService扩展了RemoteService
创建了一个远程服务代理来与服务器端 GWTMassUpdate 服务通信。
私有最终BasicUpdateServiceAsync basicUpdateService = GWT .create(BasicUpdateService.class);
服务器调用
basicMassUpdateService.makeServreCall("vaibhav", new AsyncCallback() {
@Override
public void onSuccess(String result) {
Window.alert("Result = "+result);
}
@Override
public void onFailure(Throwable caught) {
Window.alert("On Failure :"+caught);
// No resource available :-|
}
});
任何有关此事的帮助或指导将不胜感激
I integrated my gwt module in to existing web application and deployed on jboss.
when I trying to hit gwt_servlet then I am getting error message on failure method of asynccallback i.e.
The requested resource (/warFileName/GWTAPPS/myGwtModuleName/GWTServletName) is not available.
My war contain is as follows
GWTAPPS :
myGwtModuleName(folder) : (folder contains -->)advanced,css,gwt,images folder and some *.cache.png files myGwtModule.html, myGwtModule.css
WEB-INF -> deploy - myGwtModuleName
I copied compiled gwt_servlet file into /warFileName/GWTAPPS/myGwtModuleName/ still getting same error i.e resource not available.
Is it necessary to crate WEB-INF/classes(copied *.class file) folder into myGwtModuleName ?.
like warfilename\GWTAPPS\mygwtmodule\WEB-INF\classes
Also getting sometime exception in deployment
java.lang.NoClassDefFoundError: com/google/gwt/user/client/rpc/RemoteService
**gwt_servlet entry made in web.xml # **
This web.xml not present in gwtmodule is this problem ?
< servlet>
< servlet-name>GWTServletName< /servlet-name>
< servlet-class>ui.mygwtmodule.server.BasicUpdateServiceImpl < /servlet-class>
< /servlet> < servlet-mapping >< servlet-name>GWTServletName< /servlet-name> < url-pattern>/GWTServletName< /url-pattern> < /servlet-mapping>
also used url pattern like myGwtModuleName/GWTServletName
RemoteServiceRelativePath added in BasicUpdateService
@RemoteServiceRelativePath("GWTServletName")
public interface BasicUpdateService extends RemoteService
Created a remote service proxy to talk to the server-side GWTMassUpdate service.
private final BasicUpdateServiceAsync basicUpdateService =
GWT .create(BasicUpdateService.class);
Server call
basicMassUpdateService.makeServreCall("vaibhav", new AsyncCallback() {
@Override
public void onSuccess(String result) {
Window.alert("Result = "+result);
}
@Override
public void onFailure(Throwable caught) {
Window.alert("On Failure :"+caught);
// No resource available :-|
}
});
Any help or guidance in this matter would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“是否需要将 WEB-INF/classes(复制的 *.class 文件)文件夹创建到 myGwtModuleName 中?”
是的。
为什么您不使用 Maven 或 ant 来部署和构建项目?手动完成会浪费很多时间,而且更容易出错,就像这些错误一样。
我建议您投资使用maven或ant将gwt应用程序打包在您的war中,并专注于开发gwt应用程序。
"Is it necessary to crate WEB-INF/classes(copied *.class file) folder into myGwtModuleName ?"
Yes.
Why arent you using maven or ant for the deployment and build steps of your projects? You loose much time by doing it by hand, and it is more error prone, like these errors.
Id suggest you invest in packaging the gwt application in your war using maven or ant, and focus on developing the gwt application.
除非您正在做一些令人讨厌的事情,否则部署应该像复制整个“war”文件夹一样简单。
注意:您可以安全地从进程中排除 WEB-INF/deploy,因为如果您使用 java.util.logging 设置“远程日志记录”,则仅需要堆栈跟踪反混淆> 客户端仿真)
Unless you're doing some nasty things, deployment should be as easy as copying the whole "war" folder around.
Note: you can safely exclude
WEB-INF/deploy
from the process, as it's only needed for stacktrace deobfuscation, if you setup "remote logging" with thejava.util.logging
client-side emulation)