PicoContainer

Container startup bug when a component throws a InvocationTargetException

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.8
  • Fix Version/s: 2.9
  • Component/s: PicoContainer (Java)
  • Labels:
    None
  • Environment:
    Any
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

When a container configured with a lifecycle reflection strategy is started and that a container component throws a InvocationTargetException during startup, the ReflectionLifecycleStrategy class can fails when trying to cast the InvocationTargetException cause to (Error). All the original stack trace is lost and make it impossible to know what has really happened and debug the real problem.

See patch for the most clearest explanation possible : the code

Issue Links

Activity

Hide
Freddy Mallet added a comment -

For instance, when a NoClassDefFoundError is encountered we get the following exception and there is no way to get the root message :

Caused by: java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot b
e cast to java.lang.Exception
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(
ReflectionLifecycleStrategy.java:115)
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(Reflect
ionLifecycleStrategy.java:89)
        at org.picocontainer.adapters.InstanceAdapter.start(InstanceAdapter.java
:113)
        at org.picocontainer.adapters.InstanceAdapter.start(InstanceAdapter.java
:91)
        at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoConta
iner.java:882)
        at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.jav
a:630)
Show
Freddy Mallet added a comment - For instance, when a NoClassDefFoundError is encountered we get the following exception and there is no way to get the root message :
Caused by: java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot b
e cast to java.lang.Exception
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(
ReflectionLifecycleStrategy.java:115)
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(Reflect
ionLifecycleStrategy.java:89)
        at org.picocontainer.adapters.InstanceAdapter.start(InstanceAdapter.java
:113)
        at org.picocontainer.adapters.InstanceAdapter.start(InstanceAdapter.java
:91)
        at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoConta
iner.java:882)
        at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.jav
a:630)
Hide
Freddy Mallet added a comment -

Sorry to come back on this issue, but this bug is becoming very critical for Sonar. Any chance to be applied in a upcoming version ? Thanks for your help.
Freddy

Show
Freddy Mallet added a comment - Sorry to come back on this issue, but this bug is becoming very critical for Sonar. Any chance to be applied in a upcoming version ? Thanks for your help. Freddy
Hide
Paul Hammant added a comment -

Fixed, test added.

Show
Paul Hammant added a comment - Fixed, test added.
Hide
Freddy Mallet added a comment -

Thanks a lot Paul !

Show
Freddy Mallet added a comment - Thanks a lot Paul !

People

Vote (6)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: