简体   繁体   English

为什么在tomcat重新启动时调用不同的函数?

[英]Why are different function being called when tomcat restarts?

We have below overridden functions in java 我们在Java中有以下覆盖的函数

MailboxUtils.GetMailboxWithUIMap = function(p0, p1, p2, callback) {
    DWREngine._execute(MailboxUtils._path, 'MailboxUtils', 'GetMailboxWithUIMap', p0, p1, p2, callback);
} 

MailboxUtils.GetMailboxWithUIMap = function(p0, p1, callback) {
    DWREngine._execute(MailboxUtils._path, 'MailboxUtils', 'GetMailboxWithUIMap', p0, p1, callback);
} 

For some strange reason when tomcat server is started and the program executes, it calls the function with 4 arguments ie function(p0, p1, p2, callback) even though we have passed in only 3 arguments. 由于某些奇怪的原因,当启动tomcat服务器并执行程序时,即使我们仅传入了3个参数,它也会调用带有4个参数的函数,即function(p0, p1, p2, callback) Then if we restart tomcat server, the system starts behaving normally and starts calling the right function ie function(p0, p1, callback) . 然后,如果我们重新启动tomcat服务器,系统将开始正常运行并开始调用正确的函数,即function(p0, p1, callback) This seems to be very random and the only way to fix it is to restart Tomcat many times until the problem gets resolved. 这似乎是非常随机的,解决此问题的唯一方法是多次重新启动Tomcat,直到问题解决。

Has anyone seen this kind of problem before? 以前有没有人见过这种问题? ANy way we can fix this? 我们可以解决这个问题吗?

It turns out that DWR/Javascript does not support function overload 事实证明DWR / Javascript不支持函数重载

the code itself is written in java which supports function overloads but this code was then being ajaxified using DWR which does not support the overload. 该代码本身是用支持功能重载的Java编写的,但是随后使用不支持重载的DWR将其代码进行了修饰。 So every time the server was restarted , depending on which of the 2 functions was getting loaded last was getting executed. 因此,每次服务器重新启动时,取决于最后加载的两个函数中的哪个函数正在执行。

Had to rename one of the functions so as to stop overload 必须重命名功能之一,以防止过载

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

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