# databaseManager.getFoundSet doesn't work on server

**URL:** <https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616>\
**Category:** Classic Servoy\
**Created:** [October 9, 2012, 11:39am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616 "2012-10-09T11:39:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [October 9, 2012, 11:39am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/1 "2012-10-09T11:39:54Z")

</div>

Hi,

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![dfrazier](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@dfrazier](https://forum.servoy.com/u/dfrazier)\
**Post date:** [October 11, 2012, 7:55pm UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/2 "2012-10-11T19:55:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [October 17, 2012, 12:17pm UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/3 "2012-10-17T12:17:25Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![dfrazier](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@dfrazier](https://forum.servoy.com/u/dfrazier)\
**Post date:** [October 17, 2012, 12:47pm UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/4 "2012-10-17T12:47:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [October 17, 2012, 2:25pm UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/5 "2012-10-17T14:25:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [October 17, 2012, 2:40pm UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/6 "2012-10-17T14:40:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ngervasi](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@ngervasi](https://forum.servoy.com/u/ngervasi)\
**Post date:** [October 17, 2012, 2:51pm UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/7 "2012-10-17T14:51:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [October 18, 2012, 7:59am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/8 "2012-10-18T07:59:38Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [October 19, 2012, 8:43am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/9 "2012-10-19T08:43:11Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [October 19, 2012, 11:47am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/10 "2012-10-19T11:47:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [October 19, 2012, 12:20pm UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/11 "2012-10-19T12:20:44Z")

</div>

OK, I tried this, in code:

```auto
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…

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [October 22, 2012, 10:12am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/12 "2012-10-22T10:12:09Z")

</div>

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.

```auto
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.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [October 22, 2012, 11:29am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/13 "2012-10-22T11:29:42Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [October 24, 2012, 7:15am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/14 "2012-10-24T07:15:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [October 24, 2012, 8:15am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/15 "2012-10-24T08:15:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [October 24, 2012, 9:24am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/16 "2012-10-24T09:24:30Z")

</div>

I tried, but doesn’t help…

Other options?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [October 24, 2012, 9:46am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/17 "2012-10-24T09:46:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcelb](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@marcelb](https://forum.servoy.com/u/marcelb)\
**Post date:** [October 24, 2012, 10:20am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/18 "2012-10-24T10:20:55Z")

</div>

Yes!! That solved the problem, thanks Johan!

---

<div class="post-metadata">

**Author:** ![jd2p](https://avatars.discourse-cdn.com/v4/letter/j/9d8465/32.png) [@jd2p](https://forum.servoy.com/u/jd2p)\
**Post date:** [November 16, 2012, 4:36pm UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/19 "2012-11-16T16:36:35Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [November 19, 2012, 10:46am UTC](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616/20 "2012-11-19T10:46:46Z")

</div>

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

[Next page](https://forum.servoy.com/t/databasemanager-getfoundset-doesnt-work-on-server/16616.md?page=2)
