databaseManager.getFoundSet doesn't work on server

Hi,

When I run this code in the developer environment (I connect to the SQL-Server database on ip via Internet) it works fine:

var _fsDest = databaseManager.getFoundSet("abs_central_reporting", "groupinvoicefacts");

When I run this on the server with exact the same database (but now the database-server is on the same network) I get this:

JavaException: java.lang.RuntimeException: Can’t get new foundset for: db:/abs_central_reporting/groupinvoicefacts

I tested some other tables in the same DB and I can create a foundset of them!? I changed the name of this table and even recreated it with a different name with no result yet.

Who can help me out?

Thanks.

Try turning on the tracing functionality in the Servoy Server Admin (in the server log page). Then try this scenario again. It may give more info. You may also consider checking your log files for your RDBMS. Perhaps there is something wrong on that end.

I turned on tracing in Servoy which sometimes resulted in this message when the getFoundSet() is called:

2012-10-17 14:15 http-8080-1 INFO com.servoy.j2db.util.Debug clientid: 7BA45EE7-734D-409D-97C3-C2D1CBA15634 uses table: abs_central_reporting.groupinvoicefacts 7BA45EE7-734D-409D-97C3-C2D1CBA15634 CentralReporting

I also turned on ALL logging options on SQL_Server but nothing happened at the moment the foundset should be created, so the cause is within Servoy.

Who can help me out here?

Thanks!

That’s it? No other error messages? Hmmm… ok, well, I’m out of ideas. Maybe your server is haunted?

Does that table have a configured PK or ident columns?
If everything looks correct maybe your repository has some issues, try to delete all the solutions from the repository and import them back again or even better: shutdown the servoy server, delete all the repositories tables and recreate them starting the server with the -upgradeRepository flag, after that reimport your solution and try again.

be aware, that if you drop your repository tables, you also loose all your (servoy) users & groups!

True, groups would be recreated in import but users would be gone, so if you use servoy users (you don’t have your own users table stored on your db) don’t delete the repo tables but just delete all the solutions from the server.

what does the log say? (webclient->admin server, smart client → webstart console)

there should be a exception printed there i think. (Except if you swallow that in your solution onError method)
we do this:

throw new RuntimeException("Can’t get new foundset for: " + dataSource, e); //$NON-NLS-1$

and the thing is that i need to know what that “e” is (the Cause of this exception)

The error occurs in a Try-Catch block, this is the catch:

catch (e) {
	error_occured = true;
	writeLog("Level 1 error in function syncTable: " + e);
}

And this is what it writes in the log:

18 okt 2012 13:49:28 Level 1 error in function syncTable: JavaException: java.lang.RuntimeException: Can’t get new foundset for: db:/abs_central_reporting/groupinvoicefacts

no that is not of much use, we must have the exception itself
That should also be somewhere in the log if you don’t swallow it in your onError method of the solution
What you can do is just do application.output(e) (maybe with ERROR logging level), do not append any string to it.

OK, I tried this, in code:

catch (e) {
	application.output(e,LOGGINGLEVEL.ERROR);
	error_occured = true;
	writeLog("Level 1 error in function syncTable: " + e);
}

In the server log I get:

2012-10-19 14:17 http-192.168.100.27-80-60 ERROR com.servoy.j2db.util.Debug JavaException: java.lang.RuntimeException: Can’t get new foundset for: db:/abs_central_reporting/groupinvoicefacts EA34284F-26BC-41FB-8E36-9A6873ADBE73 CentralReporting

No other errors…

EDIT: is just did see that this is still not enough info, will need to look where the real cause is and how to get it out of it

i tried this and yes then the output will not result in a stack because it is a native javascript error that doesn’t result in a stacktrace.

try {
  	var fs = databaseManager.getFoundSet("db:/doesntexists/nothing");
	} catch(e) {
		application.output(e, LOGGINGLEVEL.ERROR);
		throw e;
	}

you just have to re throw it “throw e” and make sure that you on solution onError method does “return true” for that, so that we really report this error

i do get this:

2012-10-22 12:08:39,500 ERROR [AWT-EventQueue-0] com.servoy.j2db.util.Debug - Throwable [14CC4E45-9833-44E2-A2D3-2FF4FB172D73 formInDialogLegacy]
org.mozilla.javascript.JavaScriptException: JavaException: java.lang.RuntimeException: Can’t get new foundset for: db:/doesntexists/nothing (C:\Servoy61rc4\servoy_workspace\formInDialogLegacy\forms\premain.js#10)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1045)
at script.qtest(C:\Servoy61rc4\servoy_workspace\formInDialogLegacy\forms\premain.js:10)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:837)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:406)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3192)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:574)
at com.servoy.j2db.debug.RemoteDebugScriptEngine.executeFunction(RemoteDebugScriptEngine.java:398)
at com.servoy.j2db.FormController.executeFunction(FormController.java:4899)
at com.servoy.j2db.FormController.executeFunction(FormController.java:4633)
at com.servoy.j2db.smart.scripting.ScriptMenuItem$1.run(ScriptMenuItem.java:129)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

that is what we need.

Ok you can’t catch it and then output that or rethrow that
Because then the exception is wrapped into some specific javascript object and we are not able to get to the real cause again
so you just have to let it fail:

var fs = databaseManager.getFoundSet("db:/doesntexists/nothing");

then you get this:

2012-10-22 13:27:17,837 ERROR [AWT-EventQueue-0] com.servoy.j2db.util.Debug - Throwable
org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Can’t get new foundset for: db:/doesntexists/nothing (C:\Servoy61rc4\servoy_workspace\formInDialogLegacy\forms\premain.js#6)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1815)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:180)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:311)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1768)
at script.qtest(C:\Servoy61rc4\servoy_workspace\formInDialogLegacy\forms\premain.js:6)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:837)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:406)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3192)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:574)
at com.servoy.j2db.debug.RemoteDebugScriptEngine.executeFunction(RemoteDebugScriptEngine.java:398)
at com.servoy.j2db.FormController.executeFunction(FormController.java:4899)
at com.servoy.j2db.FormController.executeFunction(FormController.java:4633)
at com.servoy.j2db.smart.scripting.ScriptMenuItem$1.run(ScriptMenuItem.java:129)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.RuntimeException: Can’t get new foundset for: db:/doesntexists/nothing
at com.servoy.j2db.dataprocessing.JSDatabaseManager.js_getFoundSet(JSDatabaseManager.java:2451)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:158)
… 20 more
Caused by: com.servoy.j2db.persistence.RepositoryException: Server doesntexists wordt niet gevonden
at com.servoy.j2db.dataprocessing.FoundSetManager.getTable(FoundSetManager.java:925)
at com.servoy.j2db.dataprocessing.SQLGenerator.createTableSQL(SQLGenerator.java:1290)
at com.servoy.j2db.dataprocessing.SQLGenerator.getCachedTableSQLSheet(SQLGenerator.java:1261)
at com.servoy.j2db.dataprocessing.FoundSetManager.getDefaultPKSortColumns(FoundSetManager.java:2406)
at com.servoy.j2db.dataprocessing.FoundSetManager.getFoundSet(FoundSetManager.java:2399)
at com.servoy.j2db.dataprocessing.FoundSetManager.getFoundSet(FoundSetManager.java:1)
at com.servoy.j2db.dataprocessing.JSDatabaseManager.js_getFoundSet(JSDatabaseManager.java:2447)
… 25 more

OK, thanks, I found the cause, it seems that on the server the dbi’s are not in sync? The message is:

Cannot work without primaryKey on table ‘groupinvoicefacts’

I really hope that I don’'t have to delete & re-import all solutions (and users?) as earlier proposed in this thread. The problems are on a live server with hundreds of clients!

The table has a double PK for which I defined 2 columns as row_ident and this works fine in developer.

What can I do?

You can try to reimport the solution and select the option “Override existing sequence type definitions (in repository) with the sequence types contained in the import file.”
so that the sequence type of the import file is always used.

I tried, but doesn’t help…

Other options?

are you touching that datasource in the solution itself? So as a datasource for a form, valuelist or relation?

Because if you don’t do that then the table is not referenced according to servoy and is not in the export file at all by default
For that the exporter in the developer has an option “export all tables from referenced servers”
That must be used if you have a table that is really only referenced by scripting but not by the solution (designed stuff) itself.
The server must be used somewhere in the solution else it will still not work.

Yes!! That solved the problem, thanks Johan!

We’ve had this same issue for the last four days have run out of ideas. We did a clean install of Servoy 6.1.2 on a customer server (Windows Server 2008 R2, x64) and after importing the solution we received the message on both the web and smart client:

JavaException: java.lang.RuntimeException: Can't get new foundset for: db:/conn/users

This happened to us right at the beggining, on the login solution. We tried:

  • Reinstalling
  • Running servoy_server.bat with upgradeRepository flag
  • Re-synchronizing dbis
  • Add modules separately (one by one)
  • Exporting with the “export all tables from referenced servers” setting and importing with the “Override existing sequence type definitions (in repository) with the sequence types contained in the import file.” setting
  • Enabling trace log showed no indications of what happened (I find this odd because we commented all try|catch statements and we still got nothing on the log)

Some interesting things:

  • We installed the Developer on that Server and it ran well from there.
  • When we imported the solution the Application Server of any of our Development Machines (running 6.1.2) or a Development Server (running 6.1 rc4), we had no trouble at all
  • We tried importing the sample servoy_crm solution and that worked well.

In the end, we uninstalled everything, installed Servoy Server 6.1 rc4 and re-imported the solution. This got it to work on the web client but we get the same error message on the smart client.. Any ideas on what could be happening?

is server “conn” used in your solution by form/relation/valuelist?