How to track down query error...

org.postgresql.util.PSQLException: No value specified for parameter 2. 
    	at org.postgresql.core.v3.SimpleParameterList.checkAllParametersSet(SimpleParameterList.java:150) 
    	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:179) 
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) 
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354) 
    	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:258) 
    	at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source) 
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    	at java.lang.reflect.Method.invoke(Method.java:585) 
    	at com.servoy.j2db.persistence.datasource.p.invoke(Unknown Source) 
    	at $Proxy1.executeQuery(Unknown Source) 
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) 
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) 
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:179) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source) 
    	at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source) 
    	at sun.reflect.GeneratedMethodAccessor216.invoke(Unknown Source) 
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    	at java.lang.reflect.Method.invoke(Method.java:585) 
    	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294) 
    	at sun.rmi.transport.Transport$1.run(Transport.java:153) 
    	at java.security.AccessController.doPrivileged(Native Method) 
    	at sun.rmi.transport.Transport.serviceCall(Transport.java:149) 
    	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) 
    	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) 
    	at java.lang.Thread.run(Thread.java:613)
2007-04-23 17:30	RMI TCP Connection(673)-192.168.1.80	ERROR	com.servoy.j2db.util.Debug	select crm_contacts.contact_id, crm_contacts.contact_person_id, crm_contacts.contact_company_id, crm_contacts.contact_type, crm_contacts.contact_address, crm_contacts.contact_comment, crm_contacts.modified_timestamp, crm_contacts.created_timestamp, crm_contacts.fm_id, crm_contacts.created_by, crm_contacts.modified_by, crm_contacts.contact_type_id from crm_contacts,classification_types where crm_contacts.contact_company_id = ? and classification_types.type_category_id = ? order by classification_types.type_sort_order

We think Servoy is generating this query trying to load some form… but we have trouble locating where it is coming from. We have tried stepping through the debugger…

Any ideas of how to best track this one down?
What clues should we be looking for?

From the query it looks like

  1. the form in question is based on crm_contacts
  2. the missing parameter seems to be the “type_category_id”

Are you using a filterParam somewhere? Maybe you have a relation pointing to crm_contacts that uses a global to filter the type_category_id?

It could also be a manual query where you pass an arguments array that misses one value…

Thanks for your suggestions, Patrick – good to see I have not gone mad!

My current suspect is a value-list based on a global relationship,
type_category_id is set to 9 as default value in the Globals pane of ‘Define Data Providers’.

I’m going to manually load the list with a query to see it the error goes away.

Manually loading the value list with a SQL query fixed the problem.

This looks like some obscure Servoy bug. I’m loading a screen based on crm_people, the crm_contacts-based form is also used by crm_companies – which is not showing on screen… the rouge query is somehow related to loading from this other form.

I am having problems once in a while, too, that are related to relationships based on globals. Those relationships suddenly break, resulting in referenceErrors. If you could make a test case and post it to the Support system, it might help to fix some of my problems as well :wink:. I can never make a reproducable case…

swingman,

Can you create a reproducible case for this and create a case in the support system?

Please try it in 3.5 as well, the sql generation engine has been completely rewritten and the bug has probably gone in the process.

Rob

Hi, have got rid of the errors now by rewriting. It is very difficult to isolate in a large solution of 200+ forms, 100ish tables etc…

I suspect everything will work fine in isolation :wink:

The error came back.

After a bit of investigation I found that in a tabpanel on my companies form was form based on contacts related to companies. This relationship did not use the missing ID in any way.

I was also setting the foundset of this form with controller.loadRecords(sql,args). I removed the related form from the panel and added it again unrelated and the errors in the log went away.