将SpringBoot Jooq应用部署到wildfly不会加载Jooq类

问题描述 投票:0回答:1

你好,我正在尝试创建一个工作流引擎

项目结构如下

└── workflow-engine/
    ├── workflow-engine-server/
    │   ├── src
    │   └── pom.xml
    ├── workflow-engine-data/
    │   ├── src
    │   └── pom.xml
    ├── workflow-engine-example/
    │   ├── src
    │   └── pom.xml
    └── pom.xml

data 是一个空项目,包含生成的 jooq 类

server是剩下的api,取决于数据

example 是一个示例实现。

我正在构建示例分解的 war 文件并将其部署到在 intellij 内运行的本地设置的 Wildfly 32。 我可以毫无问题地部署和启动。

我有一个休息端点

public ResponseEntity<Void> login(String username, String password) {
    if (!userRepository.exists(USER.USERNAME.eq(username))) {
        return ResponseEntity.of(
                ProblemDetail.forStatusAndDetail(HttpStatus.BAD_REQUEST, "USERNAME_DOES_NOT_EXIST")
        ).build();
    }
    return null;
}

向端点发送发布请求时,我在服务器日志中收到一个大异常

23.05.2024 13:34:17 ERROR [               ErrorPageFilter] Forwarding to error page from request [/auth] due to exception ['void org.jooq.impl.TableImpl.<init>(org.jooq.Name, org.jooq.Schema, org.jooq.Table, org.jooq.Field[], org.jooq.Comment, org.jooq.TableOptions, org.jooq.Condition)']: java.lang.NoSuchMethodError: 'void org.jooq.impl.TableImpl.<init>(org.jooq.Name, org.jooq.Schema, org.jooq.Table, org.jooq.Field[], org.jooq.Comment, org.jooq.TableOptions, org.jooq.Condition)'
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//net.internalerror.jooq.tables.User.<init>(User.java:75)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//net.internalerror.jooq.tables.User.<init>(User.java:71)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//net.internalerror.jooq.tables.User.<init>(User.java:96)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//net.internalerror.jooq.tables.User.<clinit>(User.java:45)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//net.internalerror.jooq.Tables.<clinit>(Tables.java:19)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//net.internalerror.rest.controller.AuthController.login(AuthController.java:22)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:255)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:188)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:925)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:830)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
        at deployment.workflow-engine-example-1.0.0-SNAPSHOT.war//org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
        at [email protected]//jakarta.servlet.http.HttpServlet.service(HttpServlet.java:527)
and about 200 more lines

调试时我看到:类未加载:net.internalerror.jooq.Tables 截图

为什么类没有加载? 我该如何解决这个问题?

java spring-boot wildfly jooq jooq-codegen-maven
1个回答
1
投票

此错误似乎相关:

java.lang.NoSuchMethodError: 'void org.jooq.impl.TableImpl.<init>

因此,您生成的代码正在尝试加载运行时库中尚不存在的构造函数。当您使用比用作普通依赖项的版本更新的 jOOQ 版本生成代码时,通常会出现这种情况。

© www.soinside.com 2019 - 2024. All rights reserved.