Expand my Community achievements bar.

SOLVED

Getting error when deploying mvn project

Avatar

Level 2

I am getting error when I deploy mvn project .  Non annotation type for activation object with descriptor (Lcom/xxx/sss/ssss;)V, type xxxxx -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal biz.aQute.bnd:bnd-maven-plugin:5.1.2:bnd-process (bnd-process) on project xxxxxx: Non annotation type for activation object with descriptor

1 Accepted Solution

Avatar

Correct answer by
Level 2

With this being fixed, config service is not automatically bounded. I have to manually open and bound it in OSGi config manager.

I have immediate =true in the class

@component(service =  ProviderABCConfigService.class, immediate = true )
@Designate(ocd = ProviderABCConfigServiceImpl.Config.class)

 

 

View solution in original post

6 Replies

Avatar

Community Advisor

Can you share the java class where you have this issue?



Arun Patidar

Avatar

Level 2

Here is my interface

package com.xyz.aem.service;
 
public interface ProviderABCConfigService {
public String getProviderABCAppKey();
 
public String getProviderABCAppSecret();
 
public String getbDamPath();
 
public boolean isDisablePlugin() ;
 
public String getProviderABCPath() ;
 
public String getDropAccessToken() ;
 
}

Here is my Service Impl 

package  com.xyz.aem.service.impl;
 
 
 
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
 
import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.Designate;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
import com.xyz.aem.service.ProviderABCConfigService;
 
@component(service =  ProviderABCConfigService.class )
@Designate(ocd = ProviderABCConfigServiceImpl.Config.class)
public class ProviderABCConfigServiceImpl implements ProviderABCConfigService {
private static final Logger log = LoggerFactory.getLogger(ProviderABCConfigServiceImpl.class);
public static final String API_URL = "apiUrl";
 
public static final String API_ENDPOINT = "/bin/xyz/ProviderABCapiinfo.json";
public static final String DAM_PATH = "damPath";
public static final String DISABLE_PLUGIN = "disablePlugin";
@ObjectClassDefinition(name = "ProviderABC  Config", description = "OSGi Service providing information about ProviderABC rest apis")
@interface Config {
@AttributeDefinition(name = "ProviderABC app key")
public String ProviderABC_app_key() default "xxx";
 
@AttributeDefinition(name = "ProviderABC app secret", description = "ProviderABC app secret")
public String ProviderABC_app_secret() default "xxxx";
 
@AttributeDefinition(name = "ProviderABC access token", description = "ProviderABC app access token")
public String ProviderABC_access_token() default "xxxxxx";
 
@AttributeDefinition(name = "DAM Path", description = "DAM Path")
public String damPath() default "/content/dam/ProviderABC";
 
@AttributeDefinition(name = "Disable plugin", description = "Check this box to disable ProviderABC dam plugin ")
public boolean disablePlugin() default false;
 
@AttributeDefinition(name = "ProviderABC Path", description = "ProviderABC Path")
public String ProviderABCPath() default "/test";
}
 
private String appKey, appSecret, damPath, ProviderABCPath, accessToken;
private boolean isDisablePlugin;
protected void activate(Config config) {
appKey = config.ProviderABC_app_key();
appSecret = config.ProviderABC_app_secret();
damPath = config.damPath();
isDisablePlugin = config.disablePlugin();
ProviderABCPath = config.ProviderABCPath();
accessToken = config.ProviderABC_access_token();
 
 
}
protected void deactivate() {
log.info("ActivitiesImpl has been deactivated!");
}
 
 
public String getProviderABCAppKey() {
return appKey;
 
}
 
public String getProviderABCAppSecret() {
return appSecret;
 
}
 
public String getbDamPath() {
return damPath;
 
}
 
public boolean isDisablePlugin() {
return isDisablePlugin;
 
}
 
public String getProviderABCPath() {
return ProviderABCPath;
 
}
 
public String getDropAccessToken() {
return accessToken;
 
}
 
}

This is based on https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/developing/osgi-servi...

 

 

Avatar

Level 2

It seems the above code is fine but whenever I try to use this in some class like

@component(service = SomeOtherService.class, immediate = true)

public class SomeOtherServiceImpl implements SomeOtherService {

@reference  //  Or even @OSGIService

private ProviderABCConfigService providerABCConfig;

it returns  

 Non annotation type for activation object with descriptor (Lcom/xyz/aem/service/ProviderABCConfigService;)V, type com/xyz/aem/service/ProviderABCConfigService

Avatar

Level 2

It was my mistake, in the other OSGi class  SomeOtherServiceImpl I have

// @activate

// protected void activate(ProviderABCConfigService config) {

//

// this.xyzConfig = config;

//

// }

This was causing the issue, as soon as I comment this  build worked fine.

Thanks for your help

Avatar

Correct answer by
Level 2

With this being fixed, config service is not automatically bounded. I have to manually open and bound it in OSGi config manager.

I have immediate =true in the class

@component(service =  ProviderABCConfigService.class, immediate = true )
@Designate(ocd = ProviderABCConfigServiceImpl.Config.class)