Issue
Issue in eclipse and not with maven while running junits. When you try to registerinjectactivateservice which is either
1. a custom osgi service with metadata(metatype), or
2. a sling:osgi configuration
3. servlet with metadata(metatype)
4. org.apache.sling.testing.mock.osgi.NoScrMetadataException: No OSGi SCR metadata found for class za.co.xyz.project.core.services.impl.SiteConfigurationServiceImpl
5. at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.injectServices(OsgiServiceUtil.java:381)
6. at org.apache.sling.testing.mock.osgi.MockOsgi.injectServices(MockOsgi.java:148)
7. at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerInjectActivateService(OsgiContextImpl.java:153)
8. at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerInjectActivateService(OsgiContextImpl.java:141)
9. at za.co.xyz.project.core.models.TestCardGridModel.setUp(TestCardGridModel.java:99)
10. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
12. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13. at java.lang.reflect.Method.invoke(Method.java:498)
Cause
This exception occurs since since eclipse is not able to find the osgi-inf metadata while running junits.
Resolution
This osgi-inf folder is created at /bundles/core/target/classes/OSGI-INF along side meta-inf when you build your project.
No comments:
Post a Comment