You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Scott Hull (JIRA)" <ji...@apache.org> on 2014/07/28 21:02:41 UTC

[jira] [Updated] (KARAF-3142) Karaf 2.3.5 not picking up @Activate for arguments ComponentContext

     [ https://issues.apache.org/jira/browse/KARAF-3142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Hull updated KARAF-3142:
------------------------------

    Description: 
I am unable to get the @Activate command to work with anything other than a nullary operation.

@Annotations are from Felix SCR

For example:

@Component(name="FakeyService", enabled=true)
public class FakeService {

	@Activate
	protected void activate(ComponentContext context){
		System.out.println("Fake Service activated!");
	}

       	public FakeService() {
		System.out.println("FakeService created!");
	}
         
}

In the console (with install -s) I get the following message:
karaf@root>FakeService created!

When I install this into my karaf container, I get the following error in the log:
com.modusoperandi.inputsourcehandler - 1.0.0 | [FakeyService(7)] activate method [activate] not found; Component will fail
com.modusoperandi.inputsourcehandler - 1.0.0 | [FakeyService(7)] Failed creating the component instance; see log for reason


Here is the generated XML file from the annotations:
<?xml version="1.0" encoding="UTF-8"?>

-<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">


-<scr:component modified="modified" deactivate="deactivate" activate="activate" name="FakeyService" enabled="true">

<implementation class="com.modusoperandi.inputsourcehandler.service.FakeService"/>

<property name="service.pid" value="FakeyService"/>

</scr:component>

</components>

Pom project states using 

		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.scr.annotations</artifactId>
			<version>1.9.6</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.scr</artifactId>
			<version>1.8.2</version>
			<scope>provided</scope>
		</dependency>


And using the build plugin 1.17 scr annotations.


  was:
I am unable to get the @Activate command to work with anything other than a nullary operation.

@Annotations are from Felix SCR

For example:

@Component(name="FakeyService", enabled=true)
public class FakeService {

	@Activate
	protected void activate(ComponentContext context){
		System.out.println("Fake Service activated!");
	}

       	public FakeService() {
		System.out.println("FakeService created!");
	}
         
}

When I install this into my karaf container, I get the following error in the log:
com.modusoperandi.inputsourcehandler - 1.0.0 | [FakeyService(7)] activate method [activate] not found; Component will fail
com.modusoperandi.inputsourcehandler - 1.0.0 | [FakeyService(7)] Failed creating the component instance; see log for reason


Here is the generated XML file from the annotations:
<?xml version="1.0" encoding="UTF-8"?>

-<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">


-<scr:component modified="modified" deactivate="deactivate" activate="activate" name="FakeyService" enabled="true">

<implementation class="com.modusoperandi.inputsourcehandler.service.FakeService"/>

<property name="service.pid" value="FakeyService"/>

</scr:component>

</components>

Pom project states using 

		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.scr.annotations</artifactId>
			<version>1.9.6</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.scr</artifactId>
			<version>1.8.2</version>
			<scope>provided</scope>
		</dependency>


And using the build plugin 1.17 scr annotations.



> Karaf 2.3.5 not picking up @Activate for arguments ComponentContext
> -------------------------------------------------------------------
>
>                 Key: KARAF-3142
>                 URL: https://issues.apache.org/jira/browse/KARAF-3142
>             Project: Karaf
>          Issue Type: Bug
>            Reporter: Scott Hull
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> I am unable to get the @Activate command to work with anything other than a nullary operation.
> @Annotations are from Felix SCR
> For example:
> @Component(name="FakeyService", enabled=true)
> public class FakeService {
> 	@Activate
> 	protected void activate(ComponentContext context){
> 		System.out.println("Fake Service activated!");
> 	}
>        	public FakeService() {
> 		System.out.println("FakeService created!");
> 	}
>          
> }
> In the console (with install -s) I get the following message:
> karaf@root>FakeService created!
> When I install this into my karaf container, I get the following error in the log:
> com.modusoperandi.inputsourcehandler - 1.0.0 | [FakeyService(7)] activate method [activate] not found; Component will fail
> com.modusoperandi.inputsourcehandler - 1.0.0 | [FakeyService(7)] Failed creating the component instance; see log for reason
> Here is the generated XML file from the annotations:
> <?xml version="1.0" encoding="UTF-8"?>
> -<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
> -<scr:component modified="modified" deactivate="deactivate" activate="activate" name="FakeyService" enabled="true">
> <implementation class="com.modusoperandi.inputsourcehandler.service.FakeService"/>
> <property name="service.pid" value="FakeyService"/>
> </scr:component>
> </components>
> Pom project states using 
> 		<dependency>
> 			<groupId>org.apache.felix</groupId>
> 			<artifactId>org.apache.felix.scr.annotations</artifactId>
> 			<version>1.9.6</version>
> 			<scope>provided</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.apache.felix</groupId>
> 			<artifactId>org.apache.felix.scr</artifactId>
> 			<version>1.8.2</version>
> 			<scope>provided</scope>
> 		</dependency>
> And using the build plugin 1.17 scr annotations.



--
This message was sent by Atlassian JIRA
(v6.2#6252)