-
Jul 31st, 2008, 09:24 AM
#1
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
I trying to use the <osgi:list> in eclipse and I am getting the following error:
Class 'org.springframework.osgi.service.importer.support .OsgiServiceCollectionProxyFactoryBean' not found
I get this error after inserting the list element in my spring configuration file:
<osgi:list id="someId">
</osgi:list>
Context sensitive help shows that "<osgi:list> is available; however, when I type the above in I get the error mentioned. Is anyone successfully using <osgi:lists> from eclipse?
-
Jul 31st, 2008, 11:42 AM
#2
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Hi
I've got similar problem using <osgi:set />. So far I found I need to add this to MANIFEST.MF:
Import-Bundle: org.springframework.osgi.core;version="[1.1.1.A,1.1.1.A]"
However, the set still does not contain references to services I'm about. Will post more details later on.
-
Aug 8th, 2008, 09:00 AM
#3
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Ok, so I found out that a set of osgi services is actually resolved, but the autowiring of such set is failing. Here's what I've got:
bundle A - module-context.xml:
<bean id="barService" class="com.myapp.service.bar.BarService" />
bundle A - osgi-context.xml:
<osgi:service id="osgiBarService" interface="com.myapp.service.AppService" ref="barService" />
bundle B - module-context.xml
<bean id="serviceManager" class="com.myapp.manager.AppServiceManager" />
bundle B - osgi-context.xml
<osgi:set id="services" interface="com.myapp.service.AppService" />
bundle B - AppServiceManager.java
public class AppServiceManager {
@Autowired
protected Set<AppService> services;
}
However, if I inject the dependency, it works:
<bean id="serviceManager" class="com.myapp.manager.AppServiceManager">
<property name="services" ref="services" />
</bean>
Any ideas?
Jaro
-
Aug 10th, 2008, 02:02 PM
#4
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Have you enabled autowiring/component scanning (http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-annotation-config)?
Cheers,
-
Aug 11th, 2008, 05:13 AM
#5
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Yes, I did. The error occurs when doing the actual autowiring. Here's the root cause of the exception I'm getting:
Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'serviceManager': Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire method: public void com.myapp.manager.AppServiceManagerImpl.setService s(java.util.Set); nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [com.myapp.service.AppService] found for dependency [collection of com.myapp.service.AppService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessPropert yValues(AutowiredAnnotationBeanPostProcessor.java: 256)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:998)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:221)
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.jmx.export.MBeanExporter.autod etect(MBeanExporter.java:882)
at org.springframework.jmx.export.MBeanExporter.autod etectBeans(MBeanExporter.java:848)
at org.springframework.jmx.export.MBeanExporter.regis terBeans(MBeanExporter.java:517)
at org.springframework.jmx.export.MBeanExporter.after PropertiesSet(MBeanExporter.java:414)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1368)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1334)
... 17 more
Caused by: org.springframework.beans.factory.BeanCreationExce ption: Could not autowire method: public void com.myapp.manager.AppServiceManagerImpl.setService s(java.util.Set); nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [com.myapp.service.AppService] found for dependency [collection of com.myapp.service.AppService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor$AutowiredMethodEle ment.inject(AutowiredAnnotationBeanPostProcessor.j ava:543)
at org.springframework.beans.factory.annotation.Injec tionMetadata.injectMethods(InjectionMetadata.java: 117)
at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessPropert yValues(AutowiredAnnotationBeanPostProcessor.java: 253)
... 33 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [com.myapp.service.AppService] found for dependency [collection of com.myapp.service.AppService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.raiseNoSuchBeanDefinitionExcept ion(DefaultListableBeanFactory.java:726)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.resolveDependency(DefaultListab leBeanFactory.java:571)
at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor$AutowiredMethodEle ment.inject(AutowiredAnnotationBeanPostProcessor.j ava:499)
... 35 more
[2008-08-11 11:10:34.661] ection(4)-10.136.101.138 <SPDE0011E> Deployment of 'com.myapp.manager.jar' version '0' failed.
-
Aug 15th, 2008, 07:50 AM
#6
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Can you please raise an issue on Spring-DM tracker? I'll take a closer look at it (the error message about the bean type is interesting)...
Thanks,
-
Aug 15th, 2008, 09:48 AM
#7
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Issue raised: http://jira.springframework.org/browse/OSGI-610
-
Aug 25th, 2008, 03:57 AM
#8
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Hi,
There is a misunderstanding on how Autowired works with collections and arrays. See here:
http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-autowired-annotation
Basically when injecting an array or collection of type X, Spring will look for all beans of type X and it will inject those rather then injection a bean that is an array or collection.
-
Aug 26th, 2008, 04:59 AM
#9
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Right, I understand. So it is a limitation of Spring autowiring feature which works for simple beans only, not for maps, sets, etc. It means that even beans defined using <util:map /> or <util:set /> cannot be autowired.
-
Aug 29th, 2008, 04:40 AM
#10
org.springframework.osgi.service.importer.support. OsgiServiceCollectionProxyFactoryBean not found
Actually, there's already an issue raised in Spring Issue Tracker: http://jira.springframework.org/browse/SPR-5038
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules