bndtools.runtime.junit - unresolved constraint error

67 views
Skip to first unread message

gibelium

unread,
Mar 30, 2011, 4:35:21 AM3/30/11
to bndtools-users
Hello BNDTools group,

I just tried to create and run a BND-JUnit-Runconfiguration and get
the exception mentioned below.
As the osgi-framework shuts down directly I cannot use the osgi-
console to check what exactly is missing to start the
bndtools.runtime.junit bundle.

SCHWERWIEGEND: 1 ERROR(S) OCCURRED
30.03.2011 09:06:19 bndtools.launcher.BundleInstaller
synchronizeBundles
SCHWERWIEGEND: 0 BUNDLE file:[project-loc]\cnf\repo
\bndtools.runtime.junit\bndtools.runtime.junit-0.0.2.jar: Error
starting bundle.
org.osgi.framework.BundleException: Unresolved constraint in bundle
bndtools.runtime.junit [16]: Unable to resolve 16.0: missing
requirement [16.0] package; (&(package=bndtools.runtime.junit)
(version>=1.0.0)(!(version>=2.0.0)))
at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3416)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1714)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)
at
bndtools.launcher.BundleInstaller.performStarts(BundleInstaller.java:
351)
at
bndtools.launcher.BundleInstaller.performAllChanges(BundleInstaller.java:
244)
at
bndtools.launcher.BundleInstaller.synchronizeBundles(BundleInstaller.java:
134)
at bndtools.launcher.Main.createInstaller(Main.java:259)
at bndtools.launcher.Main.run(Main.java:116)
at bndtools.launcher.Main.main(Main.java:52)
30.03.2011 09:06:19 bndtools.launcher.Main$1 run
SCHWERWIEGEND: SHUTTING DOWN due to errors.
30.03.2011 09:06:19 bndtools.launcher.Main run
INFO: Waiting for the framework to stop.
30.03.2011 09:06:19 bndtools.launcher.Main run
INFO: Framework stopped.
30.03.2011 09:06:19 bndtools.launcher.Main run
INFO: Main thread finishing.

So I digged in the manifest file of bndtools.runtime.junit to find the
issue. To me it seems, that the version of imported- and exported
package do not match.

Export-Package:
bndtools.runtime.junit;uses:="junit.framework,org.osgi.util.tracker,org.osgi.framework";version="0.0.2"
Import-Package: bndtools.runtime.junit;version="[1.0,2)"

I experimentally changed the manifest to match Import-Package:
bndtools.runtime.junit;version="[0.0.2)". When I now start the JUnit
Runconfiguration I get no more resolve-bundle errors but the bundle
hangs with following message during startup:

FEIN: Starting bundle file:D:\_Development\_eclipse_workspaces
\GEBIT_POS_Platform\cnf\repo\bndtools.runtime.junit
\bndtools.runtime.junit-0.0.2.jar
30.03.2011 10:29:21 bndtools.runtime.junit.internal.Activator start
FEIN: Starting JUnit Activator
30.03.2011 10:29:21 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 0.
30.03.2011 10:29:22 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 1.
30.03.2011 10:29:23 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 2.
30.03.2011 10:29:24 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 3.
30.03.2011 10:29:26 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 4.
30.03.2011 10:29:28 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 5.
30.03.2011 10:29:30 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 6.
30.03.2011 10:29:32 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 7.
30.03.2011 10:29:34 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 8.
30.03.2011 10:29:37 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
FEIN: Connecting to JUnit reporting socket on port 50445, attempt
number 9.
30.03.2011 10:29:40 bndtools.runtime.junit.internal.JUnitPortReporter
createReporter
SCHWERWIEGEND: Unable to connect to JUnit reporting socket on port
50445
30.03.2011 10:29:40 bndtools.runtime.junit.internal.Activator
maybeKillFramework
INFO: SHUTTING DOWN OSGi FRAMEWORK.
30.03.2011 10:29:40 bndtools.launcher.BundleInstaller performStarts
FEIN: Starting bundle file:D:\_Development\_eclipse_workspaces
\GEBIT_POS_Platform\cnf\repo\osgi.enterprise
\osgi.enterprise-4.2.0.201003190513.jar
30.03.2011 10:29:40 bndtools.launcher.BundleInstaller performStarts
FEIN: Starting bundle file:D:\_Development\_eclipse_workspaces
\GEBIT_POS_Platform\cnf\repo\com.mysql.jdbc.service
\com.mysql.jdbc.service-1.0.0.jar
30.03.2011 10:29:40 bndtools.launcher.BundleInstaller performStarts
FEIN: Starting bundle file:D:\_Development\_eclipse_workspaces
\GEBIT_POS_Platform\Configuration\generated\Configuration.jar
30.03.2011 10:29:40 bndtools.launcher.Main run
INFO: Waiting for the framework to stop.
30.03.2011 10:29:40 bndtools.runtime.junit.internal.Activator stop
FEIN: Stopping JUnit activator
30.03.2011 10:29:40 bndtools.launcher.Main run
INFO: Framework stopped.
30.03.2011 10:29:40 bndtools.launcher.Main run
INFO: Main thread finishing.

So by now I have two questions:
1) Is the version-confllict inside the manifest file of the
bndtools.runtime.junit bundle a bug?
2) What am I missing to let the BND-JUnit-Runconfiguration perform as
excepted?

Best regards,
Sebastian




gibelium

unread,
Mar 31, 2011, 5:53:41 PM3/31/11
to bndtools-users
It seems that no one had that problem before or I am kind of blind to
see the obvious...
By now I only need to know what I need to do to be able listen to the
results of JUnit tests inside eclipse when using the BND-JUnit-
Launcher.
Would be nice if someone could enlighten me.

Thank you very much,
Sebastian

Peter Kriens

unread,
Apr 1, 2011, 10:16:38 AM4/1/11
to bndtool...@googlegroups.com
Results are placed in the generated directory in standard (albeit slightly extended) JUNit xml format as used by ant.

In bndtools you should be able to use the standard JUnit view to run your code. Just select a package and select run OSGi JUnit.

Kind regards,

Peter Kriens

gibelium

unread,
Apr 7, 2011, 8:31:16 AM4/7/11
to bndtools-users
Thank you Peter for the answer,

the approach you described works. What I tried was right-clicking my
*.bndrun file and selecting "Run as => OSGi JUnit" which causes the
exception I mentioned in my first post. Perhaps I have a wrong picture
of what I can do. What I would like to do is create a bndrun
configuration which starts a bunch of bundles and runs all JUnit tests
included in this bundles.

Kind regards,
Sebastian

Peter Kriens

unread,
Apr 7, 2011, 9:59:13 AM4/7/11
to bndtool...@googlegroups.com
File a bug in bndtools. It should not be that hard to make this work.

Kind regards,

Peter Kriens

Dave Reynolds

unread,
Apr 13, 2011, 5:15:06 AM4/13/11
to bndtools-users
In case it is relevant, I've recently started working with bndtools
and at my first attempt to run a "OSGi junit test" project ran into
the same dependency mismatch in bndtools.runtime.junit. Patching that
by editing the manifest in a similar way to Sebastian it functions for
me without the socket connection errors (this is under eclipse 3.5.2).

When I say it "functions" it does report:

13-Apr-2011 09:33:44 bndtools.runtime.junit.internal.Activator
createTestReporter
SEVERE: No JUnit reporter was specified; aborting tests.

But in fact it then runs the tests (twice) and successfully reports
them to eclipse.

Not worked out why the tests run twice nor why they fail when the same
same bundles run as plain "OSGi run" from the same project work just
fine :(

Dave

gibelium

unread,
Apr 14, 2011, 2:47:36 AM4/14/11
to bndtools-users
I am using Eclipse Helios SR 2 - Build id: 20110218-0911
I now will file a bug for this issue.
Reply all
Reply to author
Forward
0 new messages