[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] IllegalAccessError

Hi,

I'm working on a OSGi-Junit integration (as part of Spring-OSGi
initiative) and I've run into a strange issue when I deploy my bundles -
I get an IllegalAccessError. I've tried the code on both KF 2.0.0 and
Equinox 3.1.2 and 3.2.0 and all of them throw the same exception which
makes me believe that this is a generic OSGi issue.

Below is the stacktrace:

java.lang.IllegalAccessError: tried to access method
junit.framework.TestCase.<init>()V from class
org.springframework.osgi.test.AbstractOsgiTests
        at
org.springframework.osgi.test.AbstractOsgiTests.<init>(AbstractOsgiTe
sts.java:97)
        at
org.springframework.osgi.test.example.BasicTest.<init>(BasicTest.java
:24)
        at
org.springframework.osgi.test.activator.JUnitTestActivator.start(JUni
tTestActivator.java:54)
        at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(Bund
leContextImpl.java:995)
...

I have the following setup:

- junit bundle
- spring-core bundle (used by juni-osgi)
- junit-osgi bundle - the test framework setup (which also contains the
AbstractOsgiTests from the stacktrace above) (bundle X)
- a simple junit test bundle (bundle A)

the first 3 bundles start up just fine, however, once I deploy bundle A
(inside its Activator I instantiate BasicTest which extends
AbstractOsgiTests found inside bundle X (the import packages are all in
order otherwise I get a NoClassDefFoundError)) I get the error above.

I seem I'm missing something obvious here..
As the AbstractOsgiTests package is exported (and relies on the Junit
package), shouldn't other bundles which import the package be able to
instantiate the class? Does the package structure count?

Any suggestion/advice/hint/link is appreciated!

Thanks!

-- 
Costin Leau