• Bug
  • Status: Closed
  • 0 Showstopper
  • Resolution: Fixed
  • hhuynh
  • Reporter: tgautier
  • June 24, 2007
  • 0
  • Watchers: 0
  • September 06, 2007
  • August 24, 2007

Description

I am getting the following NPE when loading a config module. The problem is, I have no idea what is causing the problem - we need to wrap this exception so the error is actionable.

2007-06-25 00:07:00,428 INFO - Log file: ‘/Users/tgautier/src/forge/projects/labs/liferay/trunk/logs/client-logs/terracotta-client.log’. java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.tc.object.bytecode.hook.impl.ClassProcessorHelper.createGlobalContext(ClassProcessorHelper.java:401) at com.tc.object.bytecode.hook.impl.ClassProcessorHelper.init(ClassProcessorHelper.java:292) at com.tc.object.bytecode.hook.impl.ClassProcessorHelper.defineClass0Pre(ClassProcessorHelper.java:431) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) Caused by: java.lang.NullPointerException at com.tc.bundles.KnopflerfishOSGi.startBundle(KnopflerfishOSGi.java:134) at com.tc.bundles.KnopflerfishOSGi.startBundle(KnopflerfishOSGi.java:152) at com.tc.plugins.ModulesLoader.initModules(ModulesLoader.java:147) at com.tc.plugins.ModulesLoader.initModules(ModulesLoader.java:82) at com.tc.object.bytecode.hook.impl.DSOContextImpl.(DSOContextImpl.java:87) at com.tc.object.bytecode.hook.impl.DSOContextImpl.createGlobalContext(DSOContextImpl.java:63) ... 18 more

Comments

Steve Harris 2007-06-25

Any idea what happened here?

Fiona OShea 2007-07-02

Can you confirm that this is resolved?

Hung Huynh 2007-07-02

FATAL message with explanation is now shown

Kenney Westerhof 2007-08-15

I had exact the same NPE.

It’s caused when the module file isn’t found in the module directory. This happens when it doesn’t exactly follow the regexp pattern which is in java “.+-.+” + “\d+\.\d+\.\d+” + “.jar” (so: .+-.+-\d+.\d+.\d+.jar), so only files named like “foo-bar-1.2.3.jar” are matched. The code still does a getBundleId for the module name + version, but doesn’t check if the module is loaded.

When I fixed this by renaming my jar, i got a FATAL message: FATAL: BundleActivator start failed. I grepped the code but no match on ‘BundleActivator start failed”, so I guess this is in Knopflerfish somewhere.

Juris Galang 2007-08-15

Some additional background: We early on decided that config-bundle jar files are named following the pattern you described. On startup TC will attempt to install (as an OSGi bundle) any such files found under the modules directory (and other repositories listed in the tc-config.xml file);

Knopflerfish installs the JAR no matter if its a config-bundle or not. Your config bundle should have a symbolic name (see the MANIFEST.MF file of one of the bundles that come with TC, it’s the entry for Bundle-SymbolicName) – if it doesn’t have a symbolic name it will be assumed to be not a bundle and uninstalled (this is TCs action)


Yes, BundleActivator happens somewhere down in KF, and this usually is because something in the config-bundle’s code crapped out.

Taylor Gautier 2007-08-21

I’m still getting this exception in 2.4.0.

When we receive this exception we need to give a better message than just printing an exception from Knopflerfish.