spring boot服务迁移到2.1.3.RELEASEand后jdk11,出现hystrix流执行器相关异常。
例外是 ERROR org.apache.catalina.core.ContainerBase.[Tomcat-1].[localhost].[/].[hystrix.stream-actuator-endpoint] - Servlet.service() for servlet [hystrix.stream-actuator-endpoint] in context with path [] threw exception[]
Spring启动版本:2.1.3.RELEASE
Java 版本:11
公开所有执行器端点: management.endpoints.web.exposure.include=*
此外,hystrix.stream端点实际上已启用并提供流。尽管如此,日志中仍然会出现异常
堆栈跟踪:
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 …Run Code Online (Sandbox Code Playgroud) 我正在使用使用 Java 11 构建的微服务,该服务具有在 Java 8 中构建的依赖项。依赖项中有 rest-clients,并且有一种方法可以执行此操作:
public <T> ResponseEntity<my.company.Wrapper<T>> getForList(String url, HttpHeaders headers) {
try {
return template.exchange(url, GET, new HttpEntity<>(headers), new ParameterizedTypeReference<Wrapper<T>>() { });
} catch (RestClientException restEx) {
logger.error("RestClientException!, restEx: {}", restEx);
throw restEx;
}
}
Run Code Online (Sandbox Code Playgroud)
休息调用刚刚成功,
response -> <200,Wrapper [ elements = [{id=dbfc2557-1738-45e4-8ecd-235d35158957, .....
然后,在微服务(使用 Java 11)中,当它使用 java Stream 时有一点:
var found = enttsResponse.stream()
.map(MyCompanyResponse::getId)
.collect( toList() );
Run Code Online (Sandbox Code Playgroud)
异常消息是:
java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class com.mycompany.commons.v2.entitlement.MyCompanyResponse (java.util.LinkedHashMap is in module java.base of loader …Run Code Online (Sandbox Code Playgroud) 刚刚从Java 11迁移到Java 14
以下代码现在在 linux 机器上失败:
String linux_exe = System.getProperty("user.dir") + '/' + "fpcalc_arm32";
List<String> params = new ArrayList();
params.add(linux_exe);
params.add("-plain");
params.add("-length");
params.add(submittedSongLength);
params.add(file.getPath());
Process p = Runtime.getRuntime().exec(params.toArray(new String[1]));
Run Code Online (Sandbox Code Playgroud)
带堆栈跟踪
Cannot run program "/mnt/system/config/Apps/SongKong/songkong/fpcalc_arm32": error=0, Failed to exec spawn helper: pid: 13998, exit value: 127
java.io.IOException: Cannot run program "/mnt/system/config/Apps/SongKong/songkong/fpcalc_arm32": error=0, Failed to exec spawn helper: pid: 13998, exit value: 127
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at java.base/java.lang.Runtime.exec(Runtime.java:590)
at java.base/java.lang.Runtime.exec(Runtime.java:449)
at com.jthink.songkong.analyse.acoustid.AcoustId.generateFingerprint(AcoustId.java:217)
at com.jthink.songkong.analyse.acoustid.AcoustId.createAcoustIdFingerprint(AcoustId.java:106)
Run Code Online (Sandbox Code Playgroud)
Java 14 发生了什么变化会导致这种情况?
我使用 …
当我的 Java 程序与 Java 8 和 Java 11 一起运行时,我有一个非常奇怪的行为差异。
我正在使用 MSGraph API (1.7.0) 对 Onedrive API 进行多次调用。为了进行这些调用,我使用了 4 个并行线程来同步硬盘上的大量文件(大约 1000 个)。
当我使用 Java 8 执行程序时,我没有发现任何异常。当我使用 java 11 执行它时,我在大约 60% 的调用中收到了 Socket Timeout Exception。
要配置IGraphServiceClient,我使用的是默认配置。就我而言,在这种情况下,HTTP 提供程序是 OKHttp3。
有没有人经历过这样的事情?
[更新-1]
这些是我测试过的环境:
在此您有堆栈跟踪:
com.microsoft.graph.core.ClientException: Error during http request
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:422) ~[easybox-0.1-SNAPSHOT.jar:?]
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:204) ~[easybox-0.1-SNAPSHOT.jar:?]
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:184) ~[easybox-0.1-SNAPSHOT.jar:?]
at com.microsoft.graph.http.BaseStreamRequest.send(BaseStreamRequest.java:85) ~[easybox-0.1-SNAPSHOT.jar:?]
at com.microsoft.graph.requests.extensions.DriveItemStreamRequest.get(DriveItemStreamRequest.java:55) …Run Code Online (Sandbox Code Playgroud) 我已经搜索了高低,但仍然无法找到这个非常烦人的问题的简单答案,
我遵循了这个很棒的指南: 带有多服务应用程序的 JWT 一切都很好,但在指南的最后,我们建议创建一个 config-service(module) ,我已经完成了。
问题是我无法覆盖 JwtConfig 类的默认配置
项目结构如下:
-config-service
| JwtConfig.java
\
| resources
\
| jwtConfig.properties
-other-service (add dependency in the pom file of the config-service)
|
someOtherclass.java (import the JwtConfig class & using @Bean to initialize )
Run Code Online (Sandbox Code Playgroud)
JwtConfig 类:
/*all the imports*/
@PropertySource(value = "classpath:jwtConfig.properties")
public class JwtConfig {
@Value("${security.jwt.uri:/auth/**}")
private String Uri;
@Value("${security.jwt.header:Authorization}")
private String header;
@Value("${security.jwt.prefix:Bearer }")
private String prefix;
@Value("${security.jwt.expiration:#{24*60*60}}")
private int expiration;
@Value("${security.jwt.secret:JwtSecretKey}")
private String secret;
//getters
Run Code Online (Sandbox Code Playgroud)
someOtherclass.java:
/*imports*/
@Configuration
@EnableWebSecurity …Run Code Online (Sandbox Code Playgroud) maven multi-module spring-boot application.properties java-11
在 Java 11 中,JAX-WS 已从 JDK 中删除。它可以防止wsimport在引擎盖下使用 Maven 插件轻松生成 JAX-WS 类。我正在为 Maven 插件使用以下配置org.codehaus.mojo:jaxws-maven-plugin。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<extension>true</extension>
<packageName>tech.myproject.service</packageName>
<wsdlFiles>
<wsdlFile>${basedir}/src/main/resources/wsdl/service.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>/wsdl/service.wsdl</wsdlLocation>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
有没有一种简单的方法来安装 wsimport 或使用另一个插件捆绑特定架构的 wsimport 来继续生成 WSDL 类?
我试图每隔几分钟不断地向 REST API 发送 GET 和 POST 请求。问题是,在恰好 1000 个请求之后,我收到了一个GOAWAY帧(和一个IOException):
GOAWAY 帧(类型=0x7)用于启动连接关闭或发出严重错误情况的信号。
HTTP/2 规范
我做了一些研究,发现 1000 个请求不仅是nginx 的默认最大值,Cloudfront(相关的 Chromium 问题)和 Discord 也表现出相同的行为。
我尝试使用具有默认 HTTP/2 配置的本地 nginx 服务器重现此问题:
服务器 {
听 443 http2 ssl;
http2_max_requests 1000;
...
}
var client = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_2)
.build();
for (var i = 0; i < 1100; i++) {
var url = URI.create(String.format("https://localhost/images/test%d.jpg", i));
var request = HttpRequest.newBuilder().uri(url).build();
client.send(request, HttpResponse.BodyHandlers.discarding());
System.out.printf("Image %d processed%n", i);
}
Run Code Online (Sandbox Code Playgroud)
在大约 1000 个请求之后,我收到了 …
我试过这个
通过 wget 在 Linux 上下载 Java JDK 会显示许可证页面
但我不断收到 404 错误。
这个命令“sudo amazon-linux-extras install java-openjdk11”只是说明amazon-linux-extras不存在。
xmx == xms使用 G1 gc 在 java-11 中设置仍然是好习惯吗?
我在Web 应用程序的上下文中问这个问题。
我正在阅读有关在 Java 加密体系结构中实现提供程序的文档,它指出
您不能在 JMOD 文件中打包签名的提供程序
文章还指出:
只有提供 Cipher、KeyAgreement、KeyGenerator、Mac 或 SecretKFactory 实例的提供者必须被签名。如果您的提供者仅提供 SecureRandom、MessageDigest、Signature、KeyStore 等的实例,则不需要对提供者进行签名。
我正在尝试使用 JDK 11 版本开发此提供程序,该版本使用 .jmod 文件代替 .jar 文件。
我正在查看标准安全策略使用的函数 ,其中许多使用 Cipher、KeyAgreement、KeyGenerator、Mac 或 SecretKeyFactory,但在我使用的 JDK 11 中以某种方式打包成 .jmod 格式。
任何人都可以进一步解释这一点吗?
java-11 ×10
java ×8
java-8 ×2
maven ×2
spring-boot ×2
amazon-ec2 ×1
amazon-s3 ×1
heap-memory ×1
http2 ×1
hystrix ×1
java-14 ×1
jax-ws ×1
jvm ×1
multi-module ×1
okhttp ×1
performance ×1
wsdl ×1