jndiName="java:comp/env/jdbc/myds"

------------------ ???????? ------------------
??????: "Per Newgro";<per.new...@gmx.ch>;
????????: 2017??2??7??(??????) ????4:47
??????: "solr-user-group"<solr-user@lucene.apache.org>; 

????: Solr 5.5.0 Configure global jndi DS for dataimport



Hello,

I would like to configure a JNDI datasource for use in dataimport. From the 
documentation it shall be possible and easy.

My environment:
Debian
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2~bpo8+1-b14)
Solr 5.5.0 downloaded and installed as service in /opt/solr
Installed core in /var/lib/solr/data/collection1

Solr is running and core can be managed.

Put into /opt/solr/server/lib
jetty-jndi-9.2.13.v20150730.jar
jetty-plus-9.2.13.v20150730.jar
Put into /opt/solr/server/lib/ext
sqljdbc4-4.0.jar

/opt/solr/server/etc/jetty.xml
...
    <New id="dataSource" class="org.eclipse.jetty.plus.jndi.Resource">
        <Arg><Ref id="Server" /></Arg>
        <Arg>jdbc/myds</Arg>
        <Arg>
            <New class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
                <Set name="URL">jdbc:sqlserver://<ip>;databaseName=dbname;</Set>
                <Set name="User">user</Set>
                <Set name="Password">password</Set>
            </New>
        </Arg>
    </New>
...

/var/lib/solr/data/collection1/conf/db-data-config.xml
<dataConfig>
    <dataSource jndiName="jdbc/myds" type="JdbcDataSource"/>
    <document>
        <entity
            name="bodyshop"
            query="SELECT b.id as ID,
                          customer_number as CUSTOMER_NUMBER,
                          customer_name as CUSTOMER_NAME
                    FROM  schema.body_shops b
                   WHERE  '${dataimporter.request.clean}' != 'false'
                      OR  b.last_modified > '${dataimporter.last_index_time}'">
...

But all i get is an exception
Caused by: javax.naming.NameNotFoundException; remaining name 'jdbc/myds'
        at 
org.eclipse.jetty.jndi.local.localContextRoot.lookup(localContextRoot.java:487)
        at 
org.eclipse.jetty.jndi.local.localContextRoot.lookup(localContextRoot.java:533)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        at 
org.apache.solr.handler.dataimport.JdbcDataSource$1.getFromJndi(JdbcDataSource.java:250)
        at 
org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:182)
        at 
org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:172)
        at 
org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:463)
        at 
org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:309)
        ... 39 more

I've searched across the web for a solution but all i found did not work.
It would be great if someone could help me out.

Thanks
Per

Reply via email to