通常的Eureka仪表盘类似:
但是我的显示为:
问题是,当以可执行文件运行时,相同的战争运行完全正常(spring-boot-maven-plugin既创建了可部署的战争,又可执行文件的战争),但是在 jBoss 6.4 EPA ,它将仪表板显示为xml(我将在下面详细介绍jBoss的属性文件中的差异)
这是 pom :
'tower_0/conv1_fullres/truncated_normal/shape',
'tower_0/conv1_fullres/truncated_normal/mean',
'tower_0/conv1_fullres/truncated_normal/stddev',
'tower_0/conv1_fullres/truncated_normal/TruncatedNormal',
'tower_0/conv1_fullres/truncated_normal/mul',
'tower_0/conv1_fullres/truncated_normal',
'tower_0/conv1_fullres/Const',
'tower_0/conv1_fullres/Conv2D',
'tower_0/conv1_fullres/add',
'tower_0/conv1_fullres/Relu',
'tower_0/conv1_fullres/BatchNorm/cond/Switch',
'tower_0/conv1_fullres/BatchNorm/cond/switch_t',
'tower_0/conv1_fullres/BatchNorm/cond/switch_f',
'tower_0/conv1_fullres/BatchNorm/cond/pred_id',
'tower_0/conv1_fullres/BatchNorm/cond/Const',
'tower_0/conv1_fullres/BatchNorm/cond/Const_1',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm/Switch',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm/Switch_1',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm/Switch_2',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm_1/Switch',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm_1/Switch_1',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm_1/Switch_2',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm_1/Switch_3',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm_1/Switch_4',
'tower_0/conv1_fullres/BatchNorm/cond/FusedBatchNorm_1',
'tower_0/conv1_fullres/BatchNorm/cond/Merge',
'tower_0/conv1_fullres/BatchNorm/cond/Merge_1',
'tower_0/conv1_fullres/BatchNorm/cond/Merge_2',
'tower_0/conv1_fullres/BatchNorm/cond_1/Switch',
'tower_0/conv1_fullres/BatchNorm/cond_1/switch_t',
'tower_0/conv1_fullres/BatchNorm/cond_1/switch_f',
'tower_0/conv1_fullres/BatchNorm/cond_1/pred_id',
'tower_0/conv1_fullres/BatchNorm/cond_1/Const',
'tower_0/conv1_fullres/BatchNorm/cond_1/Const_1',
'tower_0/conv1_fullres/BatchNorm/cond_1/Merge',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg/sub/x',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg/sub',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg/sub_1',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg/mul',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg_1/sub/x',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg_1/sub',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg_1/sub_1',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg_1/mul',
'tower_0/conv1_fullres/BatchNorm/AssignMovingAvg_1',
这是Application类:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mine.naming</groupId>
<artifactId>NamingServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>NamingServer</name>
<description>GRS 4.0 Naming Server</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Edgware.SR5</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
这是作为jar部署时使用的 application.properties :
package com.tcs.naming.UtxNamingServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class NamingServerApplication extends SpringBootServletInitializer{
public static void main(String[] args) {
SpringApplication.run(NamingServerApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(NamingServerApplication.class);
}
}
现在,需要进行一些更改才能在jBoss中部署战争(没有tomcat依赖项)。这是在jBoss中进行部署时的 application.properties 文件:
spring.application.name=naming-server
server.contextPath=/naming-server
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
这是 jboss-web.xml 文件:
spring.application.name=naming-server
server.servlet-path=/*
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
这是 jboss-deployment-structure.xml :
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/naming-server</context-root>
</jboss-web>
jax-rs 子系统被排除在外,因为否则我的Eureka中包含的Jersey实现与jBoss的RESTEasy实现之间存在jar冲突。上面的模块就位于其中,以使 application.properties 文件可用于该应用程序(并且我确认它已经被拾取)
答案 0 :(得分:0)
默认情况下,Eureka在类路径的.ftl
文件夹中搜索 freemarker(templates
)模板(用于创建仪表板页面)。由于在一个应用程序服务器上,可能有多个具有该文件夹的jar(并且它们不包含Eureka正在搜索的模板),所以会引发错误。
如here所述,解决方案是将以下属性添加到application.properties,以使Eureka不会在其他jar中搜索templates
文件夹
spring.freemarker.prefer-file-system-access=false