Hi,

You can try to put FactoryContext.xml in a unique folder like META- INF/MyFactoryContext/FactoryContext.xml, then jar2 also export package META-INF.MyFactoryContext, and jar1 import package META- INF.MyFactoryContext, and then should be able to use code like context = new ClassPathXmlApplicationContext("META-INF/ MyFactoryContext/FactoryContext.xml");
in jar1.


Freeman
On 2012-3-29, at 上午6:46, nvtd4000 wrote:

I am developing 2 jar files (jar1 and jar2 - the packaging type in pom.xml of
2 jars are jar) and install them into serviceMix. Jar1 will use some
packakes from jar2. In the manifest.mf files, i used import and export for jar1 and jar2. After installing into serviceMix 4.3.0. Everything going
almost fine. From jar 1, i can use packages in jar2 (i know that by
debugging the code). But the problem is here:

The structure of Jar2:
 jar2:/
       .
       com
              abc
                  .......(classes)
       META-INF
              MANIFEST.MF
       FactoryContext.xml

The short version of jar2's MANIFEST.MF is
  Bundle-ClassPath: .
  Bundle-Name: jar2
  Bundle-SymbolicName: jar2
  Bundle-Version: 1.0.0
  Export-Package: com.abc
  Import-Package: xyz
  Tool: Bnd-1.50.0

Jar1 call a method of Jar2, that method is using bellow statement
context = new ClassPathXmlApplicationContext("FactoryContext.xml");

whenever it goes to this statement, it always throws exception say that FactoryContext.xml doen not exist. (i guest this file is not in classpath)

Do you know how to make it work?




--
View this message in context: 
http://servicemix.396122.n5.nabble.com/question-about-jar-bundle-and-classpath-tp5602052p5602052.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ff...@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com









Reply via email to