• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Mike London

Spring context loading problem in Osgi

Ranch Hand
Posts: 81
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using Spring's FileSystemXmlApplicationContext in Osgi activator. Unfortunately, it doesn't load any bean from the provided XML files. I'm sure that it finds the xml configuration files, because I was testing with incorrect name of my xml configuration file, and it threw an FileNotFoundException.

Here is a snippet from my code:

This code returns this:

even thought I have more than 0 beans in my app-container-config.xml file.

Thanks in advance
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Regarding your problem, you must be aware of implications of strict classloading of OSGi. As a matter of fact, it isn't sure that Spring bundles can see your classes by default. Since Spring also looks at thread context classloader, you can try to set the classloader of your bundle (this containing your activator) in TCCL. It will solve your problem but I agree with you that it's not easy to diagnose the problem...

If you use Spring DM, the tool will handle all these aspects for you . However, Spring DM doesn't use OSGi activator but the extender pattern to manage Spring powered bundles...

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic