Skip to content

Param ${dataimporter.request.myvar} doesn't work #22

@fmassiera

Description

@fmassiera

We use this param in order to set up host/port/username/pwd/database to avoid to be written on data-config.xml

For that we declare in solrconfig.xml



data-config.xml


${dihMongoDBHost:defaultHost}
${dihMongoDBPort:defaultPort}
${dihMongoUsername:defaultUsername}
${dihMongoDBPassword:defaultPwd}
${dihMongoDBDatabase:defaultDB}

Unfortunatly, used in the datasource it's not working and we have the following issue

 <dataSource name="mongo" type="MongoDataSource" host="${dataimporter.request.dihMongoDBHost}" port="${dataimporter.request.dihMongoDBPort}" username="${dataimporter.request.dihMongoDBUsername}" password="${dataimporter.request.dihMongoDBPassword}" database="${dataimporter.request.dihMongoDBDatabase}" />

Caused by: java.lang.NumberFormatException: For input string: "${dataimporter.request.dihMongoDBPort}"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:569)
at java.lang.Integer.parseInt(Integer.java:615)
at org.apache.solr.handler.dataimport.MongoDataSource.init(MongoDataSource.java:49)
at org.apache.solr.handler.dataimport.DataImporter.getDataSourceInstance(DataImporter.java:389)

And if I change with the port written, still not working

 <dataSource name="mongo" type="MongoDataSource" host="${dataimporter.request.dihMongoDBHost}" port="27017" username="${dataimporter.request.dihMongoDBUsername}" password="${dataimporter.request.dihMongoDBPassword}" database="${dataimporter.request.dihMongoDBDatabase}" />

Caused by: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=${dataimporter.request.dihmongodbhost}:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.UnknownHostException: ${dataimporter.request.dihmongodbhost}}}]
at com.mongodb.BaseCluster.getServer(BaseCluster.java:82)
at com.mongodb.DBTCPConnector.getServer(DBTCPConnector.java:669)
at com.mongodb.DBTCPConnector.access$500(DBTCPConnector.java:40)
at com.mongodb.DBTCPConnector$MyPort.getConnection(DBTCPConnector.java:518)
at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:461)
at com.mongodb.DBTCPConnector.authenticate(DBTCPConnector.java:639)
at com.mongodb.DBApiLayer.doAuthenticate(DBApiLayer.java:247)
at com.mongodb.DB.authenticateCommandHelper(DB.java:745)
at com.mongodb.DB.authenticate(DB.java:701)
at org.apache.solr.handler.dataimport.MongoDataSource.init(MongoDataSource.java:53)
at org.apache.solr.handler.dataimport.DataImporter.getDataSourceInstance(DataImporter.java:389)

It seems that we can use the param, it would be great if we can, as with other datasource.

I hope you still working on this project and you'll be able to add that fix !!

Tks again for your work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions