Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » [OSGI+SpringDM] Published service is not injected(Published service is not injected)
[OSGI+SpringDM] Published service is not injected [message #855298] Tue, 24 April 2012 17:38
Paul Vlasin is currently offline Paul VlasinFriend
Messages: 3
Registered: April 2012
Junior Member
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

Previous Topic:Bundle not appear in Target Platform
Next Topic:Equinox Console: Tab Completion and History?
Goto Forum:
  


Current Time: Sun Oct 17 14:05:38 GMT 2021

Powered by FUDForum. Page generated in 0.01705 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top