我正在尝试在Spring Boot网站上调整REST控制器示例.不幸的是,当我尝试访问localhost:8080/itemURL 时,我遇到以下错误.
{
"timestamp": 1436442596410,
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/item"
}
Run Code Online (Sandbox Code Playgroud)
POM:
<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>
<groupId>SpringBootTest</groupId>
<artifactId>SpringBootTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<javaVersion>1.8</javaVersion>
<mainClassPackage>com.nice.application</mainClassPackage>
<mainClass>${mainClassPackage}.InventoryApp</mainClass>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${javaVersion}</source>
<target>${javaVersion}</target>
</configuration>
</plugin>
<!-- Makes the Spring Boot app executable for a jar file. The additional configuration is needed for the cmd: mvn spring-boot:repackage
OR mvn spring-boot:run -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${mainClass}</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals> …Run Code Online (Sandbox Code Playgroud) 使用STS,如果我"Rest Service"使用最新的Spring Boot 导入Getting Started项目并选择"Run As Spring Boot App",它会启动,然后立即关闭.
查看调试日志,Spring出于某种原因决定该项目不是Web应用程序,但我不知道为什么.
如果我从Spring Boot切换1.1.1.RELEASE到1.0.1.RELEASE,项目按预期工作,并找到默认的Tomcat嵌入式服务器.
我在1.1.1发行说明中找不到任何暗示存在配置更改或其他内容的内容?
更新:重现和记录输出的步骤
我正在运行STS 3.6.0.M1和Spring 4.0.5以及Spring Boot 1.1.1.通过执行以下操作,我可以轻松地重现这一点:
这是输出:
:: Spring Boot :: (v1.1.1.RELEASE)
2014-06-14 11:08:34.226 INFO 47728 --- [ main] hello.Application : Starting Application on localhost with PID 47728 (/Users/pdrummond/src/sts/gs-rest-service-complete/target/classes started by pdrummond in /Users/pdrummond/src/sts/gs-rest-service-complete)
2014-06-14 11:08:34.257 INFO 47728 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@802b249: startup date [Sat Jun 14 11:08:34 …Run Code Online (Sandbox Code Playgroud)当前,我正在尝试通过创建Helm图表在Kubernetes集群上部署微服务端点Docker映像。为此,我创建了图表并更改了values.yaml和deployment.yaml中的参数以进行端口更改。我也想从Angular前端访问。因此,我添加了服务类型= NodePort。当我描述服务时,它给了我30983访问的端口。
我像http:// node-ip:30983 / endpoint一样访问
但我只是得到无法访问该网站的消息。让我添加我在这里所做的详细信息:
我的values.yaml文件包含以下提到的服务类型:
和我的template / service.yaml文件包含如下内容:
而我的template / deployment.yaml文件包含以下内容:
我尝试访问如下内容:
而且只能到达站点。
注意:当我尝试描述服务时,会得到以下信息:
kubectl的输出获取pod --show-labels,如下图所示。
更新
当我们使用kubectl describe pod命令时,将如下所示:
更新错误
Readiness probe failed: HTTP probe failed with statuscode: 404
Liveness probe failed: HTTP probe failed with statuscode: 404
Run Code Online (Sandbox Code Playgroud)
如何从部署访问端点?
我正在尝试构建一个简单的SpringBoot应用程序.当我运行我的spring启动应用程序时,它在启动后立即关闭,下面是控制台日志:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.1.BUILD-SNAPSHOT)
2016-09-06 18:02:35.152 INFO 22216 --- [ main] com.example.SpringBootDemo1Application : Starting SpringBootDemo1Application on IN-FMCN882 with …Run Code Online (Sandbox Code Playgroud) 我使用它来构建它mvn clean package并获取一个xxx.jar文件.跑$java -jar xxx.jar >> output.log &开始吧,效果很好.
但大约两个小时后,它关机,为什么?这是一个答案,但不适合我>> /sf/answers/1568675881/
这是我的output.log:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.1.9.RELEASE) …Run Code Online (Sandbox Code Playgroud) 我正在尝试将客户端注册到 spring-eureka-server,客户端在注册后立即注销
尤里卡服务器日志:
2018-05-13 16:02:47.290 INFO 25557 --- [io-9091-exec-10] cneregistry.AbstractInstanceRegistry:注册实例 HELLO-CLIENT/192.168.43.96:hello-client:8072(状态为 false) ) 2018-05-13 16:02:47.438 INFO 25557 --- [nio-9091-exec-3] cneregistry.AbstractInstanceRegistry : 注册实例 HELLO-CLIENT/192.168.43.96:hello-client status:8072 (DOWNreplication=DOWNreplication) false) 2018-05-13 16:02:47.457 INFO 25557 --- [nio-9091-exec-2] cneregistry.AbstractInstanceRegistry:取消实例 HELLO-CLIENT/192.168.43.96:hello-client:8072 2018-05-13 16:02:47.950 INFO 25557 --- [nio-9091-exec-5] cneregistry.AbstractInstanceRegistry :注册实例 HELLO-CLIENT/192.168.43.96:hello-client:8072,状态为真) 2018-05-13 16:02:47。951 INFO 25557 --- [nio-9091-exec-5] cneregistry.AbstractInstanceRegistry : 取消实例 HELLO-CLIENT/192.168.43.96:hello-client:8072 (replication=true) 2018-05-13:256.703 25557 --- [a-EvictionTimer] cneregistry.AbstractInstanceRegistry:以 4ms 的补偿时间运行驱逐任务
尤里卡客户端日志:
2018-05-13 16:02:47.163 INFO 25676 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072: registering service... -13 16:02:47.212 信息 25676 --- [
main] …
我使用 启动我的 Spring Boot webapp java -jar xxx.jar,但在运行一段时间后,该应用程序自行关闭。这是 --debug 日志
22:55:36.187 [http-nio-7082-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
22:55:36.187 [http-nio-7082-exec-10] DEBUG o.s.b.c.w.OrderedRequestContextFilter - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@40d2cb04
01:06:52.227 [Thread-4] INFO o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@633761b6: startup date [Tue Mar 08 22:54:54 CST 2016]; root of context hierarchy
01:06:52.229 [Thread-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
01:06:52.229 [Thread-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2db493c7: defining beans [......]; root of factory hierarchy
01:06:52.234 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter …Run Code Online (Sandbox Code Playgroud)