2012-08-13 25 views
0

我们有一台Nexus服务器,它一直运行良好,直到周五。 Nexus停止了,因为我们无法再次启动它,但我无法弄清楚为什么?Nexus/Jetty不想再开始了:未解决的地址

我认为这是一个码头问题。下面是叠层strace的:

jvm 1 | 2012-08-13 09:31:10 WARN [er_start_runner] - org.mortbay.log - failed [email protected]*:8080 
jvm 1 | java.net.SocketException: Unresolved address 
jvm 1 | at sun.nio.ch.Net.translateToSocketException(Net.java:58) 
jvm 1 | at sun.nio.ch.Net.translateException(Net.java:84) 
jvm 1 | at sun.nio.ch.Net.translateException(Net.java:90) 
jvm 1 | at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:61) 
jvm 1 | at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216) 

的构型是(的jetty.xml):

<Configure id="Server" class="org.mortbay.jetty.Server"> 
    <Call name="addConnector"> 
     <Arg> 
      <New class="org.mortbay.jetty.nio.SelectChannelConnector"> 
       <Set name="host">${application-host}</Set> 
       <Set name="port">${application-port}</Set> 
      </New> 
     </Arg> 
    </Call> 

    <Set name="handler"> 
     <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"> 
      <!-- The following configuration is REQUIRED, and MUST BE FIRST. 
       It makes the Plexus container available for use in the Nexus webapp. --> 
      <Call name="addLifeCycleListener"> 
       <Arg> 
       <New class="org.sonatype.plexus.jetty.custom.InjectExistingPlexusListener" /> 
       </Arg> 
      </Call> 

      <!-- The following configuration disables JSP taglib support, the validation of which 
       slows down Jetty's startup significantly. --> 
      <Call name="addLifeCycleListener"> 
       <Arg> 
       <New class="org.sonatype.plexus.jetty.custom.DisableTagLibsListener" /> 
       </Arg> 
      </Call> 
     </New> 
    </Set> 

    <New id="NexusWebAppContext" class="org.mortbay.jetty.webapp.WebAppContext"> 
     <Arg><Ref id="Contexts"/></Arg> 
     <Arg>${webapp}</Arg> 
     <Arg>${webapp-context-path}</Arg> 
     <Set name="extractWAR">false</Set> 
    </New> 

    <Set name="stopAtShutdown">true</Set> 
    <Set name="sendServerVersion">true</Set> 
    <Set name="sendDateHeader">true</Set> 
    <Set name="gracefulShutdown">1000</Set> 
</Configure> 

和plexus.properties:

application-port=8081 
application-host=0.0.0.0 
runtime=${basedir}/runtime 
apps=${runtime}/apps 
nexus-work=${basedir}/../../data/nexus/sonatype-work/nexus 
nexus-app=${runtime}/apps/nexus 
webapp=${runtime}/apps/nexus/webapp 
webapp-context-path=/nexus 
security-xml-file=${nexus-work}/conf/security.xml 
application-conf=${nexus-work}/conf 
runtime-tmp=${runtime}/tmp 

# If this file is present, it will be used to configure Jetty. 
jetty.xml=${basedir}/conf/jetty.xml 

# Uncomment this to use the debug js files 
#index.template.file=templates/index-debug.vm 

的Nexus版本1.9.2.3

我不明白: 为什么它要在端口8080启动一个连接器(虽然我只设置p ort 8081)和 什么意思是地址*(为什么不是0.0.0.0)?当然,为什么它不想再开始了?

非常感谢您的所有想法!

+0

如果jetty试图在8080上启动,那么jetty和nexus之间的粘连显然是有问题的,所以不是一个jetty问题。您可以用-DDEBUG = true启动它,以获取有关jetty是什么的更多信息如果有帮助的话。 – 2012-08-13 12:35:58

回答

1

解决!

jetty.xml文件只有'r'权限,这是不够的:它也必须具有'x'权限。所以Jetty无法读取文件jetty.xml,并在这种情况下,它试图启动'*:8080'=> *不可解析的默认连接器(我不知道他们为什么使用*而不是0.0.0.0? ??)

所以这是一个配置问题。

+1

肯定有其他的东西,否则它只是愚蠢的。此外它不起作用。 :P – 2013-10-04 09:17:57

+0

在我的情况下,问题是在.xml文件中,主机0.0.0.0显然被视为特定的接口,而不是“侦听所有接口”。把领域留空是个诀窍。 (所有这些都假定你已经擦掉了你的start.ini文件并使用了jetty 9.0 – 2013-10-04 12:17:04

0

我不能在8080 VS 8081的问题发表评论,但作为SocketException ...

的SocketException:无法解析的地址通常是由于某种存在于您的系统上的主机/ DNS /解决配置问题。

Java的最基本的测试用例,可以帮助识别问题将是以下

import java.net.InetAddress; 
import java.net.InetSocketAddress; 

public class AddrTest 
{ 
    public static void main(String[] args) 
    { 
     try 
     { 
      InetAddress addr = InetAddress.getByName("0.0.0.0"); 
      System.out.println("InetAddress => " + addr); 
      System.out.println("InetAddress.isAnyLocalAddress = " + addr.isAnyLocalAddress()); 
      System.out.println("InetAddress.isLinkLocalAddress = " + addr.isLinkLocalAddress()); 
      System.out.println("InetAddress.isLoopbackAddress = " + addr.isLoopbackAddress()); 

      InetSocketAddress isockaddr = new InetSocketAddress(addr,8080); 
      System.out.println("InetSocketAddr = " + isockaddr); 
      System.out.println("InetSocketAddr.isUnresolved = " + isockaddr.isUnresolved()); 
     } 
     catch (Throwable e) 
     { 
      e.printStackTrace(); 
     } 
    } 
} 

运行这一点,你应该有输出

InetAddress => /0.0.0.0 
InetAddress.isAnyLocalAddress = true 
InetAddress.isLinkLocalAddress = false 
InetAddress.isLoopbackAddress = false 
InetSocketAddr = /0.0.0.0:8080 
InetSocketAddr.isUnresolved = false 

要注意什么是重要的是2行...

  • InetAddress.isAnyLocalAddress = true - 表示java + OS报告这是任何地址
  • InetSocketAddr.isUnresolved = false - 意味着Java + OS能够如果此测试期间得到一个异常,那么你有某种根本性的主机解析问题的系统(DNS,DHCP上解决这个套接字地址

。 vpn,etc/hosts,没有IPv4可用,等等......),你在java,jetty或nexus中所做的任何事情都无法解决这类问题。您需要在操作系统/网络级别解决此问题(不是双关语)。

+0

我标记我的答案是接受的答案,因为它解决了我的问题。但是你的答案很好找,如果它工作正常或没有。 – 2012-08-22 13:02:45