Skip to main content
Var
Level 4
Mar 12, 2017 12:26 AM UTC
Solved

Failed to execute goal (generate-scr-scrdescriptor) on project Unable to load compiled class

Hi There,

am using the below plugins to build my project. and one of my servlet is getting the below error. have any one faced the same issue before.?

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-scr-plugin</artifactId> <version>1.20.0</version> <executions> <execution> <id>generate-scr-scrdescriptor</id> <goals> <goal>scr</goal> </goals> <configuration> <!-- Private service properties for all services. --> <properties> <service.vendor>Adobe</service.vendor> </properties> </configuration> </execution> </executions> <configuration> <outputDirectory>${project.build.directory}/classes</outputDirectory> </configuration> <dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.5.11</version> </dependency> </dependencies> </plugin>

 

[ERROR] Failed to execute goal org.apache.felix:maven-scr-plugin:1.20.0:scr (generate-scr-scrdescriptor) on project osgiexample.core: E:\MY-Work\TESTProj\osgiexample\core\src\main\java\osgiexample\core\servlets\MyDataProviderServlet.java : Unable to load compiled class: osgiexample.core.servlets.MyDataProviderServlet -> [Help 1]

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Feike_Visser1
Feike_Visser1Accepted solution
Adobe Employee
Mar 14, 2017 7:28 AM UTC

You can remove @Component and @Service from MyDataProviderServlet, not needed when you have @SlingServlet.

After doing that it builds on my machine.

12 replies

Feike_Visser1
Adobe Employee
Adobe Employee
Mar 12, 2017 9:51 AM UTC

What version of maven and Java are you using?

Translate
smacdonald2008
Level 10
Mar 13, 2017 2:37 PM UTC

Can you build SimpleServlet following this article: https://helpx.adobe.com/experience-manager/using/first-arch10.html

Translate
Ratna_Kumar
Level 10
Mar 13, 2017 6:34 PM UTC

Hi,

As scott stated, try this article how to create an AEM project by using Maven Adobe Archetype 10 and use those dependencies.

//https://helpx.adobe.com/experience-manager/using/first-arch10.html

Let us know, in case if you face any issues.

~ Ratna

Translate
Var
VarAuthor
Level 4
Mar 13, 2017 6:44 PM UTC

smacdonald2008 wrote...

Can you build SimpleServlet following this article: https://helpx.adobe.com/experience-manager/using/first-arch10.html

 

 

HI Scott, am using the same archetype10 structure created project. And worte the servlet. as shown below code snippet.

@SuppressWarnings("serial") @SlingServlet(paths="/services/mydataprovider/callservice") @Service(MyDataProvider.class) @Component(label = "Dropdown Data data provider", description = "This servlet provides data for the custom drop down", enabled = true, immediate = true, metatype = false) public class MyDataProviderServlet extends SlingAllMethodsServlet{ .. }
Translate
smacdonald2008
Level 10
Mar 13, 2017 7:28 PM UTC

I can help you - but need to see more details of the code. Email me at scottm@adobe.com.  Looks like there is something mis-configured. 

Translate
Var
VarAuthor
Level 4
Mar 13, 2017 8:06 PM UTC

Feike Visser wrote...

What version of maven and Java are you using?

 

Hi Feike,

Am using Java version: 1.7.0_45 & Maven 3.1.1

~VAr

Translate
Feike_Visser1
Adobe Employee
Adobe Employee
Mar 13, 2017 8:13 PM UTC

Can you upgrade your maven version? I am using 3.3.9

Translate
Var
VarAuthor
Level 4
Mar 13, 2017 9:04 PM UTC

Feike Visser wrote...

Can you upgrade your maven version? I am using 3.3.9

 

HI Feike, 

Now i started getting a different error after maven upgrade and build.

[ERROR] E:\MY-Work\testporj\osgiexample\core\src\main\java\osgiexample\core\servlets\MyDataProviderServlet.java [1:1]: Class has more than one component definition. Check the annotations and merge the definitions to a single definition.

Code Package link ::  https://drive.google.com/file/d/0B5YKUUmw4jJaSEtkUk1ZWVF2anc/view?usp=sharing

~VAr

Translate
Var
VarAuthor
Level 4
Mar 13, 2017 9:18 PM UTC

Translate
Feike_Visser1
Adobe Employee
Feike_Visser1Adobe EmployeeAccepted solution
Adobe Employee
Mar 14, 2017 7:28 AM UTC

You can remove @Component and @Service from MyDataProviderServlet, not needed when you have @SlingServlet.

After doing that it builds on my machine.

Translate