红帽6.8安装kettle9.4,运行carte.sh报错Caused by: java.lang.reflect.InvocationTargetException

运行carte.sh报错Caused by: java.lang.reflect.InvocationTargetException

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.pentaho.commons.launcher.Launcher.main(Launcher.java:92)
Caused by: java.lang.InternalError: java.lang.reflect.InvocationTargetException
        at jdk.internal.platform.Metrics.systemMetrics(Metrics.java:67)
        at jdk.internal.platform.Container.metrics(Container.java:42)
        at sun.management.OperatingSystemImpl.<init>(OperatingSystemImpl.java:181)
        at sun.management.ManagementFactoryHelper.getOperatingSystemMXBean(ManagementFactoryHelper.java:106)
        at java.lang.management.PlatformComponent$7.getMXBeans(PlatformComponent.java:157)
        at java.lang.management.PlatformComponent.getMXBeans(PlatformComponent.java:377)
        at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:472)
        at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
        at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:637)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:699)
        at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:716)
        at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:270)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
        at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
        at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137)
        at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:55)
        at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
        at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:284)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:304)
        at org.pentaho.di.i18n.GlobalMessageUtil.<clinit>(GlobalMessageUtil.java:50)
        at org.pentaho.di.i18n.LAFMessageHandler.calculateString(LAFMessageHandler.java:94)
        at org.pentaho.di.i18n.GlobalMessages.getString(GlobalMessages.java:177)
        at org.pentaho.di.i18n.BaseMessages.getString(BaseMessages.java:86)
        at org.pentaho.di.core.logging.LogLevel.<clinit>(LogLevel.java:36)
        at org.pentaho.di.core.logging.DefaultLogLevel.<init>(DefaultLogLevel.java:36)
        at org.pentaho.di.core.logging.DefaultLogLevel.getInstance(DefaultLogLevel.java:41)
        at org.pentaho.di.core.logging.DefaultLogLevel.getLogLevel(DefaultLogLevel.java:50)
        at org.pentaho.di.core.logging.LogChannel.<init>(LogChannel.java:80)
        at org.pentaho.di.core.logging.LogChannel.<clinit>(LogChannel.java:41)
        at org.pentaho.di.i18n.GlobalMessages.<clinit>(GlobalMessages.java:46)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at org.pentaho.di.laf.LAFDelegate.loadHandler(LAFDelegate.java:83)
        at org.pentaho.di.laf.LAFDelegate.init(LAFDelegate.java:59)
        at org.pentaho.di.laf.LAFDelegate.<init>(LAFDelegate.java:51)
        at org.pentaho.di.laf.LAFFactory.getDelegate(LAFFactory.java:60)
        at org.pentaho.di.laf.LAFFactory.getHandler(LAFFactory.java:75)
        at org.pentaho.di.i18n.BaseMessages.init(BaseMessages.java:51)
        at org.pentaho.di.i18n.BaseMessages.<init>(BaseMessages.java:46)
        at org.pentaho.di.i18n.BaseMessages.getInstance(BaseMessages.java:56)
        at org.pentaho.di.i18n.BaseMessages.<clinit>(BaseMessages.java:42)
        at org.pentaho.di.www.Carte.parseAndRunCommand(Carte.java:173)
        at org.pentaho.di.www.Carte.main(Carte.java:164)
        ... 5 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at jdk.internal.platform.Metrics.systemMetrics(Metrics.java:63)
        ... 52 more
Caused by: java.lang.ExceptionInInitializerError
        at jdk.internal.platform.CgroupSubsystemFactory.create(CgroupSubsystemFactory.java:95)
        at jdk.internal.platform.CgroupMetrics.getInstance(CgroupMetrics.java:169)
        ... 57 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
        at jdk.internal.platform.cgroupv2.CgroupV2Subsystem.initSubsystem(CgroupV2Subsystem.java:73)
        at jdk.internal.platform.cgroupv2.CgroupV2Subsystem.<clinit>(CgroupV2Subsystem.java:44)
        ... 59 more

这个错误是由于 Java 反射机制在尝试获取系统指标(metrics)时出现了问题,具体原因是 ArrayIndexOutOfBoundsException 导致的 ExceptionInInitializerError。问题出现在 Java 运行时环境尝试初始化 cgroup v2 子系统时。

从堆栈跟踪信息中可以看到,问题根源在于 Java 运行时无法正确解析 cgroup v2 子系统的信息,可能是因为运行的环境(如容器化环境或者虚拟机)不完全支持这些特性,或者这些特性在当前配置下出现了问题。

禁用 cgroup 相关的功能
在 OPT 变量中添加 -XX:-UseContainerSupport 参数
修改脚本
#!/bin/sh

# *****************************************************************************
#
# Pentaho Data Integration
#
# Copyright (C) 2006 - 2022 by Hitachi Vantara : http://www.hitachivantara.com
#
# *****************************************************************************
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# *****************************************************************************

# OS specific support.
darwin=false;
case "$(uname -s)" in
  Darwin*)
    darwin=true
    ;;
esac

BASEDIR="`dirname $0`"
cd "$BASEDIR"
DIR="`pwd`"
cd - > /dev/null
OPT="$OPT -Dorg.mortbay.util.URI.charset=UTF-8 -XX:-UseContainerSupport"
if [ ! "x$JAAS_LOGIN_MODULE_CONFIG" = "x" -a ! "x$JAAS_LOGIN_MODULE_NAME" = "x" ]; then
        OPT=$OPT" -Djava.security.auth.login.config=$JAAS_LOGIN_MODULE_CONFIG"
        OPT=$OPT" -Dloginmodulename=$JAAS_LOGIN_MODULE_NAME"
fi
if [ "${darwin}" = "true" ]; then
  OPT="$OPT -Djava.awt.headless=true"
fi
export OPT
"$DIR/spoon.sh" -main org.pentaho.di.www.Carte "$@"

### Kettle 运行时 XulException 错误解决方案 `org.pentaho.ui.xul.XulException: java.lang.reflect.InvocationTargetException` 是 Kettle 用户常见的异常之一,通常发生在尝试创建数据库连接或其他 UI 组件加载过程中。以下是可能的原因及其对应的解决方案: #### 1. JDK 版本不兼容 Kettle 对 JDK 的版本有严格的要求。如果使用的 JDK 版本过高或过低,可能会引发 `InvocationTargetException` 或其他类似的异常[^3]。 - **原因**: Kettle 官方推荐使用 JDK 1.8 (Java 8),而更高版本(如 Java 11 或以上)可能导致类加载器冲突或方法签名不匹配。 - **解决办法**: - 确认当前系统的 JDK 版本是否为 1.8。可以通过命令 `java -version` 检查。 - 如果不是 JDK 1.8,则下载并安装 Oracle JDK 1.8 或 OpenJDK 1.8,并将其设置为默认的 JAVA_HOME 和 PATH 变量。 ```bash export JAVA_HOME=/path/to/jdk1.8 export PATH=$JAVA_HOME/bin:$PATH ``` #### 2. 缺少必要的依赖库 某些情况下,缺少特定的 JAR 文件也可能导致此类异常。特别是当 Kettle 尝试加载第三方组件(如 MySQL 驱动程序)时,如果没有正确配置驱动路径,会抛出此错误[^2]。 - **原因**: 数据库驱动未正确放置到 Kettle 的 lib 目录下。 - **解决办法**: - 下载对应数据库类型的 JDBC 驱动文件(例如 MySQL 使用 `mysql-connector-java-x.x.xx.jar`),并将该文件复制到 Kettle 安装目录下的 `lib` 文件夹中。 - 启动 Kettle 前确认环境变量 CLASSPATH 已经包含了这些新增加的 jar 包。 #### 3. XML 文件解析失败 部分用户的反馈表明,XUL 加载过程中的问题可能是由于底层 XML 文档损坏或者格式不符合预期引起的[^1]。 - **原因**: Kettle 在初始化界面控件时读取了有问题的 XUL/XML 脚本资源。 - **解决办法**: - 清理缓存数据以及临时生成的日志记录文件夹 `%USERPROFILE%\.kettle\`. - 删除旧版插件重新同步最新官方发布包内的所有模块内容至本地磁盘位置。 #### 4. ClassCastException 导致的问题 虽然主要讨论的是 InvocationTargetException, 不排除存在额外类型转换异常的情况: - **描述**: 当数组对象被强制转化为字符串形式处理时发生崩溃现象[^4]. - **修复建议**: * 修改源码逻辑避免非法转型操作. * 更新至更稳定的新发行版本号减少潜在风险. 通过上述分析可以发现大部分情况调整合适的开发工具链组合即可有效缓解症状表现. ```python # 示例代码展示如何验证JDK版本 import subprocess def check_java_version(): result = subprocess.run([&#39;java&#39;, &#39;-version&#39;], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) if &#39;1.8&#39; in result.stdout: print("Correct JDK version detected.") else: raise Exception("Incorrect JDK version!") check_java_version() ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值