一、异常描述
关于启动apache-solr应用报"HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure: Could not load config for solrconfig.xml,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Could not load config for solrconfig.xml..Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or 'solr-md/collection1/conf/', cwd=/.."异常错误。
HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure: Could not load config for solrconfig.xml,@b@trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Could not load config for solrconfig.xml@b@ at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:860) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:251)@b@ at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:158) @b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) @b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) @b@ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) @b@ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) @b@ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) @b@ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) @b@ at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) @b@ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) @b@ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) @b@ at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) @b@ at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) @b@ at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) @b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) @b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) @b@ at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) @b@ at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.solr.common.SolrException: Could not load config for solrconfig.xml at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:592) @b@ at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657) @b@ at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364) @b@ at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356) @b@ at java.util.concurrent.FutureTask.run(FutureTask.java:262) @b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) @b@ at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) @b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ... 1 more@b@Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or 'solr-md/collection1/conf/', cwd=/ at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:322) @b@ at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:287)@b@ at org.apache.solr.core.Config.<init>(Config.java:116)@b@ at org.apache.solr.core.Config.<init>(Config.java:86)@b@ at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:120) @b@ at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:589) ... 9 more ,code=500}@b@ @b@...@b@@b@2866 [coreLoadExecutor-3-thread-1] INFO org.apache.solr.core.CoreContainer – Creating SolrCore 'collection1' using instanceDir: solr\collection1@b@2873 [coreLoadExecutor-3-thread-1] INFO org.apache.solr.core.SolrResourceLoader – new SolrResourceLoader for directory: 'solr\collection1\'@b@2930 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer – Failed to load file C:\..\solr\collection1\solrconfig.xml@b@2946 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer – Unable to create core: collection1@b@org.apache.solr.common.SolrException: Could not load config for solrconfig.xml@b@ at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:592)@b@ at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657)@b@ at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364)@b@ at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:262)@b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:262)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)@b@ at java.lang.Thread.run(Thread.java:745)@b@Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or 'solr\collection1\conf/', cwd=C:\..\xwood-solr@b@ at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:322)@b@ at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:287)@b@ at org.apache.solr.core.Config.<init>(Config.java:116)@b@ at org.apache.solr.core.Config.<init>(Config.java:86)@b@ at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:120)@b@ at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:589)@b@ ... 9 more@b@2960 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer – null:org.apache.solr.common.SolrException: Unable to create core: collection1@b@ at org.apache.solr.core.CoreContainer.recordAndThrow(CoreContainer.java:1150)@b@ at org.apache.solr.core.CoreContainer.create(CoreContainer.java:666)@b@ at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364)@b@ at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:262)@b@ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)@b@ at java.util.concurrent.FutureTask.run(FutureTask.java:262)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)@b@ at java.lang.Thread.run(Thread.java:745)@b@Caused by: org.apache.solr.common.SolrException: Could not load config for solrconfig.xml@b@ at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:592)@b@ at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657)@b@ ... 8 more@b@Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or 'solr\collection1\conf/', cwd=C:\..\xwood-solr@b@ at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:322)@b@ at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:287)@b@ at org.apache.solr.core.Config.<init>(Config.java:116)@b@ at org.apache.solr.core.Config.<init>(Config.java:86)@b@ at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:120)@b@ at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:589)@b@ ... 9 more@b@@b@2974 [main] INFO org.apache.solr.servlet.SolrDispatchFilter – user.dir=C:\..\xwood-solr@b@2975 [main] INFO org.apache.solr.servlet.SolrDispatchFilter – SolrDispatchFilter.init() done
二、解决方法
1. 如何在eclipse开发调试配置VM arguments(如:-Dsolr.solr.home=C:\project\xwood-project\xwood-solr\solr-md)
2. 如在测试生产部署环境,在JVM的缓存参数中配置"-Dsolr.solr.home=/home/app/tomcat7/bin/solr-md"(如下在linux的tomcat的catalina.sh中配置)
...@b@JAVA_OPTS="$JAVA_OPTS -server -Xms600m -Xmx600m -XX:MaxNewSize=256m -Dsolr.solr.home=/app/tomcat6/bin/solr-md"@b@..
3. 重启tomcat应用问题解决了