OSGi bundle loading:标准java类的NoClassDefFoundError

时间:2012-10-25 09:49:42

标签: osgi noclassdeffounderror eclipse-virgo idempiere

我正试图在处女座上运行iDempiere。我没有任何问题加载了多个包。 org.adempiere.serverorg.idempiere.webservices加载正常。但是在加载org.adempiere.ui.zk捆绑包时,我会在NoClassDefFoundError捆绑包中获得org.adempiere.base。在加载org.adempiere.server时基础包没有引起任何问题,这也需要它。

奇怪的是,它是找不到的javax.print.attribute.standard.MediaSize$NA类,它是一个标准的Java类。

执行clexport时,该类将由org.eclipse.osgi导出 执行clload时,该类可以被其他包加载。

错误堆栈:

[2012-10-24 20:34:23.592] INFO  fs-watcher                   o.e.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener     ApplicationConditionallyDeploying path 'D:\VIRGO-~1.REL\pickup\org.adempiere.ui.zk_1.0.0.v20121024-1809\'. 
[2012-10-24 20:34:23.777] INFO  start-signalling-1           org.compiere.web.AdempiereMonitorFilter                            
[2012-10-24 20:34:23.809] ERROR start-signalling-1           o.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]   StandardWrapper.Throwable java.lang.NoClassDefFoundError: javax/print/attribute/standard/MediaSize$NA
    at org.compiere.util.Language.<clinit>(Language.java:101)
    at org.compiere.util.Ini.<clinit>(Ini.java:85)
    at org.compiere.util.WebEnv.initWeb(WebEnv.java:162)
    at org.compiere.util.WebEnv.initWeb(WebEnv.java:129)
    at org.compiere.web.AdempiereMonitor.init(AdempiereMonitor.java:1049)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.eclipse.gemini.web.tomcat.internal.TomcatServletContainer.startWebApplication(TomcatServletContainer.java:125)
    at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:95)
    at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:122)
    at org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor.onStarted(StandardArtifactStateMonitor.java:271)
    at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.asyncStartSucceeded(AbstractInstallArtifact.java:319)
    at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.access$0(AbstractInstallArtifact.java:316)
    at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact$StateMonitorSignal.signalSuccessfulCompletion(AbstractInstallArtifact.java:252)
    at org.eclipse.virgo.kernel.core.internal.BundleStartTracker$1.run(BundleStartTracker.java:140)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: javax.print.attribute.standard.MediaSize$NA in KernelBundleClassLoader: [bundle=org.adempiere.base_1.0.0.v20121024-1809]
    at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:139)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 25 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.print.attribute.standard.MediaSize$NA
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135)
    ... 26 common frames omitted

知道可能导致这种情况的原因吗?

1 个答案:

答案 0 :(得分:3)

我看到了:

Caused by: java.lang.ClassNotFoundException: javax.print.attribute.standard.MediaSize$NA

这是CNFE而不是NoClassDefFoundError

在模块“org.adempiere.base_1.0.0.v20121024-1809”中,您需要:

Import-Package: javax.print.attribute.standard

FWIW这是一个添加/合并到该模块的MANIFEST.MF的条目。