If I place
package StoreLocator.Shoprite.Onnet;
import java.util.ArrayList;
import Objects.Stores;
public interface StoreLocator {
public ArrayList<Stores> getStores(Integer countryId);
}
and then in my implementation class
@Component
@Service
public class StoreLocatorImpl implements StoreLocator {
private ArrayList<Stores> storesArrayList = new ArrayList<Stores>();
public ArrayList<Stores> getStores(Integer countryId) {
try {
FetchStores fetchStores = new FetchStores(countryId);
storesArrayList = fetchStores.getStoresArrayList();
} catch (Exception e) {
e.printStackTrace();
}
return storesArrayList;
}
}
I would expect to see
Service ID 123456 | Types: StoreLocator.Shoprite.Onnet.StoreLocator |
For example below
Symbolic Name | com.shoprite.specialsandcoupons.specialsandcoupons-bundle |
Version | 1.0.0.SNAPSHOT |
Bundle Location | inputstream:specialsandcoupons-bundle-1.0-SNAPSHOT.jar |
Last Modification | Thu Oct 23 00:36:37 CAT 2014 |
Description | Maven Multimodule project for specialsandcoupons. |
Start Level | 20 |
Exported Packages | Objects,version=1.0.0.SNAPSHOT com.shoprite.specialsandcoupons,version=1.0.0 |
Imported Packages | javax.net.ssl,version=0.0.0.1_007_JavaSE from org.apache.felix.framework (0) javax.servlet,version=2.6.0 from org.apache.felix.http.servlet-api (29) javax.servlet,version=3.0.0 from org.apache.felix.http.servlet-api (29) javax.xml.parsers,version=0.0.0.fragment_xml from org.apache.felix.framework (0) org.apache.sling.api,version=2.3.0 from org.apache.sling.api (184) org.apache.sling.api.request,version=2.4.0 from org.apache.sling.api (184) org.slf4j,version=1.7.6 from slf4j.api (14) org.w3c.dom,version=0.0.0.fragment_xml from org.apache.felix.framework (0) org.xml.sax,version=0.0.0.fragment_xml from org.apache.felix.framework (0) |
Importing Bundles | StoreLocator.Shoprite.Onnet.StoreLocator.Shoprite.Onnet-bundle (436) |
Service ID 14934 | Types: com.shoprite.specialsandcoupons.ISpecialsAndCoupons Service PID: com.shoprite.specialsandcoupons.impl.SpecialsAndCoupons Component Name: com.shoprite.specialsandcoupons.impl.SpecialsAndCoupons Component ID: 1840 |
Service ID 14935 | Types: javax.servlet.Filter Service PID: com.shoprite.specialsandcoupons.impl.filters.LoggingFilter Component Name: com.shoprite.specialsandcoupons.impl.filters.LoggingFilter Component ID: 1841 |
Manifest Headers | Bnd-LastModified: 1414017371564 Build-Jdk: 1.7.0_60 Built-By: clive Bundle-Description: Maven Multimodule project for specialsandcoupons. Bundle-ManifestVersion: 2 Bundle-Name: specialsandcoupons Bundle Bundle-SymbolicName: com.shoprite.specialsandcoupons.specialsandcoupons-bundle Bundle-Version: 1.0.0.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: Objects; version="1.0.0.SNAPSHOT", com.shoprite.specialsandcoupons; uses:=Objects; version="1.0.0" Import-Package: Objects; version="[1.0, 2)", com.shoprite.specialsandcoupons; version="[1.0, 2)", javax.net.ssl, javax.servlet, javax.xml.parsers, org.apache.sling.api; version="[2.1, 3)", org.apache.sling.api.request; version="[2.1, 3)", org.slf4j; version="[1.5, 2)", org.w3c.dom, org.xml.sax Manifest-Version: 1.0 Service-Component: OSGI-INF/serviceComponents.xml Tool: Bnd-1.50.0 |
But for StoreLocator.Shoprite.Onnet.StoreLocator.Shoprite.Onnet-bundle I only get
Symbolic Name | StoreLocator.Shoprite.Onnet.StoreLocator.Shoprite.Onnet-bundle |
Version | 1.0.0.SNAPSHOT |
Bundle Location | inputstream:StoreLocator.Shoprite.Onnet-bundle-1.0-SNAPSHOT.jar |
Last Modification | Wed Oct 29 01:53:17 CAT 2014 |
Description | Maven Multimodule project for StoreLocator.Shoprite.Onnet. |
Start Level | 20 |
Exported Packages | StoreLocator.Shoprite.Onnet,version=1.0.0 |
Imported Packages | Objects,version=1.0.0.SNAPSHOT from com.shoprite.specialsandcoupons.specialsandcoupons-bundle (403) javax.json,version=1.0.0 from JSon.Javax (428) javax.json.stream,version=1.0.0 from JSon.Javax (428) javax.servlet,version=2.6.0 from org.apache.felix.http.servlet-api (29) javax.servlet,version=3.0.0 from org.apache.felix.http.servlet-api (29) org.apache.http,version=1.0.0 from osgi.httpclient.apache (431) org.apache.http.client,version=4.3.0 from client.http (430) org.apache.http.client.methods,version=4.3.0 from client.http (430) org.apache.http.impl.client,version=4.3.0 from client.http (430) org.apache.http.util,version=1.0.0 from osgi.httpclient.apache (431) org.apache.log4j,version=1.2.17 from log4j.over.slf4j (3) org.apache.sling.api,version=2.3.0 from org.apache.sling.api (184) org.apache.sling.api.request,version=2.4.0 from org.apache.sling.api (184) org.apache.sling.jcr.api,version=2.2.0 from org.apache.sling.jcr.api (104) org.slf4j,version=1.7.6 from slf4j.api (14) |
Manifest Headers | Bnd-LastModified: 1414540345037 Build-Jdk: 1.7.0_60 Built-By: clive Bundle-Description: Maven Multimodule project for StoreLocator.Shoprite.Onnet. Bundle-ManifestVersion: 2 Bundle-Name: StoreLocator.Shoprite.Onnet Bundle Bundle-SymbolicName: StoreLocator.Shoprite.Onnet.StoreLocator.Shoprite.Onnet-bundle Bundle-Version: 1.0.0.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: Objects; version="1.0.0.SNAPSHOT", StoreLocator.Shoprite.Onnet; uses:=Objects; version="1.0.0" Import-Package: Objects, StoreLocator.Shoprite.Onnet; version="[1.0, 2)", javax.json; version="[1.0, 2)", javax.json.stream; version="[1.0, 2)", javax.servlet, org.apache.http, org.apache.http.client; version="[4.3, 5)", org.apache.http.client.methods; version="[4.3, 5)", org.apache.http.impl.client; version="[4.3, 5)", org.apache.http.util, org.apache.log4j, org.apache.sling.api; version="[2.1, 3)", org.apache.sling.api.request; version="[2.1, 3)", org.apache.sling.jcr.api; version="[2.1, 3)", org.slf4j; version="[1.5, 2)" Manifest-Version: 1.0 Tool: Bnd-1.50.0 |
Solved! Go to Solution.
Views
Replies
Total Likes
From your other thread - looks like you are trying to build your bundle using CRXDE lite - use Maven as specified in the article -- not CRXDE Lite. If you follow every step - you will get it working.
Views
Replies
Total Likes
My guess - your Maven project is missing the configuration of the scr plugin, which takes those @Component and @Service annotations and generates the Declarative Services XML files from them.
Views
Replies
Total Likes
Can you invoke your Service?
In this case - you should be able to invoke the service by :
StoreLocator.Shoprite.Onnet.StoreLocator storeLocator = sling.getService(StoreLocator.Shoprite.Onnet.StoreLocator.class);
storeLocator .getStores("code") ;
For others reading this thread and wanting to know how to create an AEM Service - see:
Creating your first AEM Service using an Adobe Maven Archetype project
Views
Replies
Total Likes
From your other thread - looks like you are trying to build your bundle using CRXDE lite - use Maven as specified in the article -- not CRXDE Lite. If you follow every step - you will get it working.
Views
Replies
Total Likes
I tested this article against AEM 6 - it works fine. Here is the output in AEM 6 and Touch UI:
[img]Key6.png[/img]
Views
Replies
Total Likes