1

I have problems with loading files in SpringDM on Virgo. The reason is of course me, I am doing something wrong.

This is the situation: bundleA contains a class to perform some generic initialization (fill tables with data from a generic configuration file).

bundleB contains, among others, a more specific version (extends) of the initialization class from bundleA (in spring file, I also specify that class from bundleA is parent of the more specialized class in bundleB)

bundleC is a web bundle, calls bundleB (which in turns first calls bundleA)

However, bundleB/bundleA does not seem to be able to find the configuration file. I get java.io.FileNotFound exception (file does not exist).

I defined the configuration file in bundleA as a classpath resource:

<bean id="myBeanId" class="org.springframework.core.io.ClassPathResource">
    <constructor-arg>
        <value>configfile.cfg</value>
    </constructor-arg>
</bean>

The bean gets created and injected into the initialization class with Autowired annotation. However, as soon as I try to use the file, I get the exception.

Is there any "general" flaw in my approach? Should I be using other Resource loader? Any other suggestions?

If a part of the question is not clear, let me know, I will try to clarify...

Thanks!

Jan
  • 356
  • 1
  • 2
  • 9
  • 1
    Does this answer help? http://stackoverflow.com/questions/10639128/access-common-property-file-inside-bundle-with-osgi – Holly Cummins Jun 07 '12 at 17:09
  • Hi Holly, thanks for your link, I will try once more to explicitly export the package where the cfg file resides (it is actually a CSV file I use to fill a couple of tables, not just properties). I did that already but it did not work. Then again, could have been Eclipse messing around with Virgo - that happens quite a lot in my experience. In any case, thank you! – Jan Jun 07 '12 at 19:11
  • Oh well, there is an acceptable workaround - I will make the generic module "stand alone" and make sure all the other modules depend on it but do not call the initialization. That should work... – Jan Jun 08 '12 at 06:25

0 Answers0