I have a component in failed activation state and the error in logs say:
28.12.2021 12:04:04.168 *WARN* [FelixStartLevel] wda.wda-bundle bundle wda.wda-bundle:1.0.0.SNAPSHOT (474)[com.mycom.wda.cms.impl.ConfigUtilServiceImpl(2761)] : bindRepository cannot be found (java.lang.VerifyError: Expecting a stackmap frame at branch target 13
Exception Details:
Location:
com/mycom/wda/cms/impl/ConfigUtilServiceImpl.unbindResolverFactory(Lorg/apache/sling/api/resource/ResourceResolverFactory;)V @5: if_acmpne
Reason:
Expected stackmap frame at this location.
Bytecode:
0x0000000: 2ab4 003d 2ba6 0008 2a01 b500 3db1
)
java.lang.VerifyError: Expecting a stackmap frame at branch target 13
Exception Details:
Location:
com/mycom/wda/cms/impl/ConfigUtilServiceImpl.unbindResolverFactory(Lorg/apache/sling/api/resource/ResourceResolverFactory;)V @5: if_acmpne
Reason:
Expected stackmap frame at this location.
Bytecode:
0x0000000: 2ab4 003d 2ba6 0008 2a01 b500 3db1
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at org.apache.felix.scr.impl.inject.methods.BaseMethod.getMethod(BaseMethod.java:326) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BindMethod.getServiceReferenceMethod(BindMethod.java:407) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BindMethod.doFindMethod(BindMethod.java:109) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.findMethod(BaseMethod.java:173) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$400(BaseMethod.java:41) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BaseMethod$NotResolved.resolve(BaseMethod.java:602) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BaseMethod$NotResolved.methodExists(BaseMethod.java:626) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.methodExists(BaseMethod.java:528) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.inject.methods.BindMethod.getServiceObject(BindMethod.java:659) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.DependencyManager.getServiceObject(DependencyManager.java:2308) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.prebind(DependencyManager.java:1154) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.DependencyManager.prebind(DependencyManager.java:1568) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.collectDependencies(AbstractComponentManager.java:1029) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:935) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:900) [org.apache.felix.scr:2.1.16]
at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:348)
at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:248)
at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:350)
at org.apache.felix.framework.Felix.getService(Felix.java:3954)
at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:450)
at org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:416)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.delegateAddService(ResourceTracker.java:51) [com.eclipsesource.jaxrs.publisher:3.2.0.201312310810]
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:43) [com.eclipsesource.jaxrs.publisher:3.2.0.201312310810]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903)
at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990)
at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4833)
at org.apache.felix.framework.Felix.registerService(Felix.java:3804)
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:906) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:892) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:128) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:959) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:732) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:338) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:382) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:264) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169) [org.apache.felix.scr:2.1.16]
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49) [org.apache.felix.scr:2.1.16]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:420)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4817)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2336)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1539)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
at java.lang.Thread.run(Unknown Source)
28.12.2021 12:04:04.169 *ERROR* [FelixStartLevel] wda.wda-bundle bundle wda.wda-bundle:1.0.0.SNAPSHOT (474)[com.mycom.wda.cms.impl.ConfigUtilServiceImpl(2761)] : bind method [bindRepository] not found; Component will fail
Any idea how to resolve this? Do I need to create/override this method? The same error also happens for bindResolverFactory.
Views
Replies
Total Likes
Hi @aemdev_k
Is it possible for you to share this class - ConfigUtilServiceImpl
Would like to know how you are referencing the Repository and ResourceResolverFactory
Also, could you please let know if you have updated the Java version recently.
Hi @Vijayalakshmi_S ,
I am upgrading from 6.2 to 6.5 and this happens at 6.5.
As for Java, there is no change - 8 only.
Not only this class is having this issue but all classes with @Reference in code (Even HelloService).
package com.mycom.wda.cms.impl; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.Properties; import javax.jcr.Session; import org.apache.commons.lang.StringUtils; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.Service; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.jcr.api.SlingRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; //import www.wda.webService.service.PropertiesUtil; import com.mycom.wda.cms.ConfigUtilService; import com.mycom.wda.cms.HelloService; /** * One implementation of the {@link HelloService}. Note that the repository is * injected, not retrieved. */ @Service(ConfigUtilService.class) @Component(metatype = false) public class ConfigUtilServiceImpl implements ConfigUtilService { private static final Logger LOG = LoggerFactory .getLogger(ConfigUtilServiceImpl.class); @Reference private SlingRepository repository; @Reference private ResourceResolverFactory resolverFactory; private static String GLOBAL_Properties_Path = "/etc/designs/properties/global.properties"; private static String API_Properties_Path = "/etc/designs/properties/api.properties"; private static String OFFSET_Properties_Path = "/etc/designs/properties/offset.properties"; static{ try{ Properties prop = new Properties(); prop.load(ConfigUtilServiceImpl.class.getClassLoader().getResourceAsStream("config.properties")); File systemFile = new File(prop.getProperty("ENV_Config_File_Path")); if(systemFile.exists()){ try{ InputStream ins = new FileInputStream(systemFile); prop.load(ins); String env = prop.getProperty("ENV"); if(StringUtils.isNotEmpty(env)){ GLOBAL_Properties_Path = "/etc/designs/properties/" + env + "/global.properties"; API_Properties_Path = "/etc/designs/properties/" + env + "/api.properties"; OFFSET_Properties_Path = "/etc/designs/properties/" + env + "/offset.properties"; } }catch(Exception ex){ LOG.error(ex.getMessage(),ex); } } }catch(Exception ex){ LOG.error(ex.getMessage(),ex); } } public String getGlobalProperty(String propKey) { return getProperty(propKey,GLOBAL_Properties_Path); } public String getApiProperty(String propKey) { return getProperty(propKey,API_Properties_Path); } public String getOffsetProperty(String propKey) { return getProperty(propKey,OFFSET_Properties_Path); } private String getProperty(String propKey,String propertyfile) { Session adminSession = null; String propValue = null; try { Map<String, Object> map = new HashMap<String, Object>(); //adminSession = repository.loginAdministrative(null); adminSession = repository.loginService(null, null); map.put("user.jcr.session", adminSession); ResourceResolver resourceResolver = resolverFactory .getResourceResolver(map); Resource res = resourceResolver.getResource(propertyfile); Properties prop = new Properties(); InputStream ins = res.adaptTo(InputStream.class); prop.load(ins); propValue = prop.getProperty(propKey.trim()); if (propValue != null) { propValue = propValue.trim(); } } catch (Exception e) { LOG.error(e.getMessage(), e); } finally { if (adminSession != null && adminSession.isLive()) { adminSession.logout(); adminSession = null; } } return propValue; } }
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies