Issue Details (XML | Word | Printable)

Key: OSGI-536
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Costin Leau
Reporter: Andy Wilkinson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring OSGi

DependencyServiceManager swallows exception and then NPEs leading to error poor diagnostics

Created: 20/Jun/08 07:39 AM   Updated: 26/Jun/08 04:20 AM
Component/s: EXTENDER
Affects Version/s: 1.1 M2
Fix Version/s: 1.1 RC1

Time Tracking:
Not Specified


 Description  « Hide
DependencyServiceManager.findServiceDependencies swallows exception from getServiceDependencies():

try {
    discoveredDependencies = dependencyFactory.getServiceDependencies(bundleContext, beanFactory);
}
catch (Exception ex) {
    log.warn("Dependency factory " + dependencyFactory
        + " threw exception while detecting dependencies for beanFactory " + beanFactory, ex);
}

It then attempts to use discoveredDependncies and NPEs. Running in S2AP it's this NPE that's presented most prominently to the user:

java.lang.NullPointerException
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager.findServiceDependencies(DependencyServiceManager.java:222)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:249)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:173)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:136)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:749)
at com.springsource.platform.kernel.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:82)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:613)

You have to dig in the trace files (and have some understanding of the source code) to figure out that the real problem is the exception thrown from getServiceDependencies

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Costin Leau added a comment - 23/Jun/08 12:51 AM
Andy, the exception is now properly propagated which means the application context fails and an event properly generated for it. Let me know how this works for you.

Andy Wilkinson added a comment - 26/Jun/08 04:20 AM
Perfect. Thanks for the fix.