multithreading - Thread created inside a OSGi bundle cannot load classes from other bundles -


i have couple of osgi bundles; spinning thread in 1 bundle , inside run method, trying create instance of class bundle fails, throws classnotfoundexception

bundle 1:

package com.test.bnd1;  public class {  } 

pom.xml :

export-package: com.test.bnd1.* 

bundle 2:

public com.test.bnd2; public class b {    public void init() {      mythd thd = new mythd();      thd.start();    } }  public class mythd extends thread {    public void run() {       a = new a(); //throws classnotfoundexception    } } 

pom.xml :

import-package: com.test.bnd1.* 

blueprint.xml:

<bean id="testb" class="com.test.bnd2.b" init-method="init"/> 

can help?

there no headers in osgi called exports-package or imports-package.

you need use export-package , import-package respectively.


Comments