小编kos*_*spi的帖子

为什么 WsSessionListener.sessionCreated() 在嵌入的 tomcat 9 中发出 `AbstractMethodError`?

我将 springboot 2.1.2.RELEASE 用于包含嵌入 tomcat 9 版本的 Web 应用程序。

创建新会话时,它AbstractMethodError: null在下面的行中发出异常

https://github.com/apache/tomcat/blob/trunk/java/org/apache/catalina/session/StandardSession.java#L388

有问题的侦听器是 WsSessionListener

从 tomcat 9 开始,WsSessionListener去掉 sessionCreated() 实现,它只是调用了父接口的默认 sessionCreated() 方法HttpSessionListener。这似乎根本不是问题。(tomcat-embed-core, tomcat-embed-websocket 同版本 9.0.14)


WsSessionListener在 tomcat9 中:https : //github.com/apache/tomcat/blob/trunk/java/org/apache/tomcat/websocket/server/WsSessionListener.java#L22

HttpSessionListener在 tomcat9 中:https : //github.com/apache/tomcat/blob/trunk/java/javax/servlet/http/HttpSessionListener.java#L30


WsSessionListener在 tomcat8 中:https : //github.com/apache/tomcat/blob/TOMCAT_8_0_0/java/org/apache/tomcat/websocket/server/WsSessionListener.java#L22

HttpSessionListener在 tomcat8 中:https : //github.com/apache/tomcat/blob/TOMCAT_8_0_0/java/javax/servlet/http/HttpSessionListener.java#L30


当我使用 tomcat 8(springboot 2.0.x) 时,不会出现所有问题。有没有人知道这个?请给我一些帮助或推荐...

提前致谢。

java.lang.AbstractMethodError: null
    at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:388)
    at org.apache.catalina.session.StandardSession.setId(StandardSession.java:360)
    at org.apache.catalina.session.StandardSession.setId(StandardSession.java:341)
    at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:686)
    at org.apache.catalina.connector.Request.doGetSession(Request.java:3018)
    at org.apache.catalina.connector.Request.getSession(Request.java:2416)
    at …
Run Code Online (Sandbox Code Playgroud)

tomcat

7
推荐指数
2
解决办法
5307
查看次数

为什么使用外部tomcat运行spring boot项目时没有调用main方法

我在这篇文章之后做了可部署的战争。

https://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html

然后,使用外部tomcat运行。

为什么使用外部tomcat运行时没有调用main方法?(但过程运行良好)

@SpringBootApplication
public class Application extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(Application.class, args);
    }

}
Run Code Online (Sandbox Code Playgroud)

我用java -jar xxx.war运行,这个main方法已经调用好了。

我有什么遗漏的吗?

spring spring-boot

6
推荐指数
1
解决办法
1643
查看次数

当在 checkPermission 方法中加载某个类时,为什么 SecurityManager 会发出递归更新异常?

我正在将 jdk 8 升级到 11。

我在checkPermission方法中加载了一些类,然后安全管理器发出recursive update异常。但使用jdk1.8.0_202一切正常。

是什么导致了这个问题?

  1. 我的环境。
OS: macOS 10.15.6
JDK(Oracle): 11.0.8
IDE: Intellij 2019 3
Run Code Online (Sandbox Code Playgroud)
  1. 主要的
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world");
    }
}
Run Code Online (Sandbox Code Playgroud)
  1. 安全管理器
package sm;

import java.security.Permission;

public class MySecurityManager extends SecurityManager {

    @Override
    public void checkPermission(Permission permission) {

        // Problem occurs when load ServicePermission.class
        if (permission instanceof javax.security.auth.kerberos.ServicePermission) {
            // throw new SecurityException("javax.security.auth.kerberos.ServicePermission is not allowed.");
        }
    }

    @Override
    public void checkPermission(Permission …
Run Code Online (Sandbox Code Playgroud)

java securitymanager java-security-manager java-11

4
推荐指数
1
解决办法
146
查看次数

Java`非法访问操作`方法将被弃用?

在 JDK 9+ JVM 之后,如果您使用一些非法访问,例如setAccessible().

我的问题

  1. 以后setAccessible()会不会被封?
  2. 此功能的官方参考(如果将被弃用)在哪里?

我在任何地方都找不到参考,提前致谢。

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.hazelcast.internal.networking.nio.SelectorOptimizer (file:/var/folders/9w/wp9vfqmn2ql0mp3lgym0bxf40000gn/T/toy.war-spring-boot-libs-0024b388-730f-430b-b21b-1611bd2ad612/hazelcast-4.0.2.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of com.hazelcast.internal.networking.nio.SelectorOptimizer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Run Code Online (Sandbox Code Playgroud)

java reflection java-11

4
推荐指数
1
解决办法
1790
查看次数