OSGi 中的 NoClassDefFoundError 尽管它是导出和导入的

NoClassDefFoundError in OSGi although it is exported and imported

我尝试创建一个基于 Karaf 的基本虚拟现实 IDE。

我有 3 个 maven 项目:

  1. 连接到本地组件进行渲染的 VRServer。
  2. VR-HMI-Widgets 的 VR 组件工具包(具有从 VRComponent 扩展的 VRFrame)作为多模块 Maven 项目。
  3. VR IDE 项目 read/write 文件并执行低级命令。

我将它们全部安装到 Karaf 中:

karaf@root()> bundle:list
START LEVEL 100 , List Threshold: 50
 ID | State  | Lvl | Version            | Name
----+--------+-----+--------------------+---------------------------------------------------------------------------
 31 | Active |  80 | 4.3.0              | Apache Karaf :: OSGi Services :: Event
 54 | Active |  80 | 1.3.2              | Apache Aries SPI Fly Dynamic Weaving Bundle
 55 | Active |  80 | 9.0.0              | org.objectweb.asm
 56 | Active |  80 | 9.0.0              | org.objectweb.asm.commons
 57 | Active |  80 | 9.0.0              | org.objectweb.asm.tree
 58 | Active |  80 | 9.0.0              | org.objectweb.asm.tree.analysis
 59 | Active |  80 | 9.0.0              | org.objectweb.asm.util
 60 | Active |  80 | 2.0.17             | OpenWebBeans Core
 61 | Active |  80 | 2.0.17             | SPI definition
 62 | Active |  80 | 1.1.3              | Apache Aries CDI - CDI Component Runtime (CCR)
 63 | Active |  80 | 1.1.3              | Apache Aries CDI - SPI classes for Portable Extensions
 64 | Active |  80 | 1.1.3              | Apache Aries CDI - Container using Apache OpenWebBeans
 65 | Active |  80 | 1.1.3              | Apache Aries CDI - SPI
 66 | Active |  80 | 1.0.12             | Apache Felix Converter
 67 | Active |  80 | 1.2.0              | Apache Geronimo JSR-330 Spec 1.0
 68 | Active |  80 | 1.1.0              | Apache Geronimo Expression Language Spec 2.2
 69 | Active |  80 | 1.2.0              | Apache Geronimo Interceptor Spec 1.2
 70 | Active |  80 | 1.2.0              | Apache Geronimo JCDI Spec 2.0
 71 | Active |  80 | 1.3.0.3            | Apache ServiceMix :: Specs :: Annotation API 1.3
 72 | Active |  80 | 4.17.0             | Apache XBean :: ASM shaded (repackaged)
 73 | Active |  80 | 4.17.0             | Apache XBean OSGI Bundle Utilities
 74 | Active |  80 | 4.17.0             | Apache XBean :: Finder shaded (repackaged)
 75 | Active |  80 | 1.0.1.201505202024 | org.osgi:org.osgi.namespace.extender
 76 | Active |  80 | 1.0.0.201505202024 | org.osgi:org.osgi.namespace.implementation
 77 | Active |  80 | 1.0.0.201505202024 | org.osgi:org.osgi.namespace.service
 78 | Active |  80 | 1.0.0.201810101357 | org.osgi:org.osgi.service.cdi
 79 | Active |  80 | 1.1.0.201802012106 | org.osgi:org.osgi.util.function
 80 | Active |  80 | 1.1.0.201802012106 | org.osgi:org.osgi.util.promise
 81 | Active |  80 | 4.3.1.SNAPSHOT     | Apache Karaf :: OSGi Services :: Event
134 | Active |  80 | 1.0.0              | Virtual reality server
135 | Active |  80 | 0.0.1.SNAPSHOT     | VRComponent
136 | Active |  80 | 0.0.1.SNAPSHOT     | VRFrame
142 | Active |  80 | 0.0.1.SNAPSHOT     | Virtual reality integrated development environment (VRIDE)
karaf@root()>

但是当我尝试启动 VRIDE 包时,出现了这个异常:

10:00:42.193 WARN [fileinstall-C:\Program Files\apache-karaf-4.3.0/deploy] Error while creating extension
java.lang.NoClassDefFoundError: Lde/e_nexus/vr/tk/VRFrame;
        at java.lang.Class.getDeclaredFields0(Native Method) ~[?:1.8.0_232]
        at java.lang.Class.privateGetDeclaredFields(Class.java:2611) ~[?:1.8.0_232]
        at java.lang.Class.getDeclaredFields(Class.java:1944) ~[?:1.8.0_232]
        at org.apache.aries.cdi.container.internal.util.Reflection.allFields(Reflection.java:47) ~[!/:1.1.3]
        at org.apache.aries.cdi.container.internal.annotated.AnnotatedTypeImpl.<init>(AnnotatedTypeImpl.java:42) ~[!/:1.1.3]
        at org.apache.aries.cdi.container.internal.container.Discovery.lambda$discover(Discovery.java:133) ~[!/:1.1.3]
        at java.util.HashMap$Values.forEach(HashMap.java:981) ~[?:1.8.0_232]

这是我尝试加载的 Java-Class:

package de.e_nexus.desktop.vr.ide;

import java.util.logging.Logger;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;

import org.osgi.service.cdi.annotations.Reference;
import org.osgi.service.cdi.annotations.Service;

import de.e_nexus.vr.server.ClientKeyboardScancode;
import de.e_nexus.vr.server.VRClientHelmetAndControllerListener;
import de.e_nexus.vr.server.VRClientKeyboardListener;
import de.e_nexus.vr.server.VRServer;
import de.e_nexus.vr.server.listeners.VRClientRequestAppInfo;
import de.e_nexus.vr.server.listeners.VRClientStatusListener;
import de.e_nexus.vr.server.listeners.interaction.HelmetAndControllerInfo;
import de.e_nexus.vr.server.osgi.inter.VRServerService;
import de.e_nexus.vr.tk.VRFrame;

@ApplicationScoped
@Service
public class StartIDE implements VRClientStatusListener, VRClientRequestAppInfo, VRClientHelmetAndControllerListener, VRClientKeyboardListener {
    /**
     * The logger for this class.
     */
    private static final Logger LOG = Logger.getLogger(StartIDE.class.getCanonicalName());

    private final static Object lock = new Object();

    private VRServer vrServer;

    public void notifyStatus(boolean connected) {
        if (!connected) {
            synchronized (lock) {
                lock.notify();
            }
        }
    }

    @Reference
    @Inject
    private VRServerService vrServerService;

    private VRFrame applicationFrame;

    @PostConstruct
    public void initialize() {
        LOG.fine("Starting VR IDE");
        vrServer = vrServerService.getVRServer();
        applicationFrame = new VRFrame(vrServer, "test");

        LOG.info(getLatin1Title() + " started successfully!");
    }

    @PreDestroy
    public void teardown() {
        applicationFrame.remove();
        LOG.info("Stoped " + getLatin1Title() + " successfully!");
        vrServer = null;
    }

    public VRServer getVrServer() {
        return vrServer;
    }

    @Override
    public void notify(HelmetAndControllerInfo haci) {

    }

    @Override
    public String getLatin1Title() {
        return "VR IDE";
    }

    @Override
    public void notifyKeyboardEvent(ClientKeyboardScancode[] downs, ClientKeyboardScancode[] ups, long incomingTime) {
        System.out.println("me");
    }
}

VRServer-Codebase

VRToolkit-Codebase

VRIDE-Codebase


编辑:

这是完整的堆栈跟踪:

java.lang.NoClassDefFoundError: Lde/e_nexus/vr/tk/VRFrame;
        at java.lang.Class.getDeclaredFields0(Native Method) ~[?:1.8.0_232]
        at java.lang.Class.privateGetDeclaredFields(Class.java:2611) ~[?:1.8.0_232]
        at java.lang.Class.getDeclaredFields(Class.java:1944) ~[?:1.8.0_232]
        at org.apache.aries.cdi.container.internal.util.Reflection.allFields(Reflection.java:47) ~[!/:1.1.3]
        at org.apache.aries.cdi.container.internal.annotated.AnnotatedTypeImpl.<init>(AnnotatedTypeImpl.java:42) ~[!/:1.1.3]
        at org.apache.aries.cdi.container.internal.container.Discovery.lambda$discover(Discovery.java:133) ~[!/:1.1.3]
        at java.util.HashMap$Values.forEach(HashMap.java:981) ~[?:1.8.0_232]
        at org.apache.aries.cdi.container.internal.container.Discovery.discover(Discovery.java:130) ~[!/:1.1.3]
        at org.apache.aries.cdi.container.internal.container.ContainerState.<init>(ContainerState.java:178) ~[!/:1.1.3]
        at org.apache.aries.cdi.container.internal.Activator.doCreateExtension(Activator.java:209) [!/:1.1.3]
        at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:242) [!/:1.1.3]
        at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:227) [!/:1.1.3]
        at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488) [osgi.core-7.0.0.jar:?]
        at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:420) [osgi.core-7.0.0.jar:?]
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [osgi.core-7.0.0.jar:?]
        at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450) [osgi.core-7.0.0.jar:?]
        at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915) [org.apache.felix.framework-6.0.3.jar:?]
        at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834) [org.apache.felix.framework-6.0.3.jar:?]
        at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516) [org.apache.felix.framework-6.0.3.jar:?]
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4817) [org.apache.felix.framework-6.0.3.jar:?]
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2336) [org.apache.felix.framework-6.0.3.jar:?]
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) [org.apache.felix.framework-6.0.3.jar:?]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [!/:3.6.8]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [!/:3.6.8]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [!/:3.6.8]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [!/:3.6.8]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [!/:3.6.8]
Caused by: java.lang.ClassNotFoundException: de.e_nexus.vr.tk.VRFrame not found by de.e-nexus.component [87]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1597) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl.access0(BundleWiringImpl.java:79) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1982) ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_232]
        at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1375) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1618) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1548) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl.access0(BundleWiringImpl.java:79) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1982) ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_232]
        ... 27 more

项目中的主要问题是<extensions>true</extensions>在maven-bundle-plugin中。你需要把它放在你的 pom.xml 中。示例代码

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>5.1.1</version>
    <extensions>true</extensions>
    <configuration>
        <instructions>
            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Bundle-Activator>${Bundle-Activator}</Bundle-Activator>
            <Export-Package>
                de.*;version=${project.version}
            </Export-Package>
            <Import-Package>
                *
            </Import-Package>
        </instructions>
    </configuration>
</plugin>

对于 OSGI 包,包装应该像 <packaging>bundle</packaging> 一样。你可以看到包是如何从这个命令创建的

mvn archetype:generate \
    -DarchetypeGroupId=org.apache.karaf.archetypes \
    -DarchetypeArtifactId=karaf-bundle-archetype \
    -DarchetypeVersion=4.3.0 \
    -DgroupId=io.github.ozkanpakdil \
    -DartifactId=myfirstbundle \
    -Dversion=1.0-SNAPSHOT \
    -Dpackage=io.github.ozkanpakdil

https://karaf.apache.org/manual/latest/#_creating_bundles 解释得很好。除此之外,我强烈建议使用不带下划线的命名空间。而不是“e_nexus”有 enexus 而对于 <groupId>de.e-nexus</groupId><groupId>de.enexus</groupId>。最后但并非最不重要的是 <artifactId>vr.server</artifactId><artifactId>vrserver</artifactId>,我建议这些是因为 OSGI 已经是复杂的环境,简单易用的名称将更容易发现错误和维护代码。如果您移动到另一个 OS,它也可以防止出现问题,您永远不知道它们在 OS 之间的行为如何。

有一些警告与同一命名空间在不同的 jars 中有关,我相应地更改了“框架”和“组件”模块中的代码。下面是来自本地的日志,我可以看到 VR-Client 日志,我认为它按预期开始工作了。

ozkan@DESKTOP-NF90OD6 MINGW64 /c/Program Files/apache-karaf-4.3.0/bin
$ ./karaf
        __ __                  ____
       / //_/____ __________ _/ __/
      / ,<  / __ `/ ___/ __ `/ /_
     / /| |/ /_/ / /  / /_/ / __/
    /_/ |_|\__,_/_/   \__,_/_/

  Apache Karaf (4.3.0)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.

Start Osgi spiced VR Server ... [OK]  @10:23 (You might get asked by the firewall if you like to allow java to communicate to other systems. In order to connect the local VR-Client you are requested to grant the communication.)
karaf@root()> bundle:list
START LEVEL 100 , List Threshold: 50
ID | State    | Lvl | Version            | Name
---+----------+-----+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------
31 | Active   |  80 | 4.3.0              | Apache Karaf :: OSGi Services :: Event
55 | Active   |  80 | 1.0.0              | Virtual reality server
56 | Active   |  80 | 0.0.1.SNAPSHOT     | VRComponent
57 | Active   |  80 | 0.0.1.SNAPSHOT     | VRFrame
58 | Active   |  80 | 1.3.2              | Apache Aries SPI Fly Dynamic Weaving Bundle
59 | Active   |  80 | 9.0.0              | org.objectweb.asm
60 | Active   |  80 | 9.0.0              | org.objectweb.asm.commons
61 | Active   |  80 | 9.0.0              | org.objectweb.asm.tree
62 | Active   |  80 | 9.0.0              | org.objectweb.asm.tree.analysis
63 | Active   |  80 | 9.0.0              | org.objectweb.asm.util
64 | Active   |  80 | 2.0.17             | OpenWebBeans Core
65 | Active   |  80 | 2.0.17             | SPI definition
66 | Active   |  80 | 1.1.3              | Apache Aries CDI - CDI Component Runtime (CCR)
67 | Active   |  80 | 1.1.3              | Apache Aries CDI - SPI classes for Portable Extensions
68 | Active   |  80 | 1.1.3              | Apache Aries CDI - Container using Apache OpenWebBeans
69 | Active   |  80 | 1.1.3              | Apache Aries CDI - SPI
70 | Active   |  80 | 1.0.12             | Apache Felix Converter
71 | Active   |  80 | 1.2.0              | Apache Geronimo JSR-330 Spec 1.0
72 | Active   |  80 | 1.1.0              | Apache Geronimo Expression Language Spec 2.2
73 | Active   |  80 | 1.2.0              | Apache Geronimo Interceptor Spec 1.2
74 | Active   |  80 | 1.2.0              | Apache Geronimo JCDI Spec 2.0
75 | Active   |  80 | 1.3.0.3            | Apache ServiceMix :: Specs :: Annotation API 1.3
76 | Active   |  80 | 4.17.0             | Apache XBean :: ASM shaded (repackaged)
77 | Active   |  80 | 4.17.0             | Apache XBean OSGI Bundle Utilities
78 | Active   |  80 | 4.17.0             | Apache XBean :: Finder shaded (repackaged)
79 | Active   |  80 | 1.0.1.201505202024 | org.osgi:org.osgi.namespace.extender
80 | Active   |  80 | 1.0.0.201505202024 | org.osgi:org.osgi.namespace.implementation
81 | Active   |  80 | 1.0.0.201505202024 | org.osgi:org.osgi.namespace.service
82 | Active   |  80 | 1.0.0.201810101357 | org.osgi:org.osgi.service.cdi
83 | Active   |  80 | 1.1.0.201802012106 | org.osgi:org.osgi.util.function
84 | Active   |  80 | 1.1.0.201802012106 | org.osgi:org.osgi.util.promise
85 | Resolved |  80 | 4.3.1.SNAPSHOT     | Apache Karaf :: OSGi Services :: Event
86 | Active   |  80 | 0.0.1.SNAPSHOT     | Virtual reality integrated development environment (VRIDE)
karaf@root()> log:display
10:23:10.508 INFO [activator-1-thread-2] Registering commands for bundle org.apache.karaf.log.core/4.3.0
10:23:10.821 INFO [activator-1-thread-2] Deployment finished. Registering FeatureDeploymentListener
10:23:10.821 INFO [activator-1-thread-2] Registering commands for bundle org.apache.karaf.features.command/4.3.0
10:23:10.828 INFO [activator-1-thread-3] Registering commands for bundle org.apache.karaf.kar.core/4.3.0
10:23:10.855 INFO [FelixStartLevel] Command registration delayed for bundle org.apache.karaf.shell.ssh/4.3.0. Missing service: [org.apache.sshd.server.SshServer]
10:23:10.871 INFO [FelixStartLevel] Registering commands for bundle org.apache.karaf.system.core/4.3.0
10:23:10.893 INFO [FelixStartLevel] Registering commands for bundle org.apache.karaf.event/4.3.0
10:23:11.089 INFO [activator-1-thread-1] Registering commands for bundle org.apache.karaf.shell.ssh/4.3.0
10:23:11.128 INFO [activator-1-thread-1] No detected/configured IoServiceFactoryFactory using Nio2ServiceFactoryFactory
10:23:12.346 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.PackageStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=packageState,version=1.5,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.346 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.wiring.BundleWiringStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=wiringState,version=1.1,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.346 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.BundleStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=bundleState,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.351 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.ServiceStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=serviceState,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.352 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.FrameworkMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=framework,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.353 INFO [activator-1-thread-1] Registering org.osgi.jmx.service.cm.ConfigurationAdminMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.compendium:service=cm,version=1.3,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.388 INFO [activator-1-thread-1] Unregistering org.osgi.jmx.framework.PackageStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=packageState,version=1.5,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.389 INFO [activator-1-thread-1] Unregistering org.osgi.jmx.framework.wiring.BundleWiringStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=wiringState,version=1.1,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.390 INFO [activator-1-thread-1] Unregistering org.osgi.jmx.framework.BundleStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=bundleState,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.390 INFO [activator-1-thread-1] Unregistering org.osgi.jmx.framework.ServiceStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=serviceState,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.391 INFO [activator-1-thread-1] Unregistering org.osgi.jmx.framework.FrameworkMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.core:type=framework,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.392 INFO [activator-1-thread-1] Unregistering org.osgi.jmx.service.cm.ConfigurationAdminMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@a766065 with name osgi.compendium:service=cm,version=1.3,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.394 WARN [activator-1-thread-1] Task rejected for JMX Notification dispatch of event [org.osgi.framework.ServiceEvent[source=[javax.management.MBeanServer]]] - Dispatcher may have been shutdown
10:23:12.420 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.PackageStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@4a85005 with name osgi.core:type=packageState,version=1.5,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.421 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.wiring.BundleWiringStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@4a85005 with name osgi.core:type=wiringState,version=1.1,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.422 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.BundleStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@4a85005 with name osgi.core:type=bundleState,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.423 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.ServiceStateMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@4a85005 with name osgi.core:type=serviceState,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.423 INFO [activator-1-thread-1] Registering org.osgi.jmx.framework.FrameworkMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@4a85005 with name osgi.core:type=framework,version=1.7,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3
10:23:12.424 INFO [activator-1-thread-1] Registering org.osgi.jmx.service.cm.ConfigurationAdminMBean to MBeanServer org.apache.karaf.management.internal.EventAdminMBeanServerWrapper@4a85005 with name osgi.compendium:service=cm,version=1.3,framework=org.apache.felix.framework,uuid=1ba06c85-21b1-4145-9726-b08a81b6cad3


正如日志记录指出的那样:

Caused by: java.lang.ClassNotFoundException: de.e_nexus.vr.tk.VRFrame not found by de.e-nexus.component [87]

什么意思是 Karaf 正在从组件子模块中搜索 VRFrame,这显然不存在。

这是有道理的,因为所有 java 包都已导出,VRFrame 的包不明确。我遵循了 özkan pakdil 所说的并将 java-packages 重命名为一个唯一的名称。从那以后,它就像一个魅力。

谢谢厄兹坎!您的回答包含一些有用的提示,而我的问题的根源是模棱两可的包名。