dev@glassfish.java.net

Re: debugging ClassNotFoundException runtime exception in hk2/OSGi?

From: Bobby Bissett <bobby.bissett_at_oracle.com>
Date: Tue, 29 Jun 2010 15:30:39 -0400

> Can you post the precise exception?

Sure thing:

[#|2010-06-29T15:03:44.241-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;|*ERROR*
[org.osgi.service.cm.ManagedService, id=5, bundle=194]: Unexpected
problem updating Configuration
PID=org.jvnet.hk2.osgiadapter.StartupContextService, factoryPID=null,
bundleLocation=file:/Users/bobby/work/ws/v3/distributions/glassfish/
target/glassfishv3/glassfish/modules/osgi-adapter.jar|#]

[#|2010-06-29T15:03:44.242-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;|java.lang.NoClassDefFoundError: com/
sun/enterprise/ee/cms/core/GMSFactory|#]

[#|2010-06-29T15:03:44.242-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.glassfish.gms.GMSAdapterImpl.initializeGMS(GMSAdapterImpl.java:
359)|#]

[#|2010-06-29T15:03:44.242-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.glassfish.gms.GMSAdapterImpl.postConstruct(GMSAdapterImpl.java:
140)|#]

[#|2010-06-29T15:03:44.242-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:
174)|#]

[#|2010-06-29T15:03:44.242-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
java.security.AccessController.doPrivileged(Native Method)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:
84)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:
58)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com
.sun
.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:
60)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.jvnet.hk2.component.Habitat.getByContract(Habitat.java:983)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org
.glassfish
.gms.bootstrap.GmsAdapterService.loadModule(GmsAdapterService.java:
202)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org
.glassfish
.gms
.bootstrap.GmsAdapterService.checkAllClusters(GmsAdapterService.java:
170)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org
.glassfish
.gms.bootstrap.GmsAdapterService.postConstruct(GmsAdapterService.java:
124)|#]

[#|2010-06-29T15:03:44.243-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:
174)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
java.security.AccessController.doPrivileged(Native Method)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:
84)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:
58)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com
.sun
.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:
60)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com
.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:
236)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com
.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:
128)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.enterprise.module.bootstrap.Main.launch(Main.java:458)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
com.sun.enterprise.module.bootstrap.Main.launch(Main.java:402)|#]

[#|2010-06-29T15:03:44.244-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.jvnet.hk2.osgiadapter.HK2Main
$StartupContextService.updated(HK2Main.java:102)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.apache.felix.cm.impl.ConfigurationManager
$UpdateConfiguration.run(ConfigurationManager.java:1389)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:88)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;|Caused by:
java.lang.ClassNotFoundException:
com.sun.enterprise.ee.cms.core.GMSFactory|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org
.apache
.felix
.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:
772)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.apache.felix.framework.ModuleImpl
$ModuleClassLoader.loadClass(ModuleImpl.java:1685)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
java.lang.ClassLoader.loadClass(ClassLoader.java:248)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org
.apache
.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:634)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.apache.felix.framework.resolver.WireImpl.getClass(WireImpl.java:
99)|#]

[#|2010-06-29T15:03:44.245-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.apache.felix.framework.ModuleImpl.searchImports(ModuleImpl.java:
1345)|#]

[#|2010-06-29T15:03:44.246-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org
.apache
.felix
.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:
711)|#]

[#|2010-06-29T15:03:44.246-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)|#]

[#|2010-06-29T15:03:44.246-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
org.apache.felix.framework.ModuleImpl
$ModuleClassLoader.loadClass(ModuleImpl.java:1685)|#]

[#|2010-06-29T15:03:44.246-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| at
java.lang.ClassLoader.loadClass(ClassLoader.java:248)|#]

[#|2010-06-29T15:03:44.246-0400|SEVERE|glassfish3.1|null|
_ThreadID=12;_ThreadName=Thread-1;| ... 29 more|#]


>
> Also, if you telnet into the GF server you can verify that the
> bundle is wired properly using the "inspect package requirement
> <bundle-id>" command or "inspect p r <bundle-id>" for short, where
> <bundle-id> is the ID of the bundle doing the import...

Except the server won't start because of this unless there are no
clusters, at which point the gms-adapter code is never loaded anyway.

Thanks,
Bobby