Really odd Reference/Constructor errors

Pertinent installation details:
Java 1.6.0_11
Servoy 5.1.4 -build 964

The errors 'm about to describe ONLY happen when running SmartClient launched from a running app server and NOT from a client running from inside Eclipse (I thought those days were over?)

The common thread between all of these errors is they are originating from methods that get called as the result of clicks in HTML areas. To further complicate the matter, however, it’s not ALL html click handlers that fail in this fashion, just some of them.

First two can’t find “forms” or “globals”

ReferenceError: "forms" is not defined. (htmlHandlerScheduleList#1434)
org.mozilla.javascript.EcmaError: ReferenceError: "forms" is not defined. (htmlHandlerScheduleList#1434)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3655)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3649)
	at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3711)
	at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1754)
	at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1679)
	at org.mozilla.javascript.gen.c149._c0(htmlHandlerScheduleList:1434)
	at org.mozilla.javascript.gen.c149.call(htmlHandlerScheduleList)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
	at org.mozilla.javascript.gen.c103._c0(renderPage:2741)
	at org.mozilla.javascript.gen.c103.call(renderPage)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
	at org.mozilla.javascript.gen.c453._c0(createListFromQuery:781)
	at org.mozilla.javascript.gen.c453.call(createListFromQuery)
	at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:81)
	at org.mozilla.javascript.gen.c452._c0(findClientsSchedules:7865)
	at org.mozilla.javascript.gen.c452.call(findClientsSchedules)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
	at org.mozilla.javascript.gen.c169._c0(toSchedules:2139)
	at org.mozilla.javascript.gen.c169.call(toSchedules)
	at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:65)
	at org.mozilla.javascript.gen.c433._c0(navHandler:408)
	at org.mozilla.javascript.gen.c433.call(navHandler)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
	at org.mozilla.javascript.gen.c433.call(navHandler)
	at com.servoy.j2db.scripting.Ztb.executeFunction(Ztb.java:196)
	at com.servoy.j2db.Zwb.Za(Zwb.java:741)
	at com.servoy.j2db.Zwb.Za(Zwb.java:1223)
	at com.servoy.j2db.Zcc.Za(Zcc.java:1)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:27)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:18)
	at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:16)
	at com.servoy.j2db.dataui.Zh.mouseReleased(Zh.java:2)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
ReferenceError: "globals" is not defined. (htmlHandlerScheduleList#1400)
org.mozilla.javascript.EcmaError: ReferenceError: "globals" is not defined. (htmlHandlerScheduleList#1400)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3655)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3649)
	at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3711)
	at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1754)
	at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1679)
	at org.mozilla.javascript.gen.c149._c0(htmlHandlerScheduleList:1400)
	at org.mozilla.javascript.gen.c149.call(htmlHandlerScheduleList)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
	at org.mozilla.javascript.gen.c103._c0(renderPage:2741)
	at org.mozilla.javascript.gen.c103.call(renderPage)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
	at org.mozilla.javascript.gen.c453._c0(createListFromQuery:781)
	at org.mozilla.javascript.gen.c453.call(createListFromQuery)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
	at org.mozilla.javascript.gen.c481._c0(findCurrentProposals:8127)
	at org.mozilla.javascript.gen.c481.call(findCurrentProposals)
	at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:111)
	at org.mozilla.javascript.gen.c169._c0(toSchedules:2192)
	at org.mozilla.javascript.gen.c169.call(toSchedules)
	at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:65)
	at org.mozilla.javascript.gen.c433._c0(navHandler:408)
	at org.mozilla.javascript.gen.c433.call(navHandler)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
	at org.mozilla.javascript.gen.c433.call(navHandler)
	at com.servoy.j2db.scripting.Ztb.executeFunction(Ztb.java:196)
	at com.servoy.j2db.Zwb.Za(Zwb.java:741)
	at com.servoy.j2db.Zwb.Za(Zwb.java:1223)
	at com.servoy.j2db.Zcc.Za(Zcc.java:1)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:27)
	at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:18)
	at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:16)
	at com.servoy.j2db.dataui.Zh.mouseReleased(Zh.java:2)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

And here we can’t instantiate a new Object ( ie: var x = new Object())

ReferenceError: "Object" is not defined. (listClickAccount#1085)
org.mozilla.javascript.EcmaError: ReferenceError: "Object" is not defined. (listClickAccount#1085)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3655)
	at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3649)
	at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3711)
	at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1754)
	at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1679)
	at org.mozilla.javascript.gen.c140._c0(listClickAccount:1085)
	at org.mozilla.javascript.gen.c140.call(listClickAccount)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
	at org.mozilla.javascript.gen.c103._c0(renderPage:2741)
	at org.mozilla.javascript.gen.c103.call(renderPage)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
	at org.mozilla.javascript.gen.c448._c0(sendToList:2016)
	at org.mozilla.javascript.gen.c448.call(sendToList)
	at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:81)
	at org.mozilla.javascript.gen.c421._c0(accountMainMenuHandler:410)
	at org.mozilla.javascript.gen.c421.call(accountMainMenuHandler)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3127)
	at org.mozilla.javascript.gen.c421.call(accountMainMenuHandler)
	at com.servoy.j2db.scripting.Ztb.executeFunction(Ztb.java:196)
	at com.servoy.j2db.Zwb.Za(Zwb.java:741)
	at com.servoy.j2db.Zwb.Za(Zwb.java:1223)
	at com.servoy.j2db.Zwb.Za(Zwb.java:644)
	at com.servoy.j2db.plugins.ClientPluginAccessProvider$MethodExecutor.run(ClientPluginAccessProvider.java:37)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

My best guess is that I’m running into some sort of scoping problem. My framework for building our HTML lists is complicated, and does some tricky things, like assigning a form method to an object property and calling it from there
e.g.

var oControl = new Object();
oControl.clickHandler = forms._tasks.htmlClickHandler;  //htmlClickHandler is a method on the form _tasks

oControl.clickHandler();

I haven’t had problems with this before, but I can see this potentially introducing scoping problems for things like forms and globals, but then it doesn’t really explain where “Object” went to. It also doesn’t do much to explain why this all works from an Eclipse launched client as opposed an app server one.

I’ve tried reinstalling the app server from scratch a couple of times just to be sure that nothing went wrong in that process, but to no avail. Not quite where to go from, any ideas? :|

We have found this kind of error with solutions imported in Servoy 5.1.x if there was some inline xml (E4X), like:

var xml = <xml><obj>...</obj></xml>;

Everything that was under such construct was totally ignored, and no function appeared anymore in the SolutionExplorer.
We also had this ‘globals’ not found or ‘forms’ not found from then on.

Also on some case of history.removeForm() we had this behavior.
We had form A + tabPanel with form B in it (form B was a dynamic form created/manipulated with the solutionModel).
When we were doing history.removeForm(A) and history.removeForm(B), navigating later to form A was giving us this error.
Only doing history.removeForm(B), solved the problem for us.

Actually calling a removeForm() from a method triggered by the form itself is now prohibited and throws an exception (see notes fro Servoy 5.1.4), but it might well be that calling a form method from an objet is bypassing that new limitation but still hits the problem that this exception is preventing you to hit :(

So basically I would first check:
1/ xml use (even html that would not be properly escaped since you say you are building html),
2/ history.removeForm() usage,
3/ use a global variable to hold and trigger your method, instead of a local Object?
4/ … I also have a little trick that might help with this limitation, … this will not be supported by Servoy so I will not post it here ;-) Just PM me if you want to give it a try.

ptalbot:
1/ xml use (even html that would not be properly escaped since you say you are building html),
2/ history.removeForm() usage,
3/ use a global variable to hold and trigger your method, instead of a local Object?
4/ … I also have a little trick that might help with this limitation, … this will not be supported by Servoy so I will not post it here ;-) Just PM me if you want to give it a try.

  1. We don’t use any inline XML/HTML (it’s all constructed as strings) but I will go through and check all the HTML we are producing for unclosed of improperly formatted HTML.
  2. We don’t use history.removeForm anywhere in our code
  3. Easier said than done. This would be a systematic change since this is all part of a framework we have built. Not impossible, but if this is the answer I’d like to know the reason.

Thanks for the tips, I’ll post again when I know some more.

Does it always happen for certain fields ? Can you open a case with some sample ?

Within our application, yes, it does always happen in certain areas, as opposed to others. The complexity of the system is a bit prohibitive to producing a sample solution, but we’d be more than happy to provide a full setup of our solution if someone at Servoy wanted to take a look.

jgarfield:
Within our application, yes, it does always happen in certain areas, as opposed to others. The complexity of the system is a bit prohibitive to producing a sample solution, but we’d be more than happy to provide a full setup of our solution if someone at Servoy wanted to take a look.

Ok, please open a case in our support system (http://www.servoy.com/s) and someone will have a look. Would be nice if you can figure out the difference(s) between fields that work and those that don’t.