PDA

View Full Version : Import question...


mburbidg
May 28th, 2008, 11:54 PM
Consider the following stack trace


org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'fileShareRepository' defined in URL [bundleentry://27/WEB-INF/newClientAPI-servlet.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/collections/map/LinkedMap
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.instantiateBean(Abstrac tAutowireCapableBeanFactory.java:881)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:837)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:440)


I'm using Spring-DM with the web support. I have a war that uses Spring-MVC and the rest of the Spring Framework. To get rid of the above stack trace I have to place the following entry in the manifest for my bundle.

Import-Package: org.apache.commons.collections.map

Of course there are many other things in my import. What I don't understand, given the stack trace is why my bundle has to include this in it's imports. It doesn't use it directly. It is used by one of the Spring bundles. Do I have to import all packages that my bundle, uses and then recursively or transitively import all packages imported by any bundles my bundle imports. This seems unwieldy. Am I missing something?

Thanks,
Michael-

Costin Leau
May 29th, 2008, 03:02 AM
What version of Spring and JDK are you using? I have to check but the commons collections are detected and used by Spring as an alternative depending on the JDK (and thus the existing java.util classes).
However, this should not prevent you from running the code.
Are you sure it's not your code that creates the collection? Or that the LinkedMap is present as a first-level dependency/signature in one of the classes that you use?