尽管 OSGi 包存在,但出现 NoClassDefFoundError

发布于 2024-11-25 01:12:49 字数 1721 浏览 1 评论 0原文

当尝试在 Eclipse Equinox 上运行 grails 应用程序时,出现运行时错误。

java.lang.NoClassDefFoundError: org/apache/commons/collections/Transformer

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:580)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:550)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:481)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:469)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)

at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)

at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)

at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)

at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)

at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

问题是我的包正在导入以下包 com.springsource.org.apache.commons.collections;版本=“3.2.1” 在搜索 spring EBR 时,我发现该包包含所需的类。

我使用监视工具来确保捆绑包正在运行。

可能是什么问题?

问候 ?

I get a run time error when trying to run a grails application on Eclipse Equinox.

java.lang.NoClassDefFoundError: org/apache/commons/collections/Transformer

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:580)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:550)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:481)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:469)

at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)

at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)

at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)

at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)

at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)

at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)

at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

The problem is that my bundle is importing the following package com.springsource.org.apache.commons.collections; version="3.2.1"
When searching spring EBR I find that the bundle contains the required Class.

I used monitor tool to make sure that the bundle is running.

What can be the problem ?

Regards ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

偏爱你一生 2024-12-02 01:12:49

根据您所写的内容,您正在导入包 com.springsource.org.apache.commons.collections,但这是 Spring 构建的 OSGi 版本的 org.apache.commons.collections jar 文件。它是一个捆绑包,而不是一个包。

您的捆绑包必须导入 org.apache.commons.collections,它是由 com.springsource.org.apache.commons.collections 捆绑包提供的。假设您已经向运行时提供 Spring 包,您只需修复 import 语句即可。

在现有清单中,将(在“导入包”部分下)更改

com.springsource.org.apache.commons.collections;version="3.2.1"

为:

org.apache.commons.collections;version="3.2.1"

Based on what you wrote, you are importing the package com.springsource.org.apache.commons.collections, but that is a a Spring built OSGi version of the org.apache.commons.collections jar file. It is a bundle, not a package.

Your bundle would have to import org.apache.commons.collections, which is provided by the com.springsource.org.apache.commons.collections bundle. Assuming you are already supplying the Spring bundle to the runtime, you simply need to fix the import statement.

In your existing manifest, change (under your Import-Package section):

com.springsource.org.apache.commons.collections;version="3.2.1"

to

org.apache.commons.collections;version="3.2.1"
把人绕傻吧 2024-12-02 01:12:49

您的捆绑包无法导入包com.springsource.org.apache.commons.collections,因为没有这样的包。您的意思可能是您已经安装了具有该名称的捆绑包

该错误意味着您的捆绑包未导入包 org.apache.commons.collections,即它必须出现在捆绑包的 Import-Package 语句中的某个位置。

Your bundle cannot import the package com.springsource.org.apache.commons.collections because there is no such package. What you probably mean is that you have installed the bundle with that name.

The error means that your bundle does not import the package org.apache.commons.collections, i.e. it must appear somewhere in the Import-Package statement of your bundle.

深巷少女 2024-12-02 01:12:49

将 commons-collections jar 文件添加到构建路径将解决此问题。

Adding commons-collections jar file to your build path will solve this issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文