Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

serviceComponets.xml

Avatar

Level 6

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 ?

1 Accepted Solution

Avatar

Correct answer by
Level 10

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.

View solution in original post

6 Replies

Avatar

Level 10

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]

Avatar

Level 6

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

Avatar

Correct answer by
Level 10

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.

Avatar

Level 6

thank you, i will follow the documentation you provided

Avatar

Level 10

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 ??

Avatar

Level 6

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.