lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shalin Shekhar Mangar (JIRA)" <j...@apache.org>
Subject [jira] Updated: (SOLR-1269) stack trace not clear when there is a SQL error
Date Mon, 07 Sep 2009 11:27:57 GMT

     [ https://issues.apache.org/jira/browse/SOLR-1269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Shalin Shekhar Mangar updated SOLR-1269:
----------------------------------------

    Attachment: SOLR-1269.patch

# Used DataImportHandlerException.wrapAndThrow to avoid incorrect messages
# Add null check in JdbcDataSource#close
# Fixed close() logic so that JdbcDataSource#close is not called after connection timeouts.

I tried two scenarios:
# Incorrect driver name
# Incorrect sql query

With incorrect driver name, before this patch:
{quote}
SEVERE: Full Import failed
org.apache.solr.handler.dataimport.DataImportHandlerException: Failed to initialize DataSource:
null Processing Document # 1
	at org.apache.solr.handler.dataimport.DataImporter.getDataSourceInstance(DataImporter.java:307)
	at org.apache.solr.handler.dataimport.ContextImpl.getDataSource(ContextImpl.java:93)
	at org.apache.solr.handler.dataimport.SqlEntityProcessor.init(SqlEntityProcessor.java:52)
	at org.apache.solr.handler.dataimport.EntityProcessorWrapper.init(EntityProcessorWrapper.java:71)
	at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:302)
	at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:225)
	at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:167)
	at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:333)
	at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:393)
	at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:372)
Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Could not load driver:
org.hsqldb.ajdbcDriver Processing Document # 1
	at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
	at org.apache.solr.handler.dataimport.JdbcDataSource.createConnectionFactory(JdbcDataSource.java:114)
	at org.apache.solr.handler.dataimport.JdbcDataSource.init(JdbcDataSource.java:62)
	at org.apache.solr.handler.dataimport.DataImporter.getDataSourceInstance(DataImporter.java:305)
	... 9 more
{quote}

After the patch:
{quote}
SEVERE: Full Import failed
org.apache.solr.handler.dataimport.DataImportHandlerException: Could not load driver: org.hsqldb.ajdbcDriver
Processing Document # 1
	at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
	at org.apache.solr.handler.dataimport.JdbcDataSource.createConnectionFactory(JdbcDataSource.java:114)
	at org.apache.solr.handler.dataimport.JdbcDataSource.init(JdbcDataSource.java:62)
	at org.apache.solr.handler.dataimport.DataImporter.getDataSourceInstance(DataImporter.java:306)
	at org.apache.solr.handler.dataimport.ContextImpl.getDataSource(ContextImpl.java:93)
	at org.apache.solr.handler.dataimport.SqlEntityProcessor.init(SqlEntityProcessor.java:52)
	at org.apache.solr.handler.dataimport.EntityProcessorWrapper.init(EntityProcessorWrapper.java:71)
	at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:302)
	at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:225)
	at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:167)
	at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:333)
	at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:393)
	at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:372)
Caused by: java.lang.ClassNotFoundException: Unable to load org.hsqldb.ajdbcDriver or org.apache.solr.handler.dataimport.org.hsqldb.ajdbcDriver
	at org.apache.solr.handler.dataimport.DocBuilder.loadClass(DocBuilder.java:717)
	at org.apache.solr.handler.dataimport.JdbcDataSource.createConnectionFactory(JdbcDataSource.java:112)
	... 11 more
{quote}

In the case of incorrect SQL query, the following is logged (before and after is same):
{quote}
SEVERE: Exception while processing: item document : SolrInputDocument[{}]
org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select
* from item1 Processing Document # 1
	at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:251)
	at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:208)
	at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
	at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:58)
	at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:71)
	at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:237)
	at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:339)
	at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:225)
	at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:167)
	at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:333)
	at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:393)
	at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:372)
Caused by: java.sql.SQLException: Table not found in statement [select * from item1]
	at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
	at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
	at org.hsqldb.jdbc.jdbcStatement.execute(Unknown Source)
	at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:244)
	... 11 more
{quote}

> stack trace not clear when there is a SQL error
> -----------------------------------------------
>
>                 Key: SOLR-1269
>                 URL: https://issues.apache.org/jira/browse/SOLR-1269
>             Project: Solr
>          Issue Type: Improvement
>          Components: contrib - DataImportHandler
>    Affects Versions: 1.4
>            Reporter: Erik Hatcher
>         Attachments: SOLR-1269.patch
>
>
> When setting up a new JDBC datasource and the SQL isn't right yet, we are getting a stack
trace that says ClassNotFoundException, but that is misleading.  
> A cleaner stack trace is warranted, indicating the actual error.
> [actual SQL statement omitted]
> org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query:
SELECT     .....  Processing Document # 1
> 	at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:250)
> 	at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:207)
> 	at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:40)
> 	at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:58)
> 	at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:71)
> 	at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:237)
> 	at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:343)
> 	at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:224)
> 	at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:167)
> 	at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:333)
> 	at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:393)
> 	at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:372)
> Caused by: java.lang.ClassNotFoundException: Unable to load null or org.apache.solr.handler.dataimport.null
> 	at org.apache.solr.handler.dataimport.DocBuilder.loadClass(DocBuilder.java:723)
> 	at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:188)
> 	at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:127)
> 	at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:362)
> 	at org.apache.solr.handler.dataimport.JdbcDataSource.access$300(JdbcDataSource.java:40)
> 	at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:237)
> 	... 11 more
> Caused by: java.lang.NullPointerException
> 	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
> 	at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:280)
> 	at org.apache.solr.handler.dataimport.DocBuilder.loadClass(DocBuilder.java:713)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message