osginoclassdeffounderroreclipse-virgoidempiere

OSGi bundle loading: NoClassDefFoundError of standard java class


I'm trying to run iDempiere on Virgo. I loaded multiple bundles without problems. The org.adempiere.server and org.idempiere.webservices load fine. But when loading the org.adempiere.ui.zk bundle, I get a NoClassDefFoundError in the org.adempiere.base bundle. The base bundle didn't cause any problems when loading org.adempiere.server, which also needs it.

The strange thing is, it's the javax.print.attribute.standard.MediaSize$NA class which isn't found, which is a standard Java class.

When executing clexport, the class is exported by org.eclipse.osgi When executing clload, the class can get loaded by other bundles.

The error stack:

[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

Any idea what could cause this?


Solution

  • I see a:

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

    This is a CNFE not a NoClassDefFoundError

    In module "org.adempiere.base_1.0.0.v20121024-1809" you need to:

    Import-Package: javax.print.attribute.standard
    

    FWIW This is an entry to add/merge into the MANIFEST.MF for that module.