[ https://issues.apache.org/jira/browse/FELIX-5902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574423#comment-16574423 ]
Carsten Ziegeler edited comment on FELIX-5902 at 8/9/18 7:44 AM: ----------------------------------------------------------------- Actually my above comment is missing the fact, that the getLogger(Bundle, String, Class) method is used which explicitly states that the bundle needs to be resolved in the specification. It's possible to log in an bundle activator but not by using this method (which makes sense). So SCR should not use this method to get the logger for itself as it already has the LogService/LoggerFactory from the service registry. For the logger instance SCR gets on behalf of extended bundles, the bundles are in the resolved/active state, so that's fine to use the bundle as a first argument Or in other words, we need to fix this in SCR was (Author: cziegeler): Actually my above comment is missing the fact, that the getLogger(Bundle, String, Class) method is used which explicitly states that the bundle needs to be resolved in the specification. It's possible to log in an bundle activator but not by using this method (which makes sense). So SCR should not use this method to get the logger for itself as it already has the LogService/LoggerFactory from the service registry. For the logger instance SCR gets on behalf of extended bundles, the bundles are in the resolved/active state, so that's fine to use the bundle as a first argument > java.lang.IllegalArgumentException: Bundle org.apache.felix.scr [81] is not > resolved. > ------------------------------------------------------------------------------------- > > Key: FELIX-5902 > URL: https://issues.apache.org/jira/browse/FELIX-5902 > Project: Felix > Issue Type: Bug > Components: Declarative Services (SCR), Log Service > Affects Versions: log-1.2.0, framework-6.0.0, scr-2.1.2 > Environment: MacOS 10.14, JDK 8, bnd-maven-plugin 4.0.0 > Reporter: Rakesh Kumar > Assignee: Carsten Ziegeler > Priority: Blocker > Fix For: scr-2.1.4 > > Attachments: SCRandLogServiceBundleIds.png, Screenshot 2018-08-08 at > 7.16.38 AM.png, Screenshot 2018-08-08 at 7.17.09 AM.png > > > I have updated to SCR 2.1.2 with Felix LogService 1.2.0 and getting > java.lang.IllegalArgumentException: Bundle org.apache.felix.scr [81] is not > resolved. > IMHO, this happens due to the > *org.apache.felix.log.LogServiceImpl*#getLogger(Bundle bundle, String name, > Class<L> loggerType) checking if the calling Bundle is in *active* or > *resolved* state. ** Since the SCR bundle is in *starting* state which > throws the above mentioned exception. > > Here is the stack trace. > > {code:java} > java.lang.IllegalArgumentException: Bundle org.apache.felix.scr [81] is not > resolved. > at org.apache.felix.log.LogServiceImpl.getLogService(LogServiceImpl.java:153) > at org.apache.felix.log.LogServiceImpl.getLogger(LogServiceImpl.java:146) > at > org.apache.felix.scr.impl.logger.R7LogServiceLogger.<init>(R7LogServiceLogger.java:35) > at > org.apache.felix.scr.impl.logger.LogServiceSupport.getLogger(LogServiceSupport.java:69) > at > org.apache.felix.scr.impl.logger.LogServiceEnabledLogger.getLogger(LogServiceEnabledLogger.java:106) > at > org.apache.felix.scr.impl.logger.AbstractLogger.isLogEnabled(AbstractLogger.java:71) > at > org.apache.felix.scr.impl.logger.AbstractLogger.log(AbstractLogger.java:110) > at org.apache.felix.scr.impl.Activator.restart(Activator.java:143) > at > org.apache.felix.scr.impl.config.ScrConfigurationImpl.configure(ScrConfigurationImpl.java:213) > at > org.apache.felix.scr.impl.config.ScrConfigurationImpl.start(ScrConfigurationImpl.java:118) > at org.apache.felix.scr.impl.Activator.start(Activator.java:100) > at > org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697) > at org.apache.felix.framework.Felix.activateBundle(Felix.java:2398) > at org.apache.felix.framework.Felix.startBundle(Felix.java:2304) > at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1535) > at > org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) > at java.lang.Thread.run(Thread.java:748){code} > > Please look into this as I am blocked due to this. -- This message was sent by Atlassian JIRA (v7.6.3#76005)