在此之前,我正在使用 Eclipse 和 JavaCard Plugin for Eclipse 开发 Java Card 小程序。
但是,当我尝试切换到 Java Card 3.0.x 时,我已经安装了相关的运行时
java_card_devkit_tools-bin-v24.0-b_57-20-FEB-2024.zip
以及从 oracel 网站下载的相关 eclipse 插件 java_card_devkit_eclipse_plugin-bin-v24.0-b_50-20-FEB-2024
。
当我尝试创建新的 Java 卡小程序时,在最后一步,java 卡项目向导显示弹出错误消息,提示:
创建 Java Card 项目时发生错误。 javax/xml/bind/JAXBException根据 StackOverflow 中的问答,这是由于在较新版本中从 Java 运行时中删除了 JAXB,并且由于插件/eclipse 正在寻找它,因此会导致错误。
我在 SO 中搜索了很多问题和答案,但是作为修复,他们被要求开发人员在其源代码中询问一些行来修复问题(例如在 Spring 应用程序中)或使用 Maven/Gradle 添加一些依赖项到他们的项目中构建系统。
但是,由于错误发生在内部 IDE 应用程序本身内部,因此我无法更改任何内容来修复此问题,因为我无法访问 Eclipse 或 Java Card 插件源代码来修复此问题。
有些人建议为 Eclipse 安装
eclipse-ee4j。我已经下载了它,但它包含一些 JAR 文件,我不知道如何将其添加到 Eclipse 来解决这个问题。
我应该再次提到,由于 Eclipse 中的创建新项目向导异常,Java Card 项目并未创建,因此我无法更改应用程序源代码中的任何内容(因为还没有源代码可供修改)。更新: 日食版本:
版本:2024-03 (4.31.0) 版本号:20240307-1437
Log Error 输出是这样的: eclipse.buildId=4.31.0.20240307-1200 java.version=18.0.2 java.vendor=Oracle 公司 BootLoader 常量:OS=win32、ARCH=x86_64、WS=win32、NL=en_US 框架参数:-product org.eclipse.epp.package.java.product 命令行参数:-os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product -data file:/C:/Users/Eve/eclipse-workspace/
org.eclipse.core.resources
Error
4
Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at com.oracle.javacard.jcdk.core.ResourceDeltaProcessor.visit(ResourceDeltaProcessor.java:44)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:77)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:87)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:61)
at com.oracle.javacard.jcdk.core.Activator$1.resourceChanged(Activator.java:96)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:321)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:311)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:174)
at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:458)
at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1586)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2462)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2473)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:6082)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:108)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException cannot be found by com.oracle.javacard.jcdk.core_1.0.0.201505220623
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:562)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:557)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 16 more
这是从 Eclipse 日志文件中捕获的错误日志:
!ENTRY org.eclipse.core.resources 4 2 2024-05-08 14:07:42.006
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at com.oracle.javacard.jcdk.core.ResourceDeltaProcessor.visit(ResourceDeltaProcessor.java:44)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:77)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:87)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:61)
at com.oracle.javacard.jcdk.core.Activator$1.resourceChanged(Activator.java:96)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:321)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:311)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:174)
at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:458)
at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1586)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2462)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2473)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:6082)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:108)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException cannot be found by com.oracle.javacard.jcdk.core_1.0.0.201505220623
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:562)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:557)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 16 more
!ENTRY org.eclipse.jdt.ui 4 10001 2024-05-08 14:07:42.065
!MESSAGE Internal Error
!STACK 0
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:396)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1036)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.performFinish(NewElementWizard.java:133)
at com.oracle.javacard.jcdk.wizards.project.NewJCDKProjectWizard.performFinish(NewJCDKProjectWizard.java:82)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:837)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:474)
at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4274)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
at org.eclipse.jface.window.Window.open(Window.java:799)
at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:261)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:279)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:277)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:98)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:298)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:232)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:174)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:165)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:204)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:385)
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:141)
at org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:151)
at org.eclipse.ui.actions.NewWizardDropDownAction.run(NewWizardDropDownAction.java:171)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:581)
at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:454)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4274)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:651)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588)
at org.eclipse.equinox.launcher.Main.run(Main.java:1459)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at com.oracle.javacard.jcdk.wizards.project.pages.NewJavaCardProjectWizardPageTwo.performFinish(NewJavaCardProjectWizardPageTwo.java:499)
at com.oracle.javacard.jcdk.wizards.project.NewJCDKProjectWizard.finishPage(NewJCDKProjectWizard.java:74)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.lambda$1(NewElementWizard.java:118)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:742)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2448)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2473)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:6082)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:108)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException cannot be found by com.oracle.javacard.jcdk.core_1.0.0.201505220623
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:562)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:557)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more
Root exception:
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at com.oracle.javacard.jcdk.wizards.project.pages.NewJavaCardProjectWizardPageTwo.performFinish(NewJavaCardProjectWizardPageTwo.java:499)
at com.oracle.javacard.jcdk.wizards.project.NewJCDKProjectWizard.finishPage(NewJCDKProjectWizard.java:74)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.lambda$1(NewElementWizard.java:118)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:742)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2448)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2473)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:6082)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:108)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException cannot be found by com.oracle.javacard.jcdk.core_1.0.0.201505220623
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:562)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:557)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 10 more
!ENTRY org.eclipse.core.resources 4 2 2024-05-08 14:07:42.163
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at com.oracle.javacard.jcdk.core.ResourceDeltaProcessor.visit(ResourceDeltaProcessor.java:44)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:77)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:87)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:61)
at com.oracle.javacard.jcdk.core.Activator$1.resourceChanged(Activator.java:96)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:321)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:311)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:174)
at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:458)
at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1586)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:221)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException cannot be found by com.oracle.javacard.jcdk.core_1.0.0.201505220623
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:562)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:557)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 14 more
[更新] 2024年5月5日
使用 Eclipse IDE for Enterprise Java and Web Developers
也遇到同样的问题 我还包括了日志:
eclipse.buildId=4.31.0.20240307-1200
java.version=17.0.10
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data file:/C:/Users/E/eclipse-workspace305/
org.eclipse.core.resources
Error
Sat May 11 12:04:06 GMT+03:30 2024
Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at com.oracle.javacard.jcdk.core.ResourceDeltaProcessor.visit(ResourceDeltaProcessor.java:44)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:77)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:87)
at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:61)
at com.oracle.javacard.jcdk.core.Activator$1.resourceChanged(Activator.java:96)
at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:321)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:311)
at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:174)
at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:458)
at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1586)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:221)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException cannot be found by com.oracle.javacard.jcdk.core_1.0.0.201505220623
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:562)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:557)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:434)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:174)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
... 14 more
3.0.5 的文档并没有真正指定 Java 之外的版本,而 Java 7 或 Java 8 则需要 Java。
我使用 jcardsim 和 ant-javacard 而不是 Oracle 和 Eclipse 设置来处理我的 Javacard 内容,因此我自己还没有对此进行测试,但考虑到 Eclipse 2020-12 所需的最低 JDK 是 JDK 11,2024-03 所需的最低 JDK 是 JDK 17 由于 JDK 11 与 JDK 8 中的情况有很大不同,我怀疑它们能否正常工作。Eclipse 2020-06 是最后一个支持使用 JDK 8 运行的版本,因此它可能会工作,并且是最新的一个。
作为脚注,