Hi,
I am trying to create a simple vaadin+osgi+springdm integration.
I have 4 bundles
x.y.email.service
x.y.email.serviceImpl
x.y.target - just the target platform
x.y.email.vaadin.main
x.y.email.service
1 public interface no spring context xml's
x.y.email.serviceImpl
1 public implementation of the above interface
in META-INF/spring folder i have two xml's
context.xml
<?xml version="1.0" encoding="UTF-8"?>
...
<bean id="myEmailServiceOSGi" class="x.y.email.serviceImpl.EmailServiceImpl"/>
</beans>
context-osgi.xml
<?xml version="1.0" encoding="UTF-8"?>
...
<!-- Publish UserServiceImpl instance as UserService in the OSGi services
registry -->
<osgi:service id="es" ref="myEmailServiceOSGi" interface="x.y.email.service.IEmailService"/>
</beans>
In x.y.vaadin.main I am trying to consume the published service like so:
the context.xml
<?xml version="1.0" encoding="UTF-8"?>
...
<bean id="MainApplication" class="x.y.vaadin.main.MainApplication">
<property name="emailService" ref="myEmailServiceImported"></property>
</bean>
</beans>
and the context-osgi.xml
...
<!-- Consume UserService from the OSGi services registry -->
<osgi:reference id="myEmailServiceImported" interface="x.y.email.service.IEmailService" cardinality="0..1" timeout="1000"/>
</beans>
x.y.vaadin.main.MainApplication
has a property of type IEmailService and a public getter and setter.
Still when i try to use the property IEmailService from MainApplication I get a NPE.
I did some debugging and put a breakpoint in the setter.
public void setEmailService(IEmailService emailService) {
this.emailService = emailService;
emailService.getEmailAddress();
}
but i get
org.springframework.osgi.service.ServiceUnavailableException: service matching filter=[(&(org.springframework.osgi.bean.name=myEmailService)(objectClass=x.y.email.service.IEmailService))] unavailable
Can anyone tell me if I am doing something wrong, or why my email service is not injected by spring?
p.s. attached is the startup log
[Updated on: Tue, 24 April 2012 17:56]
Report message to a moderator