We are using scr service to get component based on name and added a feature to enable/disable them. This feature is working fine on AEM 6.0 environment. But scr service component always remains unsatisfied on AEM 6.2 (Java 1.8)
Below are the configuration that we are currently using:
POM.xml dependencies:
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
<version>1.9.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>1.6.0</version>
<scope>provided</scope>
</dependency>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.20.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
Any help or suggestions appreciated.
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
We got an alternate solution:
Using ServiceComponentRuntime Reference instead of ScrService to get the OSGi Component.
//Getting component by passing bundle object and component name
serviceComponentRuntime.getComponentDescriptionDTO(bundle, componentName);
//Enabling and disabling component
serviceComponentRuntime.enableComponent(component);
serviceComponentRuntime.disableComponent(component);
Views
Replies
Total Likes
Hi Navneeth,
Can you attach the log files & snapshot of unsatisfied component screen?
Thanks,
Views
Replies
Total Likes
Hi,
PFB the Unsatisfied component:
Reference scrService["Unsatisfied","Service Name: org.apache.felix.scr.ScrService","Cardinality: 1..1","Policy: static","Policy Option: reluctant","No Services bound"]
error.log:
27.06.2017 10:43:01.711 *INFO* [127.0.0.1 [1498574581705] GET /services/test-services/configuration-components HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /services/test-services/configuration-components not found
Views
Replies
Total Likes
Did you use AEM Uber 6.2 JAR?
Views
Replies
Total Likes
Yes.
POM.xml:
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.2.0</version>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>
Views
Replies
Total Likes
Can you try searching for the artifactId in depfinder (host:port/system/console/depfinder). Is it showing the same version which you added in your pom.xml. Try removing the version and scope from your dependency entries. Some times it may solve. Is your corresponding bundle is active in host:port/system/console/bundles.
Views
Replies
Total Likes
We got an alternate solution:
Using ServiceComponentRuntime Reference instead of ScrService to get the OSGi Component.
//Getting component by passing bundle object and component name
serviceComponentRuntime.getComponentDescriptionDTO(bundle, componentName);
//Enabling and disabling component
serviceComponentRuntime.enableComponent(component);
serviceComponentRuntime.disableComponent(component);
Views
Replies
Total Likes