我们有一台Nexus服务器,直到星期五工作正常。 Nexus被停止,因为我们无法重新开始,但我无法弄明白为什么?
我认为这是一个码头问题。这是堆栈strace:
jvm 1 | 2012-08-13 09:31:10 WARN [er_start_runner] - org.mortbay.log - failed SelectChannelConnector@*: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启动连接器(而我只设置端口8081)和 什么意思是地址*(为什么不是0.0.0.0)?当然为什么它不想再开始呢?
非常感谢您的所有想法!
答案 0 :(得分:2)
我无法对8080 vs 8081问题发表评论,但对于SocketException ...
SocketException:未解析的地址通常是由于您系统上存在某种host / dns / resolve配置问题。
可能有助于识别问题的最基本的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可以解决这类问题。您需要在操作系统/网络级别解决此问题(无双关语)。
答案 1 :(得分:0)
我有一个类似的问题。 Jetty在docker容器中运行(jetty:9.3.24-jre8)。您需要在start.ini中注释掉有关http.host的行:
#jetty.http.host='0.0.0.0'
网络接口由于某种原因混杂在一起。
答案 2 :(得分:-1)
解决!
文件jetty.xml只有'r'权限,这是不够的:它也必须具有'x'权限。因此Jetty无法读取文件jetty.xml,在这种情况下,它尝试在'*:8080'=&gt;上启动默认连接器*不可解析(我不知道他们为什么用*而不是0.0.0.0 ???)
所以这是一个配置问题。