Highlighted

SOLR under CF 11: javax.naming.NameNotFoundException using JNDI name in data import request handler

New Here ,
Apr 16, 2018

Copy link to clipboard

Copied

I'm facing javax.naming.NameNotFoundException while trying to use a preconfigured JNDI datasource name in SOLR data import request handler. Here is the list of steps I took:

1. Modified $JETTY_HOME/start.ini file to include "plus" into OPTIONS and add etc/jetty-plus.xml;

2. Added etc/jetty-plus.xml file that includes the following:

        <Configure id="Server" class="org.eclipse.jetty.server.Server">

           <Call class="org.eclipse.jetty.webapp.Configuration$ClassList" name="setServerDefault">

            <Arg><Ref refid="Server" /></Arg>

            <Call name="addAfter">

              <Arg name="afterClass">org.eclipse.jetty.webapp.FragmentConfiguration</Arg>

              <Arg>

        <Array type="String">

          <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>

          <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>

        </Array>

              </Arg>

            </Call>

          </Call>

          <Call name="setAttribute">

               <Arg>org.eclipse.jetty.webapp.configuration</Arg>

        <Arg>

             <Array type="java.lang.String">

          <Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>

          <Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>

          <Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>

          <Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>

          <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>

          <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>

          <Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item>

          <Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>

             </Array>

        </Arg>

           </Call>

        </Configure>

3. Added the following into jetty.xml:

        <New id="MyDS" class="org.eclipse.jetty.plus.jndi.Resource">

            <Arg><Ref refid="Server"/></Arg>

            <Arg>jdbc/MyDS</Arg>

            <Arg>

            <New class="net.sourceforge.jtds.jdbcx.JtdsDataSource">

               <Set name="User">user</Set>

               <Set name="Password">secret</Set>

               <Set name="DatabaseName">DS</Set>

               <Set name="ServerName">localhost</Set>

               <Set name="PortNumber">1433</Set>    

            </New>

            </Arg>

        </New>

4. Placed jtds-1.3.1.jar into jetty/lib/ext directory.

The datasource call in dataconfig file:

<dataConfig> <dataSource jndiName="java:comp/env/jdbc/MyDS" type="JdbcDataSource" driver="net.sourceforge.jtds.jdbcx.JtdsDataSource"/>... </dataConfig> 

causes this exception:

org.apache.solr.common.SolrException log SEVERE: Full Import failed:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT .... Processing Document # 1 at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72) at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:253) at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210) at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39) at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59) at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73) at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238) at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596) at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268) at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187) at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359) at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427) at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408) Caused by: javax.naming.NameNotFoundException; remaining name 'jdbc/MyDS' at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:505) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:536) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:536) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:551) at org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:117) at javax.naming.InitialContext.lookup(InitialContext.java:417) at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:140) at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128) at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363) at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39) at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)  

Any insight into what I am missing in the JNDI pre-configuration process would be greatly appreciated!

Views

221

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

SOLR under CF 11: javax.naming.NameNotFoundException using JNDI name in data import request handler

New Here ,
Apr 16, 2018

Copy link to clipboard

Copied

I'm facing javax.naming.NameNotFoundException while trying to use a preconfigured JNDI datasource name in SOLR data import request handler. Here is the list of steps I took:

1. Modified $JETTY_HOME/start.ini file to include "plus" into OPTIONS and add etc/jetty-plus.xml;

2. Added etc/jetty-plus.xml file that includes the following:

        <Configure id="Server" class="org.eclipse.jetty.server.Server">

           <Call class="org.eclipse.jetty.webapp.Configuration$ClassList" name="setServerDefault">

            <Arg><Ref refid="Server" /></Arg>

            <Call name="addAfter">

              <Arg name="afterClass">org.eclipse.jetty.webapp.FragmentConfiguration</Arg>

              <Arg>

        <Array type="String">

          <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>

          <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>

        </Array>

              </Arg>

            </Call>

          </Call>

          <Call name="setAttribute">

               <Arg>org.eclipse.jetty.webapp.configuration</Arg>

        <Arg>

             <Array type="java.lang.String">

          <Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>

          <Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>

          <Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>

          <Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>

          <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>

          <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>

          <Item>org.eclipse.jetty.annotations.AnnotationConfiguration</Item>

          <Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>

             </Array>

        </Arg>

           </Call>

        </Configure>

3. Added the following into jetty.xml:

        <New id="MyDS" class="org.eclipse.jetty.plus.jndi.Resource">

            <Arg><Ref refid="Server"/></Arg>

            <Arg>jdbc/MyDS</Arg>

            <Arg>

            <New class="net.sourceforge.jtds.jdbcx.JtdsDataSource">

               <Set name="User">user</Set>

               <Set name="Password">secret</Set>

               <Set name="DatabaseName">DS</Set>

               <Set name="ServerName">localhost</Set>

               <Set name="PortNumber">1433</Set>    

            </New>

            </Arg>

        </New>

4. Placed jtds-1.3.1.jar into jetty/lib/ext directory.

The datasource call in dataconfig file:

<dataConfig> <dataSource jndiName="java:comp/env/jdbc/MyDS" type="JdbcDataSource" driver="net.sourceforge.jtds.jdbcx.JtdsDataSource"/>... </dataConfig> 

causes this exception:

org.apache.solr.common.SolrException log SEVERE: Full Import failed:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT .... Processing Document # 1 at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72) at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:253) at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210) at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39) at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59) at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73) at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238) at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:596) at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268) at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187) at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359) at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427) at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408) Caused by: javax.naming.NameNotFoundException; remaining name 'jdbc/MyDS' at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:505) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:536) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:536) at org.eclipse.jetty.jndi.NamingContext.lookup(NamingContext.java:551) at org.eclipse.jetty.jndi.java.javaRootURLContext.lookup(javaRootURLContext.java:117) at javax.naming.InitialContext.lookup(InitialContext.java:417) at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:140) at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128) at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363) at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39) at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)  

Any insight into what I am missing in the JNDI pre-configuration process would be greatly appreciated!

Views

222

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 16, 2018 0

Have something to add?

Join the conversation