serviceComponets.xml | Community
Skip to main content
Xena_bcn
Level 5
October 16, 2015
Solved

serviceComponets.xml

  • October 16, 2015
  • 6 replies
  • 1314 views

hi

So I fixed Sling annotations and now I get a xml file inside OSGI-INF folder inside the JAR

But the xml file name is not serviceComponets.xml but taking the Servlet Class name even with the package name .

 

How to get normal serviceComponets.xml ?

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 smacdonald2008

Try following this AEM article - you will run a maven command that will produce a server-side OSGi bundle that has servicecomponent.xml:

https://helpx.adobe.com/experience-manager/using/creating-aem-project-using-eclipse.html

The OSGi bundle that has EchoService will contain this file. Also - you use the vault too to sync code between the JCR and AEM.

6 replies

smacdonald2008
Level 10
October 16, 2015

Not sure what you mean by "I fixed Sling annotation" - can you provide more details. 

Also - when using mvn:

mvn archetype:generate -DarchetypeRepository=http://repo.adobe.com/nexus/content/groups/public/ -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.2 -DgroupId=com.adobe.cq -DartifactId=key61 -Dversion=1.0-SNAPSHOT -Dpackage=com.adobe.cq -DappsFolderName=myproject -DartifactName="My Project" -DcqVersion="5.6.1" -DpackageGroup="My Company"

the servicecomponent.xml file is located within the OSGi budle

[img]pic1.png[/img]

Xena_bcn
Xena_bcnAuthor
Level 5
October 16, 2015

Thank you,

for this project I always have been using this documentation to develop with Eclipse

https://docs.adobe.com/docs/en/cq/5-5/developing/developmenttools/developing_with_eclipse.html

There is an example POM file and then run Maven install. I didn't use any Maven command from command line.

For Logout Servlet that I need, I added annotations as below, so that OSGI-INF folder was created in Maven install

@Component(enabled = true)
@Service(Servlet.class)
@Properties({
    @Property(name="resourceTypes", value="sling/servlet/default"),
    @Property(name="methods", value="POST"),
    @Property(name="selectors", value="ourlogout"),
    @Property(name="extensions", value="html"),
    @Property(name="service.pid", value="<package>.LogoutServlet",propertyPrivate=false),
})
public class LogoutServlet extends SlingAllMethodsServlet {

 

But the XML file doesn't have this name serrviceComponets.xm

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

Try following this AEM article - you will run a maven command that will produce a server-side OSGi bundle that has servicecomponent.xml:

https://helpx.adobe.com/experience-manager/using/creating-aem-project-using-eclipse.html

The OSGi bundle that has EchoService will contain this file. Also - you use the vault too to sync code between the JCR and AEM.

Xena_bcn
Xena_bcnAuthor
Level 5
October 16, 2015

thank you, i will follow the documentation you provided

Lokesh_Shivalingaiah
Level 10
October 16, 2015

Hi,

If you are using the latest maven archetype 10 to create the AEM project, it will create different XMLs for each of the service that are created. 

Is there need to have a common servicecomponent xml ??

Xena_bcn
Xena_bcnAuthor
Level 5
October 16, 2015

hi @bsloki . 

You might remember my questions, I am copying a project from Live to test server, the project jar in LIVE had this XML.

As I have to make changes in the source, and upload a new JAR , i thought I need that XML with the same name.