在spring boot服务迁移到2.1.3.release
和JDK11
之后,发生了与hystrix流执行器相关的异常。
异常为错误org.apache.catalina.core.containerbase。[Tomcat-1].[localhost].[/].[hystrix.stream-acture-endpoint]-servlet.service()在路径为[]的上下文中的servlet[hystrix.stream-acture-endpoint]抛出异常[]
Spring Boot版本:2.1.3.发行版
Java版本:11
所有执行器endpoint均公开:management.endpoints.web.exposure.include=*
java.nio.BufferOverflowException
at java.base/java.nio.DirectByteBuffer.put(DirectByteBuffer.java:410)
at java.base/java.nio.DirectByteBuffer.put(DirectByteBuffer.java:389)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:74)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:105)
at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:144)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1223)
at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:743)
at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:696)
at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:686)
at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:553)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157)
at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:216)
at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1149)
at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:394)
at org.apache.coyote.Response.action(Response.java:209)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:295)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:262)
at org.apache.catalina.connector.CoyoteWriter.flush(CoyoteWriter.java:94)
at org.apache.catalina.connector.CoyoteWriter.checkError(CoyoteWriter.java:119)
at com.netflix.hystrix.contrib.sample.stream.HystrixSampleSseServlet.handleRequest(HystrixSampleSseServlet.java:165)
at com.netflix.hystrix.contrib.sample.stream.HystrixSampleSseServlet.doGet(HystrixSampleSseServlet.java:74)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
和一个相似的
java.lang.IllegalArgumentException: newPosition > limit: (3850 > 532)
at java.base/java.nio.Buffer.createPositionException(Buffer.java:318)
at java.base/java.nio.Buffer.position(Buffer.java:293)
at java.base/java.nio.ByteBuffer.position(ByteBuffer.java:1086)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:82)
at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:105)
at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:144)
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1223)
at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:743)
at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:696)
at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:686)
at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:553)
at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157)
at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:216)
at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1149)
at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:394)
at org.apache.coyote.Response.action(Response.java:209)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:295)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:262)
at org.apache.catalina.connector.CoyoteWriter.flush(CoyoteWriter.java:94)
at com.netflix.hystrix.contrib.sample.stream.HystrixSampleSseServlet.handleRequest(HystrixSampleSseServlet.java:168)
at com.netflix.hystrix.contrib.sample.stream.HystrixSampleSseServlet.doGet(HystrixSampleSseServlet.java:74)
运行最小配置时,我无法再现问题,我尝试将版本从2.1.3版切换到2.2.2版;没问题。所以我想你应该在这里给出更多的细节。在哪里执行应用程序?嵌入式tomcat、外部tomcat、Docker?请尽量给出更多的细节。
总之,这是我的测试配置。
pom.xml
<?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 https://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>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.robman</groupId>
<artifactId>demohystrix</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demohystrix</name>
<description>Demo project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<spring-cloud.version>Greenwich.SR3</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</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>
应用程序.属性
management.endpoints.web.exposure.include=*
DemoHystrixApplication.java
@SpringBootApplication
@EnableHystrix
@RestController
public class DemoHystrixApplication {
public static void main(String[] args) {
SpringApplication.run(DemoHystrixApplication.class, args);
}
@RequestMapping(value = "/")
@HystrixCommand(fallbackMethod = "fallback", commandProperties = {
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "1000")
})
public String hello() throws InterruptedException {
Thread.sleep(3000);
return "HELLO Hystrix";
}
private String fallback() {
return "Fallback";
}
}
如果您使用的是Eureka服务器:
官方文档说
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
我有一个BE服务a,它正在使用假客户端向microservice B发送Rest JSON消息: 终点: Rest Endpoint正在向AWS Ses邮件或其他邮件提供商发送邮件。 问题是来自飞格的第一个呼叫可能需要5秒或更长时间。我需要使其异步,以便FE客户端不要等待邮件发送。 我如何可以使从飞度异步发出的Rest调用到超文本传输协议响应OK没有等待时间可以预期?是否有一些更好的解决方案来实现
我正在将本地netty服务器连接到远程https服务器以代理请求。 下面是我如何创建ssLcontext bean 当我点击我的本地主机时,它应该代理到后端。我得到以下异常。但是,如果SSL关闭并且我连接到远程,这是在不同端口上运行的本地服务器,则工作正常 编辑 添加的日志
17.1 编写服务启动入口 package com.clsaa.edu.springboot; import com.clsaa.edu.springboot.bean.Product; import com.clsaa.edu.springboot.mapper.ProductMapper; import org.springframework.boot.SpringApplicati
在单体架构时,因为服务不会经常和动态迁移,所有服务地址可以直接在配置文件中配置,所以也不会有服务发现的问题。但是对于微服务来说,应用的拆分,服务之间的解耦,和服务动态扩展带来的服务迁移,服务发现就成了微服务中的一个关键问题。 服务发现分为客户端服务发现和服务端服务发现两种,架构如下图所示。 这两种架构都各有利弊,我们拿客户端服务发现软件Eureka和服务端服务发现架构Kubernetes/SkyD
背景 当前有两个服务,分别是user-service和order-service,nacos服务列表中无法发现两个服务 排查 Nacos v2.2.3 依赖已引入,配置文件已配置addr 运行时未出现连接nacos的日志: 希望大佬们可以帮忙看看是什么问题 问题程序链接 https://oss-20001.oss-cn-qingdao.aliyuncs.com/cloud-demo.zip
我已经发布了带有endpoint的JAX-WSWeb服务。在开发过程中发布。是否存在(JAX-RS中)用于在jersey中发布RESTWeb服务的此类实用程序类?我参考了几篇文章,其中大部分都是基于在一些容器中发布web服务,如Jetty、Grizzly等。