gpt4 book ai didi

java - Togglz JDBCStateRepository 自动在 DB2 中创建格式错误的表

转载 作者:行者123 更新时间:2023-12-02 12:56:20 27 4
gpt4 key购买 nike

我是在我们公司第一次配置 togglz JDBCStateRepository。

在我从 InMemoryStateRepository 转换为 JDBCStateRepository 的第一个项目中,项目组合是:

  • Spring Boot 项目
  • Oracle数据库
  • 已存在架构和为“表名称”指定的新表

我用过

<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-spring-boot-starter</artifactId>
<version>2.4.1.Final</version>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-console</artifactId>
<version>2.4.1.Final</version>
</dependency>

一切都自动正常工作。

在第二个项目中,我将 InMemoryStateRepository 转换为 JDBCStateRepository,项目组合为:

  • 普通 Spring 项目(不是 Spring Boot)
  • DB2 数据库
  • 为“表名称”指定新架构和新表

我用过

<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-core</artifactId>
<version>2.4.1.Final</version>
</dependency>
<dependency>
<groupId>org.togglz</groupId>
<artifactId>togglz-console</artifactId>
<version>2.4.1.Final</version>
</dependency>

在点击 togglz 索引页面时,我得到以下异常:

[6/7/17 10:25:55:672 EDT] 000000c4 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: An exception was thrown by one of the service methods of the servlet [TogglzConsoleServlet] in application [pp_dial2_issuance_pub]. Exception created : [java.lang.IllegalStateException: Failed to migrate the database schema
at org.togglz.core.repository.jdbc.JDBCStateRepository.migrateSchema(JDBCStateRepository.java:184)
at org.togglz.core.repository.jdbc.JDBCStateRepository.<init>(JDBCStateRepository.java:152)
at org.togglz.core.repository.jdbc.JDBCStateRepository.<init>(JDBCStateRepository.java:96)
at com.lmig.ci.policy.publisher.issuance.togglz.ToggleFMP.getFeatureManager(ToggleFMP.java:41)
at org.togglz.core.context.FeatureContext.findFeatureManagerInClassLoader(FeatureContext.java:108)
at org.togglz.core.context.FeatureContext.getFeatureManagerOrNull(FeatureContext.java:74)
at org.togglz.core.context.FeatureContext.getFeatureManager(FeatureContext.java:47)
at org.togglz.core.manager.LazyResolvingFeatureManager.getDelegate(LazyResolvingFeatureManager.java:24)
at org.togglz.core.manager.LazyResolvingFeatureManager.getCurrentFeatureUser(LazyResolvingFeatureManager.java:49)
at org.togglz.console.TogglzConsoleServlet.isFeatureAdmin(TogglzConsoleServlet.java:75)
at org.togglz.console.TogglzConsoleServlet.service(TogglzConsoleServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1232)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:781)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at org.togglz.servlet.TogglzFilter.doFilter(TogglzFilter.java:100)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3928)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
Caused by: com.ibm.db2.jcc.a.fn: DB2 SQL Error: SQLCODE=-542, SQLSTATE=42831, SQLERRMC=FEATURE_NAME, DRIVER=4.1.85
at com.ibm.db2.jcc.a.yc.a(yc.java:592)
at com.ibm.db2.jcc.a.yc.a(yc.java:60)
at com.ibm.db2.jcc.a.yc.a(yc.java:127)
at com.ibm.db2.jcc.a.il.c(il.java:1914)
at com.ibm.db2.jcc.a.il.d(il.java:1902)
at com.ibm.db2.jcc.a.il.b(il.java:1369)
at com.ibm.db2.jcc.t4.db.h(db.java:219)
at com.ibm.db2.jcc.t4.db.b(db.java:45)
at com.ibm.db2.jcc.t4.t.b(t.java:38)
at com.ibm.db2.jcc.t4.sb.g(sb.java:120)
at com.ibm.db2.jcc.a.il.P(il.java:1364)
at com.ibm.db2.jcc.a.il.a(il.java:2261)
at com.ibm.db2.jcc.a.il.c(il.java:614)
at com.ibm.db2.jcc.a.il.executeUpdate(il.java:598)
at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.pmiExecuteUpdate(WSJdbcStatement.java:1804)
at com.ibm.ws.rsadapter.jdbc.WSJdbcStatement.executeUpdate(WSJdbcStatement.java:1135)
at org.togglz.core.repository.jdbc.SchemaUpdater.execute(SchemaUpdater.java:135)
at org.togglz.core.repository.jdbc.SchemaUpdater.migrateToVersion1(SchemaUpdater.java:39)
at org.togglz.core.repository.jdbc.JDBCStateRepository.migrateSchema(JDBCStateRepository.java:170)
... 37 more

重要的部分是:

Caused by: com.ibm.db2.jcc.a.fn: DB2 SQL Error: SQLCODE=-542, SQLSTATE=42831, SQLERRMC=FEATURE_NAME, DRIVER=4.1.85

可以在此处找到此 SQLCODE 和 SQLSTATE 的定义: https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/codes/src/tpc/n542.html

其中指出:

-542 column-name CANNOT BE A COLUMN OF A HASH KEY, PRIMARY KEY, A UNIQUE CONSTRAINT, OR A PARENT KEY BECAUSE IT CAN CONTAIN NULL VALUES

换句话说,togglz 似乎正在尝试创建一个表,其中列名“FEATURE_NAME”既可为空,又具有主键或唯一约束。当我引用在第一个项目中创建的表时,列“FEATURE_NAME”不可为空并标记为主键。第二个项目中的唯一区别是 togglz-core 与 togglz-spring-boot-starter 以及 oracle 与 db2。

有人遇到过这种情况吗?有办法解决这个问题吗?

最佳答案

这里是 Togglz 的作者。

这显然看起来像一个错误。那么为什么不在 Togglz 问题跟踪器中为此打开一个问题呢?可以找到here 。当然,修复此问题的拉取请求也将受到欢迎。

但是,与此同时,您可以简单地禁用自动架构迁移功能并自行创建表。有an option在构建器中执行此操作。

关于java - Togglz JDBCStateRepository 自动在 DB2 中创建格式错误的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44417735/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com