简体   繁体   English

在Mac OS X上无法加载太阳黑子轨道

[英]Sunspot Rails Can't Load on Mac OS X

I'm not sure what changed, but solr will not start on my machine. 我不确定是什么改变了,但solr不能在我的机器上启动。 I get the following error... 我收到以下错误...

❯ bundle exec rake sunspot:solr:run
2017-04-06 08:47:48.624:INFO:oejs.Server:jetty-8.1.8.v20121106
2017-04-06 08:47:48.646:INFO:oejdp.ScanningAppProvider:Deployment monitor /Users/noahc/.rvm/gems/ruby-2.3.3@mbcapp/gems/sunspot_solr-2.2.0/solr/contexts at interval 0
2017-04-06 08:47:48.654:INFO:oejd.DeploymentManager:Deployable added: /Users/noahc/.rvm/gems/ruby-2.3.3@mbcapp/gems/sunspot_solr-2.2.0/solr/contexts/solr.xml
2017-04-06 08:47:48.723:INFO:oejw.WebInfConfiguration:Extract jar:file:/Users/noahc/.rvm/gems/ruby-2.3.3@mbcapp/gems/sunspot_solr-2.2.0/solr/webapps/solr.war!/ to /private/var/folders/cv/259q741957qc1v7qnf5v4kfm0000gn/T/jetty-0.0.0.0-443-
solr.war-_solr-any-/webapp
2017-04-06 08:47:49.653:INFO:oejw.StandardDescriptorProcessor:NO JSP Support for /solr, did not find org.apache.jasper.servlet.JspServlet
Null identity service, trying login service: null
Finding identity service: null
2017-04-06 08:47:49.679:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/solr,file:/private/var/folders/cv/259q741957qc1v7qnf5v4kfm0000gn/T/jetty-0.0.0.0-443-solr.war-_solr-any-/webapp/},/Users/noahc/.rvm/gems/ruby-2.3.3@mbcapp/ge
ms/sunspot_solr-2.2.0/solr/webapps/solr.war
2017-04-06 08:47:49.680:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/solr,file:/private/var/folders/cv/259q741957qc1v7qnf5v4kfm0000gn/T/jetty-0.0.0.0-443-solr.war-_solr-any-/webapp/},/Users/noahc/.rvm/gems/ruby-2.3.3@mbcapp/ge
ms/sunspot_solr-2.2.0/solr/webapps/solr.war
2017-04-06 08:48:06.041:WARN:oejuc.AbstractLifeCycle:FAILED SocketConnector@0.0.0.0:443: java.net.BindException: Permission denied (Bind failed)
java.net.BindException: Permission denied (Bind failed)
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.ServerSocket.bind(ServerSocket.java:375)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at java.net.ServerSocket.<init>(ServerSocket.java:181)
        at org.eclipse.jetty.server.bio.SocketConnector.newServerSocket(SocketConnector.java:96)
        at org.eclipse.jetty.server.bio.SocketConnector.open(SocketConnector.java:85)
        at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
        at org.eclipse.jetty.server.bio.SocketConnector.doStart(SocketConnector.java:156)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
        at org.eclipse.jetty.server.Server.doStart(Server.java:288)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1266)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1189)
        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:498)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:472)
        at org.eclipse.jetty.start.Main.start(Main.java:620)
        at org.eclipse.jetty.start.Main.main(Main.java:95)
2017-04-06 08:48:06.043:WARN:oejuc.AbstractLifeCycle:FAILED org.eclipse.jetty.server.Server@5d7148e2: java.net.BindException: Permission denied (Bind failed)
java.net.BindException: Permission denied (Bind failed)
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.ServerSocket.bind(ServerSocket.java:375)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at java.net.ServerSocket.<init>(ServerSocket.java:181)
        at org.eclipse.jetty.server.bio.SocketConnector.newServerSocket(SocketConnector.java:96)
        at org.eclipse.jetty.server.bio.SocketConnector.open(SocketConnector.java:85)
        at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
        at org.eclipse.jetty.server.bio.SocketConnector.doStart(SocketConnector.java:156)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
        at org.eclipse.jetty.server.Server.doStart(Server.java:288)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1266)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1189)
       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:498)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:472)
        at org.eclipse.jetty.start.Main.start(Main.java:620)
        at org.eclipse.jetty.start.Main.main(Main.java:95)
java.lang.reflect.InvocationTargetException
        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:498)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:472)
        at org.eclipse.jetty.start.Main.start(Main.java:620)
        at org.eclipse.jetty.start.Main.main(Main.java:95)
Caused by: java.net.BindException: Permission denied (Bind failed)
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.ServerSocket.bind(ServerSocket.java:375)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at java.net.ServerSocket.<init>(ServerSocket.java:181)
        at org.eclipse.jetty.server.bio.SocketConnector.newServerSocket(SocketConnector.java:96)
        at org.eclipse.jetty.server.bio.SocketConnector.open(SocketConnector.java:85)
        at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
        at org.eclipse.jetty.server.bio.SocketConnector.doStart(SocketConnector.java:156)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
        at org.eclipse.jetty.server.Server.doStart(Server.java:288)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1266)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1189)
        ... 7 more

Usage: java -jar start.jar [options] [properties] [configs]
       java -jar start.jar --help  # for more information

I can use brew and install solr and get it to run and access an admin page like http://localhost:8981/solr/#/~logging , but I can't get my rails app and cucumber in particular to use that brew install version. 我可以使用brew并安装solr并让它运行并访问管理页面,如http:// localhost:8981 / solr /#/ ~logging ,但我无法获得我的rails应用程序和黄瓜特别是使用该brew install版本。 Nor can I get the bundle exec rake sunspot:solr:run command to work, which works for everyone else on the team. 我也无法获得bundle exec rake sunspot:solr:run命令工作,这适用于团队中的其他人。

EDIT: 编辑:

sunspot.yml sunspot.yml

development:
  solr:
    hostname: localhost
    port: 8982
    log_level: INFO
    min_memory: 512M
    max_memory: 1G
    path: /solr/development

test:
  solr:
    hostname: localhost
    port: 8981
    log_level: WARNING
    path: /solr/test

solr.xml solr.xml

<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="false">
  <cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:}">
    <core name="default"     instanceDir="." dataDir="default/data"/>
    <core name="development" instanceDir="." dataDir="development/data"/>
    <core name="test"        instanceDir="." dataDir="test/data"/>
  </cores>
</solr>

Try to give permissions for /solr directory 尝试为/solr目录授予权限

chown -R $USER /solr

Explanation: 说明:

  • Permission denied (Bind failed) is typical error which raises when an application doesn't have enough permissions to run. Permission denied (Bind failed)是典型错误,当应用程序没有足够的权限运行时会引发错误。

  • /solr directory has permissions only for root user (in most cases for sure) /solr目录仅对root用户具有权限(在大多数情况下肯定)

  • Current user is /Users/noahc which is not root user 当前用户是/Users/noahc ,它不是root用户

Thus I understand that the current user doesn't have enough permission to run the application. 因此,我了解当前用户没有足够的权限来运行该应用程序。

  1. Verify you are running the solr folder that you expect by setting an absolute path for your SOLR_HOME=/Users/rposborne/code/my-project/solr/conf your path my be different (this is how I tell my brew install to run in the source controlled solr config in my project) 通过为SOLR_HOME=/Users/rposborne/code/my-project/solr/conf设置绝对路径验证您正在运行期望的solr文件夹SOLR_HOME=/Users/rposborne/code/my-project/solr/conf 路径是不同的 (这就是我告诉我的brew安装运行的方式)我项目中的源控制solr配置)
  2. Verify that you do not have any JETTY_ARGS if you do this could be setting the port to 443 and causing the permission errors. 如果这样做,请确认您没有任何JETTY_ARGS ,可能是将端口设置为443并导致权限错误。
  3. Update your solr.xml . 更新solr.xml The posted xml config appears dated. 发布的xml配置显示为日期。 Make sure you are using a solr config for your version of solr. 确保您使用solr配置为您的solr版本。 https://github.com/sunspot/sunspot/blob/master/sunspot_solr/solr/solr/solr.xml https://github.com/sunspot/sunspot/blob/master/sunspot_solr/solr/solr/solr.xml

Perspective 透视

It looks like the bundle exec rake sunspot:solr:run is trying to run on port 443, which is a protected port, hence the "permission denied". 看起来像bundle exec rake sunspot:solr:run试图在端口443上运行,这是一个受保护的端口,因此“权限被拒绝”。 You should verify the port that is set in your config/sunspot.yml is set to the port that you are expecting maybe 8981 . 您应该验证config/sunspot.yml中设置的端口是否设置为您期望的端口8981

Personally, I don't use the helper provided by sunspot as it adds a layer of abstraction that I'll eventually have to deal with in production. 就个人而言,我不使用太阳黑子提供的帮助,因为它增加了一层抽象,我最终将不得不在生产中处理。

To point sunspot at other installs you can configure it in a handful of different ways. 要在其他安装中指向太阳黑子,您可以通过几种不同的方式对其进行配置。

  1. ENV variables: Set the environment variable SOLR_URL which sunspot will take consider first. ENV变量:设置太阳黑子首先考虑的环境变量SOLR_URL。 SOLR_URL=http://localhost:8981/solr/your-collection-name/
  2. config/sunspot.yml which is modeled after config/database.yml config/sunspot.yml ,它以config/database.yml为模型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM