Peaberry 1.1 with Guice 2.0

64 views
Skip to first unread message

mikemckibben

unread,
Jun 3, 2010, 12:19:43 PM6/3/10
to Guice and OSGi
Hi All,

I've been reading through the documentation of Peaberry and I've not
come across specific mention of Guice 2.0 support. After downloading
the peaberry+eclipse jars I looked at the ImportPackage manifest
header and noticed a version constraint on the guice packages of
[1,2). So it would seem peaberry doesn't support Guice 2.0? Just to
satisfy my curiosity, I repackaged the peaberry jars, changing the
version constraint of the guice packages to unbounded "1.0" and
everything deployed fine alongside Guice 2.0 into my osgi container.

My question for the group is: is there some edge case compatibility
scenario where peaberry 1.1 fails with guice 2.0? If not, why the
exclusive upper bound version constraint [1,2) in the jar manifest?
Are there plans on a minor point release to peaberry 1.1 to fix the
version constraint and/or compatibility changes to work with guice
2.0?

Thanks,

--Mike

Stuart McCulloch

unread,
Jun 4, 2010, 3:24:22 AM6/4/10
to guice...@googlegroups.com

please don't confuse pseudo-marketing versions with API versions

most API versions follow this format:

   major.minor.micro

where a change in the major version denotes a break in compatibility,
a change in the minor version denotes new features, and a change in
the micro version denotes small bugfixes

whereas marketing versions are often chosen arbitrarily / for effect

wrt. clients Guice 2.0 is compatible with Guice 1.0 so the jar actually
exports the Guice API as 1.2, not 2.0 - the next release (2.1) should
use an API version of 1.3 as it will still be client compatible

with this scheme in mind, peaberry imports Guice packages using a
range of [1,2) ... meaning it works with the original Guice API and any
subsequent releases that declare they are compatible with that API

so you should be able to deploy Guice 2 and peaberry without any
problems - if you can't then that's a separate problem unrelated to
the version ranges

Thanks,

--Mike

--
You received this message because you are subscribed to the Google Groups "Guice and OSGi" group.
To post to this group, send email to guice...@googlegroups.com.
To unsubscribe from this group, send email to guice-osgi+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/guice-osgi?hl=en.




--
Cheers, Stuart

mikemckibben

unread,
Jun 4, 2010, 12:26:28 PM6/4/10
to Guice and OSGi
Huh? Pseudo-marketing? I think you misunderstand my question. I'm
talking specifically about the OSGI Bundle manifest headers inside the
peaberry jars. The Import-Package manifest header has nothing to do
with marketing, and the OSGI container most certainly honors the
version constraint placed on packages listed inside the Import-Package
header when validating a bundle before entering bundle in the
"RESOLVED" state. That's one of the major design features of OSGI,
modularity/isolation of bundles and their exported packages. If bundle
A exports package org.examplea with version "2.0", and bundle B
depends on org.examplea with a version constraint of "[1,2)" then the
OSGI container will fail to resolve bundle B. Section 3.7 in the OSGI
core specification explains it much better than I can. Perhaps your
OSGI container has a setting to control its "strictness" when
performing version matching on installed bundles?

mikemckibben

unread,
Jun 4, 2010, 12:40:13 PM6/4/10
to Guice and OSGi
Sorry, please disregard my previous message... I somehow missed the
last part of your message. I feel dumb now :) So com.google.inject is
exported at "1.2"? We must be getting our jars from different sources.
The one I've been using from the eclipse "orbit" p2 repository. That
one has "2.0.0" as the exported guice packages. But after downloading
the jars straight from the source I do see the official jars export at
version "1.2". Thanks for the help!

Neil Bartlett

unread,
Jun 4, 2010, 12:40:53 PM6/4/10
to guice...@googlegroups.com
I believe what Stuart is saying is that "Guice 2.0" is a
pseudo-marketing version that has nothing to do with the exported
package version. The Guice 2.0 bundle should export its packages as
1.2, and therefore the Import-Package statements used by Peaberry are
correct.

This is in accordance with the OSGi Semantic Versioning guidelines,
which are documented here:

http://www.osgi.org/wiki/uploads/Links/SemanticVersioning.pdf

Incidentally you will find the same technique applied to the JPA
specification. Since "JPA 2.0" is backwards compatible with "JPA 1.0",
the export of the javax.persistence package is 1.1 and 1.0
respectively.

Regards,
Neil

Neil Bartlett

unread,
Jun 4, 2010, 12:44:41 PM6/4/10
to guice...@googlegroups.com
Oops, if only I had waited a few minutes to reply :-)

Glad you sorted it out. So, it looks like Orbit contains a bad Guice
bundle... this should be reported as a bug against the Eclipse Orbit
project.

Cheers,
Neil

Stuart McCulloch

unread,
Jun 4, 2010, 12:58:37 PM6/4/10
to guice...@googlegroups.com

No problem :)

BTW, there was a pre-release build of Guice 2 which exported packages
as version 2 before I flagged this as an issue, but the official jar from the
Guice project uses version 1.2 for exported packages (the bundle version
is marked as 2.0, but this is ok as bundle version doesn't have to match
the package version)

Looks like this was the Orbit upload request which fudged the packaging:

   https://bugs.eclipse.org/bugs/show_bug.cgi?id=304793

Hopefully they can sort out the right export versions, not sure why they
decided to go and redo the existing OSGi-friendly manifest though :/

--
You received this message because you are subscribed to the Google Groups "Guice and OSGi" group.
To post to this group, send email to guice...@googlegroups.com.
To unsubscribe from this group, send email to guice-osgi+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/guice-osgi?hl=en.

--
Cheers, Stuart

mikemckibben

unread,
Jun 4, 2010, 3:07:25 PM6/4/10
to Guice and OSGi
Thanks for the link to the bugzilla bug. I've updated the bug with a
comment explaining the incompatibility with the official Guice
bundles. It is puzzling why Orbit didn't use the official bundle
manifest.

esp

unread,
Jun 15, 2010, 8:17:35 AM6/15/10
to Guice and OSGi
Hi,

I ran into this issue also. I noticed however that the manifest for
the Guice jar is a bit strange: it exports version 1.2 but the Bundle-
Version is set to 2.0. This seems to be causing issues for me in the
Eclipse PDE. Shouldn't the Bundle-Version be 1.2 as well?

Edwin

Stuart McCulloch

unread,
Jun 15, 2010, 8:32:02 AM6/15/10
to guice...@googlegroups.com
On 15 June 2010 20:17, esp <edwin...@gmail.com> wrote:
Hi,

I ran into this issue also.

Which issue?  the incorrect Orbit repackaging of the official Guice jar?
 
I noticed however that the manifest for
the Guice jar is a bit strange: it exports version 1.2 but the Bundle-
Version is set to 2.0. This seems to be causing issues for me in the
Eclipse PDE. Shouldn't the Bundle-Version be 1.2 as well?

Nope - in OSGi the bundle version doesn't have to match the package version,
because packages are not tied to the bundle. For a good example of this look
at the OSGi spec jar, which contains various packages exported with different
versions - none of which match the bundle version. If this is breaking PDE then
that's a serious bug in PDE (are you using Require-Bundle?).

Again, this comes down to separating package information (which is a form of
capability / requirement) from the bundle (which is a form of deployment unit)
to allow their versions to be independent and flexible.

This way you don't have to change the version of all your packages if all you're
doing is changing one package, or the hidden bundle internals (as long as that
doesn't break compatibility in the public API/SPI) - and other bundles can also
provide replacements of these packages without having to shadow your bundle
version.

Edwin


--
You received this message because you are subscribed to the Google Groups "Guice and OSGi" group.
To post to this group, send email to guice...@googlegroups.com.
To unsubscribe from this group, send email to guice-osgi+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/guice-osgi?hl=en.

--
Cheers, Stuart

esp

unread,
Jun 15, 2010, 10:33:54 AM6/15/10
to Guice and OSGi
Hi Stuart,

Thanks for the clarification, that helps. I still have a problem
however in that I'd like to use peaberry in an application that also
unfortunately requires the bad Orbit bundle of Guice. The Orbit
dependency is coming from Xtext, which I need. Peaberry will not work
with the Orbit bundle so I stuck the official Guice bundle in my
target platform as well. So now I have in my target platform the
peaberry bundle, the official Guice bundle AND the Orbit Guice
bundle.

My problem is that I cannot seem to find a way to get peaberry to work
when both Guice bundles are present. Is there a way to get both to
work in the same container? Or will I have to choose between using
Xtext or using peaberry?

Details of my test application are below. It is a simple RCP sample
application where I'm trying to use peaberry to inject a dependency in
the perspective using the peaberry eclipse functionality:

plugin.xml:
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="RCP Perspective"

class="org.ops4j.peaberry.eclipse.GuiceExtensionFactory:foo.Perspective"
id="foo.perspective">
</perspective>
</extension>
<extension point="org.ops4j.peaberry.eclipse.modules">
<module class="foo.Module"/>
</extension>

Perspective.java:
public class Perspective implements IPerspectiveFactory {
@Inject
private Dependency dependency;

public void createInitialLayout(IPageLayout layout) {
System.out.println("dependency: " + dependency.go());
}
}

Module.java:
public class Module extends AbstractModule {
@Override
protected void configure() {
bind(Dependency.class).to(DependencyImpl.class);
}
}

I've tried a bunch of different permutations of bringing in
dependencies in the MANIFEST.MF (require bundle, package imports,
specifying explicit version ranges) but whenever I run the application
I keep getting errors.

Here's one version of the manifest using package imports and the error
I get when running the app:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Foo
Bundle-SymbolicName: foo; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: foo.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.google.inject;version="[1.2.0,2.0.0)",
com.google.inject.binder;version="[1.2.0,2.0.0)",
com.google.inject.matcher;version="[1.2.0,2.0.0)",
com.google.inject.name;version="[1.2.0,2.0.0)",
org.ops4j.peaberry.eclipse;version="1.0.0"

Console output:
!SESSION 2010-06-15 10:19:49.924
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -application foo.application
Command-line arguments: -application foo.application -data C:\Code
\workspaces\codex-git/../runtime-foo.application -dev file:C:/Code/
workspaces/codex-git/.metadata/.plugins/org.eclipse.pde.core/
foo.application/dev.properties -os win32 -ws win32 -arch x86 -
consoleLog

!ENTRY org.eclipse.osgi 2 0 2010-06-15 10:19:50.893
!MESSAGE One or more bundles are not resolved because the following
root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:50.893
!MESSAGE Bundle initial@reference:file:peaberry.eclipse-1.1.1.jar/ was
not resolved.
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:50.893
!MESSAGE Bundle initial@reference:file:peaberry-1.1.1.jar/ was not
resolved.
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package
com.google.inject.util_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package
com.google.inject.name_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package
com.google.inject.matcher_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package
com.google.inject.binder_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:50.893
!MESSAGE Bundle initial@reference:file:../../../foo/ was not resolved.
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package com.google.inject_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package
com.google.inject.binder_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package
com.google.inject.matcher_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.893
!MESSAGE Missing imported package
com.google.inject.name_[1.2.0,2.0.0).

!ENTRY org.eclipse.osgi 2 0 2010-06-15 10:19:50.908
!MESSAGE The following is a complete list of bundles which are not
resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:50.908
!MESSAGE Bundle org.ops4j.peaberry_1.1.1.v698 [34] was not resolved.
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
com.google.inject.binder_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
com.google.inject.matcher_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
com.google.inject.name_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
com.google.inject.util_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package org.ops4j.peaberry_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
org.ops4j.peaberry.builders_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
org.ops4j.peaberry.util_[1.1.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:50.908
!MESSAGE Bundle org.ops4j.peaberry.eclipse_1.1.1.v698 [35] was not
resolved.
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package org.ops4j.peaberry_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
org.ops4j.peaberry.eclipse_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:50.908
!MESSAGE Bundle foo_1.0.0.qualifier [57] was not resolved.
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package com.google.inject_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
com.google.inject.binder_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
com.google.inject.matcher_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package
com.google.inject.name_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:50.908
!MESSAGE Missing imported package org.ops4j.peaberry.eclipse_1.0.0.

!ENTRY org.eclipse.osgi 2 0 2010-06-15 10:19:50.924
!MESSAGE One or more bundles are not resolved because the following
root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:50.924
!MESSAGE Bundle initial@reference:file:peaberry.eclipse-1.1.1.jar/ was
not resolved.
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:19:50.924
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:51.002
!MESSAGE Bundle initial@reference:file:peaberry-1.1.1.jar/ was not
resolved.
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.util_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.name_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.matcher_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.binder_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:51.002
!MESSAGE Bundle initial@reference:file:../../../foo/ was not resolved.
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package com.google.inject_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.binder_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.matcher_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.name_[1.2.0,2.0.0).

!ENTRY org.eclipse.osgi 2 0 2010-06-15 10:19:51.002
!MESSAGE The following is a complete list of bundles which are not
resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:51.002
!MESSAGE Bundle org.ops4j.peaberry_1.1.1.v698 [34] was not resolved.
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.binder_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.matcher_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.name_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.002
!MESSAGE Missing imported package
com.google.inject.util_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package org.ops4j.peaberry_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package
org.ops4j.peaberry.builders_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package
org.ops4j.peaberry.util_[1.1.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:51.018
!MESSAGE Bundle org.ops4j.peaberry.eclipse_1.1.1.v698 [35] was not
resolved.
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package org.ops4j.peaberry_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package
org.ops4j.peaberry.eclipse_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:19:51.018
!MESSAGE Bundle foo_1.0.0.qualifier [57] was not resolved.
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package com.google.inject_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package
com.google.inject.binder_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package
com.google.inject.matcher_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package
com.google.inject.name_[1.2.0,2.0.0).
!SUBENTRY 2 foo 2 0 2010-06-15 10:19:51.018
!MESSAGE Missing imported package org.ops4j.peaberry.eclipse_1.0.0.

!ENTRY org.eclipse.osgi 4 0 2010-06-15 10:19:51.033
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "foo.application" could not be
found in the registry. The applications available are:
org.eclipse.equinox.app.error.
at
org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:
248)
at
org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:
29)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:
110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:
79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
369)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)


And here's a version of the manifest that uses Require-Bundle and the
error it produces:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Foo
Bundle-SymbolicName: foo; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: foo.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.ops4j.peaberry;bundle-version="1.1.1",
org.ops4j.peaberry.eclipse;bundle-version="1.1.1",
com.google.inject;bundle-version="[2.0.0,2.0.0]"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

Console output:
!SESSION 2010-06-15 10:27:32.577
-----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -application foo.application
Command-line arguments: -application foo.application -data C:\Code
\workspaces\codex-git/../runtime-foo.application -dev file:C:/Code/
workspaces/codex-git/.metadata/.plugins/org.eclipse.pde.core/
foo.application/dev.properties -os win32 -ws win32 -arch x86 -
consoleLog

!ENTRY org.eclipse.osgi 2 0 2010-06-15 10:27:33.545
!MESSAGE One or more bundles are not resolved because the following
root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.545
!MESSAGE Bundle initial@reference:file:peaberry.eclipse-1.1.1.jar/ was
not resolved.
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.545
!MESSAGE Bundle initial@reference:file:../../../foo/ was not resolved.
!SUBENTRY 2 foo 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing required bundle com.google.inject_[2.0.0,2.0.0].
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.545
!MESSAGE Bundle initial@reference:file:peaberry-1.1.1.jar/ was not
resolved.
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
com.google.inject.binder_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
com.google.inject.matcher_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
com.google.inject.name_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
com.google.inject.util_[1.0.0,2.0.0).

!ENTRY org.eclipse.osgi 2 0 2010-06-15 10:27:33.545
!MESSAGE The following is a complete list of bundles which are not
resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.545
!MESSAGE Bundle org.ops4j.peaberry_1.1.1.v698 [34] was not resolved.
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
com.google.inject.binder_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
com.google.inject.matcher_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
com.google.inject.name_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
com.google.inject.util_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package org.ops4j.peaberry_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
org.ops4j.peaberry.builders_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
org.ops4j.peaberry.util_[1.1.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.545
!MESSAGE Bundle org.ops4j.peaberry.eclipse_1.1.1.v698 [35] was not
resolved.
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package org.ops4j.peaberry_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing imported package
org.ops4j.peaberry.eclipse_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.545
!MESSAGE Bundle foo_1.0.0.qualifier [60] was not resolved.
!SUBENTRY 2 foo 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing required bundle org.ops4j.peaberry_1.1.1.
!SUBENTRY 2 foo 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing required bundle org.ops4j.peaberry.eclipse_1.1.1.
!SUBENTRY 2 foo 2 0 2010-06-15 10:27:33.545
!MESSAGE Missing required bundle com.google.inject_[2.0.0,2.0.0].

!ENTRY org.eclipse.osgi 2 0 2010-06-15 10:27:33.561
!MESSAGE One or more bundles are not resolved because the following
root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.561
!MESSAGE Bundle initial@reference:file:peaberry.eclipse-1.1.1.jar/ was
not resolved.
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:27:33.561
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.561
!MESSAGE Bundle initial@reference:file:../../../foo/ was not resolved.
!SUBENTRY 2 foo 2 0 2010-06-15 10:27:33.561
!MESSAGE Missing required bundle com.google.inject_[2.0.0,2.0.0].
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.561
!MESSAGE Bundle initial@reference:file:peaberry-1.1.1.jar/ was not
resolved.
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.561
!MESSAGE Missing imported package
com.google.inject.binder_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.561
!MESSAGE Missing imported package
com.google.inject.matcher_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.561
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.561
!MESSAGE Missing imported package
com.google.inject.name_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.561
!MESSAGE Missing imported package
com.google.inject.util_[1.0.0,2.0.0).

!ENTRY org.eclipse.osgi 2 0 2010-06-15 10:27:33.577
!MESSAGE The following is a complete list of bundles which are not
resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.577
!MESSAGE Bundle org.ops4j.peaberry_1.1.1.v698 [34] was not resolved.
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package
com.google.inject.binder_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package
com.google.inject.matcher_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package
com.google.inject.name_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package
com.google.inject.util_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package org.ops4j.peaberry_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package
org.ops4j.peaberry.builders_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package
org.ops4j.peaberry.util_[1.1.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.577
!MESSAGE Bundle org.ops4j.peaberry.eclipse_1.1.1.v698 [35] was not
resolved.
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package com.google.inject_[1.0.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package org.ops4j.peaberry_[1.1.0,2.0.0).
!SUBENTRY 2 org.ops4j.peaberry.eclipse 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing imported package
org.ops4j.peaberry.eclipse_[1.0.0,2.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2010-06-15 10:27:33.577
!MESSAGE Bundle foo_1.0.0.qualifier [60] was not resolved.
!SUBENTRY 2 foo 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing required bundle org.ops4j.peaberry_1.1.1.
!SUBENTRY 2 foo 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing required bundle org.ops4j.peaberry.eclipse_1.1.1.
!SUBENTRY 2 foo 2 0 2010-06-15 10:27:33.577
!MESSAGE Missing required bundle com.google.inject_[2.0.0,2.0.0].

!ENTRY org.eclipse.osgi 4 0 2010-06-15 10:27:33.577
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "foo.application" could not be
found in the registry. The applications available are:
org.eclipse.equinox.app.error.
at
org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:
248)
at
org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:
29)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:
110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:
79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
369)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)

esp

unread,
Jun 15, 2010, 10:37:27 AM6/15/10
to Guice and OSGi
Note that the errors in my sample application occur only when I have
both the Orbit guice bundle and the official Guice bundle in the
target platform when I run my app. If I remove the Orbit bundle and
just use the official bundle it works fine.

Stuart McCulloch

unread,
Jun 15, 2010, 11:26:21 AM6/15/10
to guice...@googlegroups.com
On 15 June 2010 22:33, esp <edwin...@gmail.com> wrote:
Hi Stuart,

Thanks for the clarification, that helps. I still have a problem
however in that I'd like to use peaberry in an application that also
unfortunately requires the bad Orbit bundle of Guice. The Orbit
dependency is coming from Xtext, which I need. Peaberry will not work
with the Orbit bundle so I stuck the official Guice bundle in my
target platform as well. So now I have in my target platform the
peaberry bundle, the official Guice bundle AND the Orbit Guice
bundle.

My problem is that I cannot seem to find a way to get peaberry to work
when both Guice bundles are present. Is there a way to get both to
work in the same container? Or will I have to choose between using
Xtext or using peaberry?

Hi Edwin, I'm able to get both jars loaded at the same time with peaberry:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
osgi> ss

Framework is launched.

id    State       Bundle
0    ACTIVE      org.eclipse.osgi_3.5.2.R35x_v20100126
1    ACTIVE      org.aopalliance_1.0.0.v200905130917
2    RESOLVED    org.eclipse.core.runtime.compatibility.registry_3.2.200.v20090429-1800
                Master=7
3    ACTIVE      org.ops4j.peaberry.eclipse_1.1.1.v698
4    ACTIVE      com.google.inject_2.0.0.v201003051000
5    ACTIVE      org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100
6    ACTIVE      org.ops4j.peaberry_1.1.1.v698
7    ACTIVE      org.eclipse.equinox.registry_3.4.100.v20090520-1800
                Fragments=2
8    ACTIVE      com.google.inject_2.0.0

osgi>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

check your target platform - are both bundles selected to be started?

otherwise perhaps this is an RCP specific issue - the broken Orbit jar
uses exactly the same symbolic name and version as the official jar,
but it adds a qualifier which makes it look newer on the OSGi version
scale (ie. "2.0.0" comes before "2.0.0.qualifier").

maybe RCP only installs the Orbit version because it sees it as a minor
upgrade to the official Guice jar, hence no need to install the other one?
(that's what adding a qualifier usually means in OSGi-land)

if you have the Eclipse console enabled, try using the "ss" command
to list the bundles, you should see two "com.google.inject" bundles.

HTH


--
You received this message because you are subscribed to the Google Groups "Guice and OSGi" group.
To post to this group, send email to guice...@googlegroups.com.
To unsubscribe from this group, send email to guice-osgi+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/guice-osgi?hl=en.




--
Cheers, Stuart

esp

unread,
Jun 15, 2010, 6:27:02 PM6/15/10
to Guice and OSGi
Hi Stuart,



On Jun 15, 11:26 am, Stuart McCulloch <mccu...@gmail.com> wrote:
>
> Hi Edwin, I'm able to get both jars loaded at the same time with peaberry:

> check your target platform - are both bundles selected to be started?

Yes.

> otherwise perhaps this is an RCP specific issue - the broken Orbit jar
> uses exactly the same symbolic name and version as the official jar,
> but it adds a qualifier which makes it look newer on the OSGi version
> scale (ie. "2.0.0" comes before "2.0.0.qualifier").
>
> maybe RCP only installs the Orbit version because it sees it as a minor
> upgrade to the official Guice jar, hence no need to install the other one?
> (that's what adding a qualifier usually means in OSGi-land)

This does indeed seem to be what is happening. I created a stock RCP
sample app and added both guice jars to the run configuration. The app
starts, but when I look at the osgi console I see only the Orbit
bundle:

osgi> ss inject

Framework is launched.

id State Bundle
26 INSTALLED com.google.inject_2.0.0.v201003051000


This makes the problem even more insidious because it means I cannot
use both Guice bundles simultaneously, which effectively means I
cannot use peaberry. :-(

Edwin

Stuart McCulloch

unread,
Jun 24, 2010, 9:54:19 AM6/24/10
to guice...@googlegroups.com

thinking about this, you could try our patched build of Guice:

  http://repo2.maven.org/maven2/org/sonatype/spice/inject/guice-patches/2.1.4/

this is the latest trunk (ie. what will eventually become 2.1)
plus two experimental patches, but it's still compatible and
passes all the available UTs

this bundle has a different symname (to show it's patched),
so that should let you load both versions at the same time

HTH

Edwin


--
You received this message because you are subscribed to the Google Groups "Guice and OSGi" group.
To post to this group, send email to guice...@googlegroups.com.
To unsubscribe from this group, send email to guice-osgi+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/guice-osgi?hl=en.

--
Cheers, Stuart
Reply all
Reply to author
Forward
0 new messages