You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Rakesh Kumar (JIRA)" <ji...@apache.org> on 2018/08/08 02:15:00 UTC
[jira] [Commented] (FELIX-5902) java.lang.IllegalArgumentException:
Bundle org.apache.felix.scr [81] is not resolved.
[ https://issues.apache.org/jira/browse/FELIX-5902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16572573#comment-16572573 ]
Rakesh Kumar commented on FELIX-5902:
-------------------------------------
SCR 2.1.0 works with Felix Log Service 1.2.0 though.
Only change I could see now is w.r.t finding out whether runtime is *r7Enabled*
*SCR 2.1.0 Code*
{code:java}
this.r7Enabled = "org.osgi.service.log.LoggerFactory".equals(this.logService.getClass().getSuperclass().getName());{code}
The getSuperClass always returns *java.lang.Object* which can never be equals to *org.osgi.service.log.LoggerFactory* and resulted in using *R6LogServiceLogger*
*SCR 2.1.2 Code,* the code is corrected though and *R7LogServiceLogger* is invoked which results in the *java.lang.IllegalArgumentException***
{code:java}
private static boolean checkForLoggerFactory(Class<?> clazz)
{
while ( clazz != null )
{
final Class<?>[] is = clazz.getInterfaces();
for(final Class<?> c : is)
{
if ( "org.osgi.service.log.LoggerFactory".equals(c.getName()) )
{
return true;
}
if ( checkForLoggerFactory(c) )
{
return true;
}
}
clazz = clazz.getSuperclass();
}
return false;
}
{code}
> 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, scr-2.1.2
> Reporter: Rakesh Kumar
> Priority: Blocker
> Attachments: 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)