javascript 什么可能导致部署的 GWT 应用程序上出现 UmbrellaException 匿名函数?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4136936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What could cause an UmbrellaException anonymous function on deployed GWT app?
提问by Omar Estrella
I seem to be running into an odd problem. When using my GWT application in a local environment, everything works as it should. The problem comes in after I compile and deploy my application. When I go through my project workflow and click on a certain link to switch into a new panel, I get the following error (from my console in Chrome):
我似乎遇到了一个奇怪的问题。在本地环境中使用我的 GWT 应用程序时,一切正常。问题出现在我编译和部署我的应用程序之后。当我完成我的项目工作流程并单击某个链接以切换到新面板时,我收到以下错误(来自 Chrome 中的控制台):
Uncaught com.google.gwt.event.shared.UmbrellaException: One or more exceptions
caught, see full set in UmbrellaException#getCauses (anonymous function)
This error is thrown by one of the cache file generated by GWT at compile time. But this never happens on the locally deployed program (deployed from Eclipse, "Run as Web Application"). Has anyone ever run into this issue or can provide any direction for a fix?
此错误是由 GWT 在编译时生成的缓存文件之一引发的。但这永远不会发生在本地部署的程序(从 Eclipse 部署,“作为 Web 应用程序运行”)上。有没有人遇到过这个问题或可以提供任何修复方向?
Thank you! :)
谢谢!:)
采纳答案by Domchi
I had the same problem just now. Works locally, fails with the mentioned Javascript console error, nothing in server logs.
我刚才遇到了同样的问题。在本地工作,由于提到的 Javascript 控制台错误而失败,服务器日志中没有任何内容。
Turns out that client Java code (which is complied to Javascript) had try/catch block which worked when executed in Java, but failed silently when compiled to Javascript. I'm still not sure what was the exact nature of the problem, but try removing try/catch blocks.
事实证明,客户端 Java 代码(已编译为 Javascript)具有 try/catch 块,该块在 Java 中执行时有效,但在编译为 Javascript 时无提示地失败。我仍然不确定问题的确切性质是什么,但尝试删除 try/catch 块。
(It seems that in my case, table.getWidget()call was failing and throwing exception.)
(似乎在我的情况下,table.getWidget()调用失败并抛出异常。)
回答by nicos
I had the same problem, i think interpretation of try catch is not the same than in Java... after gwt compilation, when you are in catch case, the execution failed. If you open firebug, you can see point of errors into JS.
我遇到了同样的问题,我认为 try catch 的解释与 Java 中的不同......在 gwt 编译后,当您处于 catch 情况下时,执行失败。如果你打开 firebug,你可以看到 JS 的错误点。
回答by Angel Delgado
I had the same problem, it worked in development mode. Then, after I compiled I would get an error. To fix, I had to get rid of:
我有同样的问题,它在开发模式下工作。然后,在我编译之后,我会得到一个错误。要修复,我必须摆脱:
try{
//some code
} catch(NullPointerException ex){
//more code
}
Instead I did:
相反,我做了:
if(variable != null){
//some code
} else {
//more code
}
After that it worked perfectly.
之后它完美地工作。

