2011-12-31 64 views
0

我嘗試在solandra平臺上使用json api上傳文檔。solandra json更新

爲了做到這一點,那我用來上傳我的文檔就是這樣

curl http://localhost:8983/solandra/wikassandra/update/json 
      -H 'Contednt-type:application/json' -d ' 
{ 
"add": {"doc": 
      {"url" : "TestDoc1", 
      "title" : "test1", 
      "text" : "sdkfjw", 
      "category" : "dskfj"} } 
}' 

,我得到這個錯誤

INFO 02:57:56,170 JNDI not configured for solr (NoInitialContextEx) 
INFO 02:57:56,171 solr home defaulted to 'solr/' (could not find system property or JNDI) 
INFO 02:57:56,171 Solr home set to 'solr/' 
INFO 02:57:56,174 row was marked empty: [Row(key=DecoratedKey(155949571512290652274890255161558562273, 313535393439353731353132323930363532323734383930323535313631353538353632323733efbfbf7265736f7572636573), cf=null)] 
INFO 02:57:56,192 Adding specified lib dirs to ClassLoader 
INFO 02:57:56,223 Using Lucene MatchVersion: LUCENE_24 
WARN 02:57:56,254 Deprecated syntax found. <highlighting/> should move to <searchComponent/> 
INFO 02:57:56,258 Loaded SolrConfig: solrconfig.xml 
INFO 02:57:56,258 Reading Solr Schema 
ERROR 02:57:56,260 Exception during parsing file: schema:org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) 
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:391) 
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1391) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748) 
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) 
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239) 
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288) 
    at org.apache.solr.core.Config.<init>(Config.java:159) 
    at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:420) 
    at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:125) 
    at org.apache.solr.core.SolandraCoreContainer.readSchema(SolandraCoreContainer.java:165) 
    at org.apache.solr.core.SolandraCoreContainer.getCore(SolandraCoreContainer.java:100) 
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:194) 
    at solandra.SolandraDispatchFilter.doFilter(SolandraDispatchFilter.java:137) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) 
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) 
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) 
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) 
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
    at org.mortbay.jetty.Server.handle(Server.java:326) 
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) 
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) 
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) 
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) 
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) 
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) 
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) 

ERROR 02:57:56,261 org.apache.solr.common.SolrException: Schema Parsing Failed: Content is not allowed in prolog. 
    at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:678) 
    at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:125) 
    at org.apache.solr.core.SolandraCoreContainer.readSchema(SolandraCoreContainer.java:165) 
    at org.apache.solr.core.SolandraCoreContainer.getCore(SolandraCoreContainer.java:100) 
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:194) 
    at solandra.SolandraDispatchFilter.doFilter(SolandraDispatchFilter.java:137) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) 
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) 
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) 
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) 
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
    at org.mortbay.jetty.Server.handle(Server.java:326) 
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) 
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) 
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) 
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) 
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) 
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) 
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) 
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) 
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) 
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:391) 
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1391) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:625) 
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:488) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:819) 
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:748) 
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) 
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239) 
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:288) 
    at org.apache.solr.core.Config.<init>(Config.java:159) 
    at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:420) 
    ... 18 more 

我應該在哪裏檢查首先要解決這個問題的命令?

+0

看到它我不是一個Solr的或solandra專家,但你有沒有注意到在curl命令一個錯字:它說「Contednt」,我覺得內容可以是指... – rene 2011-12-31 22:53:27

+0

我也不是一個solandra專家,但檢查你的schema.xml。這是一個有效的XML文件? – negativ 2012-01-01 11:02:48

+1

我同意@negativ這是您的Solr實例的schema.xml文件的問題。請附上您的schema.xml文件的內容到這個問題。 – 2012-01-02 02:49:49

回答