我正在使用 jboss eap 6.0.1,我们有 2 台服务器,每台服务器有 2 个节点。我正在尝试使用对故障排除有用的实用程序类来获取节点名称。我创建了以下 ServerUtil.java 类
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.faces.bean.ViewScoped;
import javax.inject.Named;
@ViewScoped
@Named
public class ServerUtil {
String jbossNodeName;
public String getJbossNodeName() {
try {
jbossNodeName = System.getProperty("jboss.node.name");
return jbossNodeName != null ? jbossNodeName : InetAddress.getLocalHost().getHostName();
enter code here
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
}
}
我在 layout.xhtml 的页脚部分调用这个实用程序类
<footer>
<p:toolbar style="border-style:none;background-color:White;background-image:none;">
<p:toolbarGroup align="left">
<h:outputText value="CONFIDENTIAL: INTERNAL USE ONLY." />
<br />
<h:outputText value="Release: ${project.version}" />
<h:outputText value="Server: ${serverUtil.jbossNodeName}" />
</p:toolbarGroup>
<p:toolbarGroup align="right">
<a>Advanced Search</a>
<h:outputText value=" | " />
<a>Help</a>
</p:toolbarGroup>
</p:toolbar>
</footer>
当我尝试构建 maven 项目时,我在服务器日志中看到以下错误消息
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:deploy (default-cli) on project smith-crm-web: Could not execute goal deploy on C:\Users\rpalle\workspace\CRM\smith-crm-web\target\crm.war. Reason: I/O Error could not execute operation '{
[ERROR] "address" => [],
[ERROR] "operation" => "read-attribute",
[ERROR] "name" => "launch-type"
[ERROR] }': java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :smith-crm-web