Apache Camel 3.X 迁移 - ClassNotFoundException:org.apache.camel.impl.BreakpointSupport
Apache Camel 3.X migration - ClassNotFoundException: org.apache.camel.impl.BreakpointSupport
将应用程序从 2.X 迁移到 3.X 时,构建成功但测试失败并显示 ClassNotFoundException:org.apache.camel.impl.BreakpointSupport
java.lang.NoClassDefFoundError: org/apache/camel/impl/BreakpointSupport
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access0(URLClassLoader.java:73)
at java.net.URLClassLoader.run(URLClassLoader.java:368)
at java.net.URLClassLoader.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredClasses0(Native Method)
at java.lang.Class.getDeclaredClasses(Class.java:1867)
at java.lang.Class.run(Class.java:1504)
at java.lang.Class.run(Class.java:1499)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.Class.getClasses(Class.java:1498)
at org.testng.internal.ClassInfoMap.registerClass(ClassInfoMap.java:43)
at org.testng.internal.ClassInfoMap.<init>(ClassInfoMap.java:29)
at org.testng.internal.ClassInfoMap.<init>(ClassInfoMap.java:21)
at org.testng.TestRunner.initMethods(TestRunner.java:369)
at org.testng.TestRunner.init(TestRunner.java:271)
at org.testng.TestRunner.init(TestRunner.java:241)
at org.testng.TestRunner.<init>(TestRunner.java:167)
at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:663)
at org.testng.SuiteRunner.init(SuiteRunner.java:260)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:198)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1295)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1273)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
Caused by: java.lang.ClassNotFoundException: org.apache.camel.impl.BreakpointSupport
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 35 more```
pom.xml
${camel.version} --> 3.5.0 (tried 3.1.0 to 3.5.0)
${testng.version} --> 6.14.3
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-support</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-base</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
Class:App中没有使用BreakpointSupport,主要是引用了其中一个camel模块,在最新版本的camel中,BreakpointSupport被移动到org.apache.camel.processor.interceptor,但它仍然是尝试从旧位置获取。
找到问题了!
camel-testng 已弃用,camel 鼓励使用 junit。
迁移到 Junit5 解决了这个问题。
将应用程序从 2.X 迁移到 3.X 时,构建成功但测试失败并显示 ClassNotFoundException:org.apache.camel.impl.BreakpointSupport
java.lang.NoClassDefFoundError: org/apache/camel/impl/BreakpointSupport
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access0(URLClassLoader.java:73)
at java.net.URLClassLoader.run(URLClassLoader.java:368)
at java.net.URLClassLoader.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredClasses0(Native Method)
at java.lang.Class.getDeclaredClasses(Class.java:1867)
at java.lang.Class.run(Class.java:1504)
at java.lang.Class.run(Class.java:1499)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.Class.getClasses(Class.java:1498)
at org.testng.internal.ClassInfoMap.registerClass(ClassInfoMap.java:43)
at org.testng.internal.ClassInfoMap.<init>(ClassInfoMap.java:29)
at org.testng.internal.ClassInfoMap.<init>(ClassInfoMap.java:21)
at org.testng.TestRunner.initMethods(TestRunner.java:369)
at org.testng.TestRunner.init(TestRunner.java:271)
at org.testng.TestRunner.init(TestRunner.java:241)
at org.testng.TestRunner.<init>(TestRunner.java:167)
at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:663)
at org.testng.SuiteRunner.init(SuiteRunner.java:260)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:198)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1295)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1273)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
Caused by: java.lang.ClassNotFoundException: org.apache.camel.impl.BreakpointSupport
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 35 more```
pom.xml
${camel.version} --> 3.5.0 (tried 3.1.0 to 3.5.0)
${testng.version} --> 6.14.3
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-support</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-base</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
Class:App中没有使用BreakpointSupport,主要是引用了其中一个camel模块,在最新版本的camel中,BreakpointSupport被移动到org.apache.camel.processor.interceptor,但它仍然是尝试从旧位置获取。
找到问题了!
camel-testng 已弃用,camel 鼓励使用 junit。 迁移到 Junit5 解决了这个问题。