[ https://issues.apache.org/jira/browse/SOLR-4446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14298428#comment-14298428 ]
Michele Di Noia commented on SOLR-4446: --------------------------------------- Please, I didn't catch why no one is moving on this important issue. How are u using DIH in production? without prepared stamentent? If so, why yours DBAs don't claim? May be there is a different basic solution that I cannot see. Please anyone aware of it, advice me. Regards to all. Michele > exception swallowed, NPE created upon trouble getting JNDI connection > --------------------------------------------------------------------- > > Key: SOLR-4446 > URL: https://issues.apache.org/jira/browse/SOLR-4446 > Project: Solr > Issue Type: Bug > Components: contrib - DataImportHandler > Affects Versions: 4.1 > Reporter: Ken Geis > > I am trying to use a JNDI connection, but an error occurs getting the > connection. The error is swallowed and obscured by a NullPointerException. > See comments inline below. > {code:title=JdbcDataSource.java} > protected Callable<Connection> createConnectionFactory(final Context > context, > final Properties initProps) { > ... > final String jndiName = initProps.getProperty(JNDI_NAME); > final String url = initProps.getProperty(URL); /* is null */ > final String driver = initProps.getProperty(DRIVER); /* is null */ > ... > return factory = new Callable<Connection>() { > @Override > public Connection call() throws Exception { > ... > try { > if(url != null){ > c = DriverManager.getConnection(url, initProps); > } else if(jndiName != null){ > ... > /* error occurs */ > ... > } > } catch (SQLException e) { > /* exception handler assumes that try block followed "url != null" path; in > the JNDI case, driver is null, and DocBuilder.loadClass(..) throws a NPE */ > Driver d = (Driver) DocBuilder.loadClass(driver, > context.getSolrCore()).newInstance(); > c = d.connect(url, initProps); > } > ... > } > }; > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org