No OSGi SCR metadata found | Community
Skip to main content
New Participant
July 19, 2017
Solved

No OSGi SCR metadata found

  • July 19, 2017
  • 6 replies
  • 11994 views

I am  trying to setup my env for unit test for sling models for AEM 6.3

there is one error I see when running maven build

Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 1.165 sec <<< FAILURE! - in com.mcmc.aem.models.impl.BreadcrumbImplTest

testStyleBasedBreadcrumb(org.cshs.aem.models.impl.BreadcrumbImplTest)  Time elapsed: 0.995 sec  <<< ERROR!

java.lang.RuntimeException: After setup failed (com.adobe.cq.wcm.core.components.context.CoreComponentTestContext$$Lambda$1/1468177767@72cf2de5): No OSGi SCR metadata found for class com.adobe.cq.wcm.core.components.testing.MockAdapterFactory

  at org.apache.sling.testing.mock.osgi.context.ContextPlugins.executeAfterSetUpCallback(ContextPlugins.java:210)

I have been following the project from

GitHub - Adobe-Marketing-Cloud/aem-core-wcm-components: AEM Core WCM Components

I have build plugins and configurations same as  aem-core-wcm-components/pom.xml at master · Adobe-Marketing-Cloud/aem-core-wcm-components · GitHub

that should take care of metadata

Not sure why this error is coming

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ratna_Kumar

Hi,

We have Adobe HELPX Article on this core components which also includes Sling Models: Developing your first Experience Manager 6.3 Components

Please try this article!

~Ratna.

6 replies

New Participant
August 14, 2023

Hi Shajiahmed,
I too faced the same issue, but once I tried to build the project and then ran test cases.All cases passed for me.

Employee
November 29, 2018

To resolve the No OSGi SCR metadata found error, you need to follow the instructions here: Apache Felix - Apache Felix Bundle Plugin Frequently Asked Questions

New Participant
April 25, 2018

Hello Ratna,

The link you provided, it doesn't solve the issue.

i am using AEM 6.3 + SP1, i included following dependency .

<dependency>

<groupId>io.wcm</groupId>

<artifactId>io.wcm.testing.aem-mock</artifactId>

<version>2.2.2</version>

<scope>test</scope>

</dependency>

Given below is my test class.

@Rule

    public AemContext aemContext = new AemContext(appContextSetup, ResourceResolverType.RESOURCERESOLVER_MOCK);

@Test

    public void resourceTest() {

  

    ResourceResolver resolver = aemContext.resourceResolver();

    assertNotNull(resolver);

    }

When i try to execute i get

No OSGi SCR metadata found !!!

could you please help me with it.

i am stuck here.

Thank you.

Saurabh

New Participant
July 20, 2017

Hi Lokesh,

I still see the same issue after adding maven-enforcer plugin, I am using maven 3.5.0, I changed the requireMavenVersion to 3.5.0 and using Java 1.8

Techaspect_Solu
New Participant
July 20, 2017

Hi Shajiahmed,

Could you please change the maven version in the pom file under "aem-core-wcm-components-master\aem-core-wcm-components-master\parent\pom.xml" as below(Possibly which your current maven version.Here 3.2.5 is my local maven version)

         <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-enforcer-plugin</artifactId>

                <executions>

                    <execution>

                        <id>enforce-maven</id>

                        <goals>

                            <goal>enforce</goal>

                        </goals>

                        <configuration>

                            <rules>

                                <requireMavenVersion>

                                    <version>[3.2.5,)</version>

                                </requireMavenVersion>

                                <requireJavaVersion>

                                    <message>Project must be compiled with Java ${aem.java.version} or higher</message>

                                    <version>1.${aem.java.version}</version>

                                </requireJavaVersion>

                            </rules>

                        </configuration>

                    </execution>

                </executions>

            </plugin>

And also make sure that your JAVA version is 1.8.

Please find the attached screenshot of build success.

Thanks,

Techaspect Solutions.

Ratna_Kumar
Ratna_KumarAccepted solution
New Participant
July 20, 2017

Hi,

We have Adobe HELPX Article on this core components which also includes Sling Models: Developing your first Experience Manager 6.3 Components

Please try this article!

~Ratna.