Bram Pouwelse created FELIX-6180:
------------------------------------

             Summary: Component initialization error message get's printed to 
sysout instead of logged to LogService
                 Key: FELIX-6180
                 URL: https://issues.apache.org/jira/browse/FELIX-6180
             Project: Felix
          Issue Type: Bug
          Components: Dependency Manager
            Reporter: Bram Pouwelse


We had a broken component that failed to start (for a good reason): 

{code:java}
@Component(provides = Object.class)
public class BrokenComponent {

    static final Locale defaultLocale = 
Locale.forLanguageTag(System.getProperty("not.set"));

}
{code}

The problem is not that it doesn't work BUT the error log  (see below) never 
reached our central logging (which is consuming the log messages from the 
LogService). 

I this is caused by the fact that this is not an {{Exception}} but an 
{{Error}}, that makes it propagate all the way to the {{SerialExecutor}} which 
is initialized with a new {{LogService}} instance in {{ComponentImpl}} instead 
of getting the {{LogService}} instance that was used to create the 
{{ComponentImpl}}. 


{code}
ERROR: [main] Error processing tasks (java.lang.ExceptionInInitializerError)
java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at 
org.apache.felix.dm.impl.InvocationUtil.createInstance(InvocationUtil.java:342)
    at 
org.apache.felix.dm.impl.ComponentImpl.instantiateComponent(ComponentImpl.java:1073)
    at 
org.apache.felix.dm.impl.ComponentImpl.instantiateComponent(ComponentImpl.java:1046)
    at 
org.apache.felix.dm.impl.ComponentImpl.performTransition(ComponentImpl.java:1221)
    at 
org.apache.felix.dm.impl.ComponentImpl.handleChange(ComponentImpl.java:1166)
    at 
org.apache.felix.dm.impl.ComponentImpl.lambda$start$2(ComponentImpl.java:502)
    at org.apache.felix.dm.impl.SerialExecutor.runTask(SerialExecutor.java:138)
    at org.apache.felix.dm.impl.SerialExecutor.runTasks(SerialExecutor.java:120)
    at org.apache.felix.dm.impl.SerialExecutor.execute(SerialExecutor.java:86)
    at org.apache.felix.dm.impl.SerialExecutor.execute(SerialExecutor.java:105)
    at org.apache.felix.dm.impl.ComponentImpl.start(ComponentImpl.java:500)
    at 
org.apache.felix.dm.impl.ComponentScheduler.add(ComponentScheduler.java:69)
    at org.apache.felix.dm.DependencyManager.add(DependencyManager.java:141)
    at my.project.Activator.init(Activator.java:84)
    at 
org.apache.felix.dm.DependencyActivatorBase.start(DependencyActivatorBase.java:79)
    at 
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:698)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:2402)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2308)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
    at aQute.launcher.Launcher.startBundles(Launcher.java:528)
    at aQute.launcher.Launcher.activate(Launcher.java:427)
    at aQute.launcher.Launcher.run(Launcher.java:306)
    at aQute.launcher.Launcher.main(Launcher.java:152)
    at aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:65)
Caused by: java.lang.NullPointerException
    at sun.util.locale.LocaleUtils.toLowerString(LocaleUtils.java:89)
    at sun.util.locale.LanguageTag.parse(LanguageTag.java:191)
    at java.util.Locale.forLanguageTag(Locale.java:1568)
    at MyBrokenComponent.<clinit>(UserTransformerV1_2.java:17)
    ... 28 more
{code}




--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to