Results 1 to 5 of 5

Thread: Spring dependencies in bundle?

  1. #1
    Join Date
    Nov 2007
    Location
    Netherlands
    Posts
    36

    Default Spring dependencies in bundle?

    Which classes are visible to beans that are instantiated by the Spring extender when it creates the Spring context of a Spring-DM powered bundle? Are these only the classes that are visible to this bundle?

    Do I need to import Spring-classes in my bundle manifest?

    I ask this because I am having the following problem when I try to use a PropertyPlaceholderConfigurer inside my Spring context. I did not create the manifest such that it imports Spring classes. I (obviously from the stack trace!) do have the bundle org.sprinframework.beans activated but it looks like it cannot load classes from itself:

    Code:
    org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] for bean with name 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' defined in URL [bundleentry://271.fwk30758157/META-INF/spring/client/productDaoClient.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.beans.factory.config.PropertyPlaceholderConfigurer not found from bundle [nl.hm.oblomow.model.products]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1208)
    .......

  2. #2
    Join Date
    Feb 2010
    Location
    Dublin, Ireland
    Posts
    10

    Default

    Yes, you need explicitly import any spring related classes. The class loader of the target bundle doesn't aware of spring.

  3. #3
    Join Date
    Nov 2007
    Location
    Netherlands
    Posts
    36

    Default

    Ok thank you for this information. I couldn't find this explicitly mentioned in the Spring-DM reference manual.

  4. #4
    Join Date
    Feb 2010
    Location
    Dublin, Ireland
    Posts
    10

    Default

    Quote Originally Posted by SlowStrider View Post
    Ok thank you for this information. I couldn't find this explicitly mentioned in the Spring-DM reference manual.
    I say explicitly means standard OSGi Import-Package header to import any class which may be loaded by spring osgi extender.

    SpringSource Bundlor aware of spring xml file and could generate header for you with required packages:
    http://blog.springsource.com/2009/03...-with-bundlor/

  5. #5
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Spring DM uses only the bundle class space (which is not modified by it). If you are using Spring classes you need to import them. However using Spring DM doesn't require you to use Spring per se - that is, for its own internal usage, Spring DM takes care of loading the proper classes w/o requiring the user to import anything.

    In short, worry just about the classes that you load/use in your code/config and import them.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •