Page 1 of 1

Different behaviour in developer and runtime

PostPosted: Mon Apr 18, 2011 6:07 pm
by gianni
Hi all,

I've installed at customer site on Servoy 5.1 upgraded to 5.2.7; customer took its time before starting to use the application in production. Now in the first try I'm facing with the problem described in the title:
- if I run the application from Developer on the development workstation in the development environment, same database as customer, the problem do not raise
- if I run the application from Developer on the customer workstation the problem do not raise
- if I run the application directly from runtime on the customer workstation I get the error message: org.mozilla.javascript.EcmaError: "scarica" is not defined: risolvi#947

Nothing in the log for both db and application server...

Looking in the code scarica() method is called from risolvi() at line 947; both methods are on the same form...

I've thinked about a configuration problem for the runtime, so I've checked:
- OS: WinXP 32bit for both
- Java version: 1.6.0_18 for both
- Max Heap: 512MB for both
- LNF: Kunststoff for both

I'm running out of ideas...any hint from some expert?

Ciao,
Gianni

Re: Different behaviour in developer and runtime

PostPosted: Mon Apr 18, 2011 6:11 pm
by jcompagner
so scarica is just another function that is being called by another?

What is exactly on (or around) line 947 of risolvi?

Re: Different behaviour in developer and runtime

PostPosted: Mon Apr 18, 2011 7:17 pm
by gianni
Hi Johan,

Here it is the initial part of the risolvi() method (it's about 1/3 of the total length...):
**********
function risolvi()
{
// Verifica il numero dei risolutori necessari e per ognuno esegue la risoluzione
// Parametri:
// Risoluzione
// Tipo valutazione

var risoluzione = arguments[0];
var tipo_valutaz = arguments[1];

// application.setStatusText("Ora decido che deve eseguire le valorizzazioni");

// It is useful to limit number of rows
var maxReturnedRows = 10;
// Seleziona solo quelli maggiori di 1 perchè 1 è il solver interattivo...
var query = "select distinct valr_slvr from valorizzazioni where valr_riso = " + risoluzione + " order by valr_slvr desc";
var server_name = controller.getServerName();
var solvers = databaseManager.getDataSetByQuery(server_name, query, null, maxReturnedRows);

for( var i = 1 ; i <= solvers.getMaxRowIndex() ; i++ )
{
solvers.rowIndex = i;
var solver = solvers.valr_slvr;

var risultato = scarica(risoluzione, solver, tipo_valutaz);
if (!risultato)
{
return false;
}
}
...
**********
The two parameters are both numeric.
The query get back 1 row in this case.
The scarica() method can return true or false.

Digging and digging I found something else leading me to a question: when the smart client is launched from the developer the "Exception capture" event at solution level is normally working or is it disabled? The message is generated from a method associated to this event and a dialog is shown mimicking the usual dialog...this method was stabilized during 3.5 timeframe and it could be it is outdated now...I am checking this context now, looking for more info on this subject...

Hope it helps to shed the light!

Gianni

Re: Different behaviour in developer and runtime

PostPosted: Tue Apr 19, 2011 9:49 am
by jcompagner
but is this the line where it complains about??

var risultato = scarica(risoluzione, solver, tipo_valutaz);

do you have (in the java console on the client) a full stacktrace of this error?

If it really can't find that method, then i guess there is something wrong with the solution on the server itself, you could try ti import it again.

Re: Different behaviour in developer and runtime

PostPosted: Tue Apr 19, 2011 10:27 am
by gianni
@Johan

I've already done it twice before writing this posts....

Gianni

Re: Different behaviour in developer and runtime

PostPosted: Tue Apr 19, 2011 11:55 am
by gianni
Here it is: as far as I know I should reserve more memory for the program/vm on the runtime...but up2now I do not know which is the correct parameter to change...in the past I needed to change maxHeap in the runtime for a similar situation; it is defined at 448 or 512 because of that...which is the parameter to change?

Definitively I need to study/know more about runtime context...

Tnks,
Gianni

**********
19-apr-2011 11.31.40 com.servoy.j2db.autil.Debug error
GRAVE: Compilation failed for method: scarica
19-apr-2011 11.31.40 com.servoy.j2db.util.Debug error
GRAVE: Throwable
java.lang.RuntimeException: Program too complex: too big jump offset
at org.mozilla.classfile.ClassFileWriter.fixLabelGotos(ClassFileWriter.java:1331)
at org.mozilla.classfile.ClassFileWriter.stopMethod(ClassFileWriter.java:292)
at org.mozilla.javascript.optimizer.BodyCodegen.generateBodyCode(Codegen.java:1212)
at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:291)
at org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:158)
at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:68)
at org.mozilla.javascript.Context.compileImpl(Context.java:2440)
at org.mozilla.javascript.Context.compileFunction(Context.java:1435)
at org.mozilla.javascript.Context.compileFunction(Context.java:1427)
at com.servoy.j2db.scripting.ScriptEngine.compileScriptProvider(ScriptEngine.java:428)
at com.servoy.j2db.scripting.ScriptEngine.compileFunction(ScriptEngine.java:394)
at com.servoy.j2db.scripting.LazyCompilationScope.get(LazyCompilationScope.java:136)
at com.servoy.j2db.scripting.FormScope.get(FormScope.java:262)
at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1641)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1740)
at org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2059)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:89)
at org.mozilla.javascript.gen.c72._c0(risolvi:947)
at org.mozilla.javascript.gen.c72.call(risolvi)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:73)
at org.mozilla.javascript.gen.c55._c0(valutaz:1085)
at org.mozilla.javascript.gen.c55.call(valutaz)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:387)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3135)
at org.mozilla.javascript.gen.c55.call(valutaz)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:476)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3977)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3865)
at com.servoy.j2db.FormController.executeFunction(FormController.java:3787)
at com.servoy.j2db.FormController$ScriptExecuter.executeFunction(FormController.java:3642)
at com.servoy.j2db.ui.BaseEventExecutor.fireEventCommand(BaseEventExecutor.java:272)
at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:217)
at com.servoy.j2db.ui.BaseEventExecutor.fireActionCommand(BaseEventExecutor.java:212)
at com.servoy.j2db.smart.dataui.AbstractScriptButton$2.actionPerformed(AbstractScriptButton.java:826)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
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)
**********

Re: Different behaviour in developer and runtime

PostPosted: Tue Apr 19, 2011 12:12 pm
by jcompagner
ok the problem is now clear
how big is that scarica method??

You are hitting the boundaries of the compiler.

You should split that method up in parts.

What you also can do is at the server push a system property to the clients:

System.property.servoy.disableScriptCompile=true

You can set that in the main admin pages in the system.properties section

Re: Different behaviour in developer and runtime

PostPosted: Tue Apr 19, 2011 1:49 pm
by gianni
Tnks Johan, effectively scarica() is too long...I'll split it!!!