karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Hull (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (KARAF-3142) Karaf 2.3.5 not picking up @Activate for arguments ComponentContext
Date Mon, 28 Jul 2014 19:02:41 GMT

     [ 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)

Mime
View raw message