ox-it / ords

Automatically exported from code.google.com/p/ords
0 stars 0 forks source link

Running a static dataset crashes the system #733

Closed jajwilson closed 8 years ago

jajwilson commented 8 years ago

Attempting to run a static dataset, whether it was created in the pre-ODBC or the post-ODBC era, causes a stack trace error such as the one below:

HTTP Status 500 - Unable to compile class for JSP: An error occurred at line: 66 in the jsp file: /queryViewer.jsp The constructor ORDSPostgresDBUtils(String, String, OrdsUser) is undefined 63: Project project = DBGateway.getProject(database.getDatabaseProjectId()); 64: String cleanProjectName = StringEscapeUtils.escapeHtml4(project.getName()); 65: OrdsPhysicalDatabase opd = DBGatewayProjectNode.getPhysicalDatabaseByPhysicalDatabaseId(Integer.parseInt(cleanPhysicalId)); 66: ORDSPostgresDBUtils dbUtils = new ORDSPostgresDBUtils(DBGateway.getDbServerByProjectId(cleanProjectId), opd.getDbConsumedName(), user); 67: Collection tableList = ORDSDatabaseUtils.getTableListForMainDatabase(cleanPhysicalId, user); 68: Collection cols; 69: cols = (Collection) dbUtils.getColumnNamesForTable(cleanTableName).rows.values(); Stacktrace:

type Exception report

message Unable to compile class for JSP: An error occurred at line: 66 in the jsp file: /queryViewer.jsp The constructor ORDSPostgresDBUtils(String, String, OrdsUser) is undefined 63: Project project = DBGateway.getProject(database.getDatabaseProjectId()); 64: String cleanProjectName = StringEscapeUtils.escapeHtml4(project.getName()); 65: OrdsPhysicalDatabase opd = DBGatewayProjectNode.getPhysicalDatabaseByPhysicalDatabaseId(Integer.parseInt(cleanPhysicalId)); 66: ORDSPostgresDBUtils dbUtils = new ORDSPostgresDBUtils(DBGateway.getDbServerByProjectId(cleanProjectId), opd.getDbConsumedName(), user); 67: Collection tableList = ORDSDatabaseUtils.getTableListForMainDatabase(cleanPhysicalId, user); 68: Collection cols; 69: cols = (Collection) dbUtils.getColumnNamesForTable(cleanTableName).rows.values(); Stacktrace:

description The server encountered an internal error (Unable to compile class for JSP: An error occurred at line: 66 in the jsp file: /queryViewer.jsp The constructor ORDSPostgresDBUtils(String, String, OrdsUser) is undefined 63: Project project = DBGateway.getProject(database.getDatabaseProjectId()); 64: String cleanProjectName = StringEscapeUtils.escapeHtml4(project.getName()); 65: OrdsPhysicalDatabase opd = DBGatewayProjectNode.getPhysicalDatabaseByPhysicalDatabaseId(Integer.parseInt(cleanPhysicalId)); 66: ORDSPostgresDBUtils dbUtils = new ORDSPostgresDBUtils(DBGateway.getDbServerByProjectId(cleanProjectId), opd.getDbConsumedName(), user); 67: Collection tableList = ORDSDatabaseUtils.getTableListForMainDatabase(cleanPhysicalId, user); 68: Collection cols; 69: cols = (Collection) dbUtils.getColumnNamesForTable(cleanTableName).rows.values(); Stacktrace:) that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 66 in the jsp file: /queryViewer.jsp The constructor ORDSPostgresDBUtils(String, String, OrdsUser) is undefined 63: Project project = DBGateway.getProject(database.getDatabaseProjectId()); 64: String cleanProjectName = StringEscapeUtils.escapeHtml4(project.getName()); 65: OrdsPhysicalDatabase opd = DBGatewayProjectNode.getPhysicalDatabaseByPhysicalDatabaseId(Integer.parseInt(cleanPhysicalId)); 66: ORDSPostgresDBUtils dbUtils = new ORDSPostgresDBUtils(DBGateway.getDbServerByProjectId(cleanProjectId), opd.getDbConsumedName(), user); 67: Collection tableList = ORDSDatabaseUtils.getTableListForMainDatabase(cleanPhysicalId, user); 68: Collection cols; 69: cols = (Collection) dbUtils.getColumnNamesForTable(cleanTableName).rows.values();

Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469) org.apache.jasper.compiler.Compiler.compile(Compiler.java:378) org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.28 logs.

scottbw commented 8 years ago

It'll be the same cause as this one: https://github.com/ox-it/ords/issues/729

scottbw commented 8 years ago

I've checked in the same fix I used #729 - seems to have done the trick on my local setup, so give it a whirl on dev in a few minutes

jajwilson commented 8 years ago

Newly-created static queries now work fine. Pre-ODBC queries give error messages such as: "Unable to run query. Possible causes include malformed SQL, or a database error. Please check your query and try again. If you think you have encountered a problem with the ORDS system, please contact the help desk by emailing ords@it.ox.ac.uk Message was: org.postgresql.util.PSQLException: ERROR: relation "country" does not exist Position: 40" or "Unable to run query. Possible causes include malformed SQL, or a database error. Please check your query and try again. If you think you have encountered a problem with the ORDS system, please contact the help desk by emailing ords@it.ox.ac.uk Message was: org.postgresql.util.PSQLException: ERROR: relation "city" does not exist Position: 15" [these are both with Mondial]

Is there anything we can do about this before we break anyone's saved static datasets on App?

thestoat commented 8 years ago

Can you give me access to the project you are using on Dev and let me know which dataset you are running. Could me this will get fixed with the retrofit work I plan to resume shortly

jajwilson commented 8 years ago

Sure. The pre-ODBC saved queries I'm referring to are in Standard test > Mondial. The dynamic ones work again, the static ones don't. You should already have access.

thestoat commented 8 years ago

Ok, I can confirm this is as a result of the ODBC work and the retrofit I plan will fix ... so hold on to this issue for now and retry once the retrofit work is sorted (issue 722).

MerielP commented 8 years ago

I'm still having difficulty accessing static datasets created in the pre-ODBC era. I don't get the sort of stack track error that James reports above, but I do get this:

Unable to run query. Possible causes include malformed SQL, or a database error. Please check your query and try again. If you think you have encountered a problem with the ORDS system, please contact the help desk by emailing ords@it.ox.ac.uk

Message was: org.postgresql.util.PSQLException: ERROR: relation "tblauthors" does not exist Position: 63

The claim that "tblauthors" doesn't exist is not true. I can take the same query, paste it into ORDS and use it to create a new static dataset which works as expected. I can also access dynamic datasets created before the ODBC work - but not pre-ODBC static ones.

(No idea why Github is displaying part of the pasted text in huge bold letters - and I can't work out how to persuade it not to.)

thestoat commented 8 years ago

Hi Merial

Wrt your Github problem, If you right click on the text box you are writing the comment in to and select "paste as plain text" you should be able to paste the test without the huge bold letters.

On to your issue - you don't say which dataset displays the problem?

thestoat commented 8 years ago

Ok - I think I have tracked down the issue you are seeing - again, to do with retrofit security being a little too secure. Fixing now ...

thestoat commented 8 years ago

This should now be fixed

MerielP commented 8 years ago

I'm afraid I'm still having the same problem. As far as I can tell, this is still affecting all static datasets created in the pre-ODBC era, when viewed from within an ORDS project.

I've added you as a project administrator for my project 'Sample project'. There are static datasets displaying this problem in the databases called 'Sample database', 'Mondial database', and 'Bibliography database'. ('Bibliography database' does contain one functioning static dataset, but this was created post-ODBC.)

On the other hand, I can view public static datasets via the ORDS public project search. This has the odd consequence that there are some datasets that any member of the public can see, but I can't access via my own ORDS account.

thestoat commented 8 years ago

Ah - the key here is "when viewed from within an ORDS project". Though it was also broken with a public search. I'll work on a fix for this issue too

thestoat commented 8 years ago

Should be ok now

MerielP commented 8 years ago

Hurrah! Seems to be working smoothly now. I'll close this issue.