CNFE: Could not initialise class... (one for Simon K?) [message #107058] |
Sat, 29 March 2008 00:25 |
Neale Upstone Messages: 50 Registered: July 2009 |
Member |
|
|
Hi,
There's something within the classloading in Equinox that isn't being
too helpful.
I get the following stack trace output when I start my bundle manually,
having found that it didn't start with the OSGi framework.
If I debug and catch ClassNotFoundException, I find that the failure to
initialise seems to have been caused by the super class of
FuzzAbderaServlet contains a reference to a class that cannot be
resolved, which in this case is: org.apache.commons.logging.Log
There are two things that I want to see in my exception trace that I'm
not seeing:
1) That it is org.apache.commons.logging.Log that is the class that
cannot be found
2) That the context in which it cannot be found is the bundle containing
the base class, AbderaServlet.
(Lastly: It's after midnight on Friday night, here, and I've had 3
Hoegarden, so I'm quite surprised I've tracked this down at all...)
Cheers,
Neale
org.osgi.framework.BundleException: Exception in
com.wwm.atom.impl.Activator.start() of bundle AtomServlet.
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1018)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class
com.wwm.atom.impl.FuzzAbderaServlet
at com.wwm.atom.impl.Activator.start(Activator.java:22)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
... 14 more
Nested Exception:
java.lang.NoClassDefFoundError: Could not initialize class
com.wwm.atom.impl.FuzzAbderaServlet
at com.wwm.atom.impl.Activator.start(Activator.java:22)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
at java.lang.Thread.run(Thread.java:619)
Nested Exception:
java.lang.NoClassDefFoundError: Could not initialize class
com.wwm.atom.impl.FuzzAbderaServlet
at com.wwm.atom.impl.Activator.start(Activator.java:22)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
at
org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
at java.lang.Thread.run(Thread.java:619)
osgi>
|
|
|
Re: CNFE: Could not initialise class... (one for Simon K?) [message #107073 is a reply to message #107058] |
Sat, 29 March 2008 16:50 |
Neale Upstone Messages: 50 Registered: July 2009 |
Member |
|
|
I can answer this one myself now, although I still think that the "Could
not initialise case could be more useful".
I've discovered (source code is useful to send you looking) that on the
OSGi Launch Config, we can set Tracing for org.eclipse.osgi, and that
ticking just "debug" gives about the right amount of information to go
hunting down the library dependencies to put in.
I'm now starting to think that any Java project worth it's salt should
be packaging their Jar as an OSGi bundle. It just makes sense!
Neale wrote:
> Hi,
>
> There's something within the classloading in Equinox that isn't being
> too helpful.
>
> I get the following stack trace output when I start my bundle manually,
> having found that it didn't start with the OSGi framework.
>
> If I debug and catch ClassNotFoundException, I find that the failure to
> initialise seems to have been caused by the super class of
> FuzzAbderaServlet contains a reference to a class that cannot be
> resolved, which in this case is: org.apache.commons.logging.Log
>
> There are two things that I want to see in my exception trace that I'm
> not seeing:
> 1) That it is org.apache.commons.logging.Log that is the class that
> cannot be found
> 2) That the context in which it cannot be found is the bundle containing
> the base class, AbderaServlet.
>
> (Lastly: It's after midnight on Friday night, here, and I've had 3
> Hoegarden, so I'm quite surprised I've tracked this down at all...)
>
> Cheers,
>
> Neale
>
>
> org.osgi.framework.BundleException: Exception in
> com.wwm.atom.impl.Activator.start() of bundle AtomServlet.
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1018)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
>
> at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.NoClassDefFoundError: Could not initialize class
> com.wwm.atom.impl.FuzzAbderaServlet
> at com.wwm.atom.impl.Activator.start(Activator.java:22)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
>
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
>
> ... 14 more
> Nested Exception:
> java.lang.NoClassDefFoundError: Could not initialize class
> com.wwm.atom.impl.FuzzAbderaServlet
> at com.wwm.atom.impl.Activator.start(Activator.java:22)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
>
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
>
> at java.lang.Thread.run(Thread.java:619)
> Nested Exception:
> java.lang.NoClassDefFoundError: Could not initialize class
> com.wwm.atom.impl.FuzzAbderaServlet
> at com.wwm.atom.impl.Activator.start(Activator.java:22)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
>
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
>
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
>
> at java.lang.Thread.run(Thread.java:619)
>
> osgi>
|
|
|
Re: CNFE: Could not initialise class... (one for Simon K?) [message #107180 is a reply to message #107073] |
Mon, 31 March 2008 18:30 |
Simon Kaegi Messages: 381 Registered: July 2009 |
Senior Member |
|
|
Sounds like you've found your way out of this mess. CNFEs can be a real pain
to track down.
For dependencies in 3rd party jars when you don't necessarily have the
source I like use a tool called DependencyFinder.
> I'm now starting to think that any Java project worth it's salt should be
> packaging their Jar as an OSGi bundle. It just makes sense!
Couldn't agree more.
I still do some development where the class-path is flat however I still use
bundles (and PDE) at dev time. Enforced modularity is a good thing.
-Simon
"Neale" <neale@nealeupstone.com> wrote in message
news:fslrvm$1ct$1@build.eclipse.org...
>I can answer this one myself now, although I still think that the "Could
>not initialise case could be more useful".
>
> I've discovered (source code is useful to send you looking) that on the
> OSGi Launch Config, we can set Tracing for org.eclipse.osgi, and that
> ticking just "debug" gives about the right amount of information to go
> hunting down the library dependencies to put in.
>
> I'm now starting to think that any Java project worth it's salt should be
> packaging their Jar as an OSGi bundle. It just makes sense!
>
> Neale wrote:
>> Hi,
>>
>> There's something within the classloading in Equinox that isn't being
>> too helpful.
>>
>> I get the following stack trace output when I start my bundle manually,
>> having found that it didn't start with the OSGi framework.
>>
>> If I debug and catch ClassNotFoundException, I find that the failure to
>> initialise seems to have been caused by the super class of
>> FuzzAbderaServlet contains a reference to a class that cannot be
>> resolved, which in this case is: org.apache.commons.logging.Log
>>
>> There are two things that I want to see in my exception trace that I'm
>> not seeing:
>> 1) That it is org.apache.commons.logging.Log that is the class that
>> cannot be found
>> 2) That the context in which it cannot be found is the bundle containing
>> the base class, AbderaServlet.
>>
>> (Lastly: It's after midnight on Friday night, here, and I've had 3
>> Hoegarden, so I'm quite surprised I've tracked this down at all...)
>>
>> Cheers,
>>
>> Neale
>>
>>
>> org.osgi.framework.BundleException: Exception in
>> com.wwm.atom.impl.Activator.start() of bundle AtomServlet.
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1018)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
>>
>> at java.lang.Thread.run(Thread.java:619)
>> Caused by: java.lang.NoClassDefFoundError: Could not initialize class
>> com.wwm.atom.impl.FuzzAbderaServlet
>> at com.wwm.atom.impl.Activator.start(Activator.java:22)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
>>
>> ... 14 more
>> Nested Exception:
>> java.lang.NoClassDefFoundError: Could not initialize class
>> com.wwm.atom.impl.FuzzAbderaServlet
>> at com.wwm.atom.impl.Activator.start(Activator.java:22)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
>>
>> at java.lang.Thread.run(Thread.java:619)
>> Nested Exception:
>> java.lang.NoClassDefFoundError: Could not initialize class
>> com.wwm.atom.impl.FuzzAbderaServlet
>> at com.wwm.atom.impl.Activator.start(Activator.java:22)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:999)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:993)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:974)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:346)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:265)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:257)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandPro vider._start(FrameworkCommandProvider.java:257)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkCommandInt erpreter.execute(FrameworkCommandInterpreter.java:150)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.do command(FrameworkConsole.java:298)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.co nsole(FrameworkConsole.java:283)
>>
>> at
>> org.eclipse.osgi.framework.internal.core.FrameworkConsole.ru n(FrameworkConsole.java:219)
>>
>> at java.lang.Thread.run(Thread.java:619)
>>
>> osgi>
|
|
|
Powered by
FUDForum. Page generated in 0.02524 seconds