1. 程式人生 > >solr-7.4.0 啟動報錯 已解決

solr-7.4.0 啟動報錯 已解決

版本:solr-7.4.0

solr常用命令:

solr start –p 埠號 單機版啟動solr服務

solr restart –p 埠號 重啟solr服務

solr stop –p 埠號關閉solr服務

solr create –c name 建立一個core例項

我在使用啟動命令時,出現錯誤(文末是解決方法):

D:\tongjiao\Solr\solr-7.4.0> bin/solr start -p 8899

PS D:\tongjiao\Solr\solr-7.4.0> bin/solr start -p 8899
ERROR StatusLogger Unable to access file:/D:/tongjiao/Solr/solr-7.4.0/server/file:D:/tongjiao/Solr/solr-7.4.0/server/scripts/cloud-scripts/log4j2.xml
 java.io.FileNotFoundException: D:\tongjiao\Solr\solr-7.4.0\server\file:D:\tongjiao\Solr\solr-7.4.0\server\scripts\cloud-scripts\log4j2.xml (檔名、目錄名或卷標語法不正確。)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at java.net.URL.openStream(URL.java:1038)
        at org.apache.logging.log4j.core.config.ConfigurationSource.fromUri(ConfigurationSource.java:247)
        at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:404)
        at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:346)
        at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:260)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:615)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
        at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
        at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:121)
        at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
        at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
        at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
        at org.apache.solr.util.SolrCLI.<clinit>(SolrCLI.java:228)
INFO  - 2018-09-21 17:31:08.467; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
Waiting up to 30 to see Solr running on port 8899
ERROR StatusLogger Unable to access file:/D:/tongjiao/Solr/solr-7.4.0/server/file:D:/tongjiao/Solr/solr-7.4.0/server/resources/log4j2.xml
 java.io.FileNotFoundException: D:\tongjiao\Solr\solr-7.4.0\server\file:D:\tongjiao\Solr\solr-7.4.0\server\resources\log4j2.xml (檔名、目錄名或卷標語法不正確。)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at java.net.URL.openStream(URL.java:1038)
        at org.apache.logging.log4j.core.config.ConfigurationSource.fromUri(ConfigurationSource.java:247)
        at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:404)
        at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:346)
        at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:260)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:615)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:636)
        at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:231)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:153)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
        at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:121)
        at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
        at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
        at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
        at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:38)
        at org.eclipse.jetty.util.log.Slf4jLog.<init>(Slf4jLog.java:32)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
        at org.eclipse.jetty.util.log.Log.initialized(Log.java:178)
        at org.eclipse.jetty.util.log.Log.getLogger(Log.java:311)
        at org.eclipse.jetty.util.log.Log.getLogger(Log.java:301)
        at org.eclipse.jetty.xml.XmlConfiguration.<clinit>(XmlConfiguration.java:80)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:220)
        at org.eclipse.jetty.start.Main.start(Main.java:486)
        at org.eclipse.jetty.start.Main.main(Main.java:77)
Started Solr server on port 8899. Happy searching!
PS D:\tongjiao\Solr\solr-7.4.0>

原因: log4j的bug, solr.cmd 批處理沒弄好;

解決辦法:將solr-7.4.0/bin/solr.cmd檔案裡面的所有file: 改成file:/// 就可以了