将Jetty绑定到IPv6地址 [英] Bind Jetty to IPv6 address

查看:663
本文介绍了将Jetty绑定到IPv6地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Jetty绑定为仅侦听IPv6地址.我正在使用Jetty 7.4.2.v20110526.

I am trying to bind Jetty to listen only to IPv6 address. I am using Jetty 7.4.2.v20110526.

我的jetty.xml:

my jetty.xml:

<Call name="addConnector">
  <Arg>
      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <Set name="host">::1</Set>
        <Set name="port"><SystemProperty name="jetty.port" default="8070"/></Set>
        <Set name="maxIdleTime">30000</Set>
        <Set name="Acceptors">2</Set>
        <Set name="confidentialPort">8443</Set>
      </New>
  </Arg>
</Call>    

我得到的错误:

java.net.SocketException@3d3c4c09: Address family not supported by protocol family: bind; 
at sun.nio.ch.Net.bind(Native Method)
java.net.SocketException: Address family not supported by protocol family: bind
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:172)
at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:297)
at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:250)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
at org.eclipse.jetty.server.Server.doStart(Server.java:269)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)

我尝试了::1[::1]

如何将Jetty绑定到IPv6地址? Jetty完全支持IPv6吗?

How can I bind Jetty to IPv6 address? Is IPv6 supported by Jetty at all?

推荐答案

如果您还没有找到解决方案,请按此处.用IO之一更改NIO连接器.代替使用" org.mortbay.jetty.nio.SelectChannelConnector ",使用" org.mortbay.jetty.bio.SocketConnector ",整个连接器配置将为:

If you haven't found a solution, here it is. Change the NIO connector with the IO one. Instead of using "org.mortbay.jetty.nio.SelectChannelConnector" use "org.mortbay.jetty.bio.SocketConnector" and the overall connector config will be:

<Call name="addConnector">
  <Arg>
      <New class="org.mortbay.jetty.bio.SocketConnector">
        <Set name="port"><SystemProperty name="jetty.port" default="8070"/></Set>
        <Set name="maxIdleTime">50000</Set>
        <Set name="lowResourceMaxIdleTime">1500</Set>
      </New>
  </Arg>
</Call>

这样,您将可以使用IPv4和IPv6地址访问网页.希望这会有所帮助.

This way you will be able to access the webpage using both IPv4 and IPv6 address. Hope this helps.

这篇关于将Jetty绑定到IPv6地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆