Hi Andrew,

your inner entity uses an XML type datasource. The default entity processor is the SQL one, however.

For your inner entity, you have to specify the correct entity processor explicitly. You do that by adding the attribute "processor", and the value is the classname of the processor you want to use.

e.g. <entity dataSource="filesystem" name="domain_pdb" processor="XPathEntityProcessor" ....

(See the wikipedia example on the DataImportHandler wiki page.)

Cheers,
Chantal

Andrew Clegg schrieb:
First of all, apologies if you get this twice. I posted it by email an hour
ago but it hasn't appeared in any of the archives, so I'm worried it's got
junked somewhere.

I'm trying to use a DataImportHandler to merge some data from a database
with some other fields from a collection of XML files, rather like the
example in the Architecture section here:

http://wiki.apache.org/solr/DataImportHandler

... so a given document is built from some fields from the database and some
from the XML.

My dataconfig.xml looks like this:


<dataConfig>
   <dataSource name="database" driver="org.postgresql.Driver"
url="jdbc:postgresql://cathdb.info/cathdb_v3_3_0" user="cathreader"
password="cathreader" />

   <dataSource name="filesystem" type="FileDataSource"
basePath="/cath/people/cathdata/v3_3_0/pdb-XML-noatom/" encoding="UTF-8"
connectionTimeout="5000" readTimeout="10000"/>

   <document name="domain">

       <entity name="domain" dataSource="database" query="select domain_id
as id, 'PDB code ' || pdb_code || ', chain ' || chain_code || ', domain ' ||
domain_code as title, 'some keywords go here' as
keywords, pdb_code || ' ' || chain_id as related_ids, 'domain' as doc_type,
pdb_code from domain">

           <entity dataSource="filesystem" name="domain_pdb"
url="${domain.pdb_code}-noatom.xml">
               <field column="content"
xpath="//*[local-name()='structCategory']/*[local-name()='struct']/*[local-name()='title']"
/>
           </entity>

       </entity>

   </document>
</dataConfig>


This works if I comment out the inner entity, but when I uncomment it, I get
this error:


30-Jul-2009 14:32:50 org.apache.solr.handler.dataimport.DocBuilder
buildDocument
SEVERE: Exception while processing: domain document :
SolrInputDocument[{id=id(1.0)={1s32D00}, title=title(1.0)={PDB code
1s32, chain D, domain 00}, keywords=keywords(1.0)={some ke
ywords go here}, pdb_code=pdb_code(1.0)={1s32},
doc_type=doc_type(1.0)={domain}, related_ids=related_ids(1.0)={1s32
1s32D}}]
org.apache.solr.handler.dataimport.DataImportHandlerException:
java.lang.NullPointerException
       at
org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:64)
       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:344)
       at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:372)
       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.NullPointerException
       at java.io.File.<init>(File.java:222)
       at
org.apache.solr.handler.dataimport.FileDataSource.getData(FileDataSource.java:75)
       at
org.apache.solr.handler.dataimport.FileDataSource.getData(FileDataSource.java:44)
       at
org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:58)
       ... 9 more


I have checked that the file
/cath/people/cathdata/v3_3_0/pdb-XML-noatom/1s32-noatom.xml is readable, so
maybe the full path to the file isn't being constructed properly or
something?

I also tried with the full path template for the file in the entity url
attribute, instead of using a basePath in the dataSource, but I get exactly
the same exception.

This is with the 2009-07-30 nightly build. See attached for schema.
http://www.nabble.com/file/p24739580/schema.xml schema.xml

Any ideas? Thanks in advance!

Andrew.


--
:: http://biotext.org.uk/ ::
--
View this message in context: 
http://www.nabble.com/NullPointerException-in-DataImportHandler-tp24739580p24739580.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to