[ 
https://issues.apache.org/jira/browse/FELIX-2618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12914097#action_12914097
 ] 

Derek Baum commented on FELIX-2618:
-----------------------------------

OK, we've worked out what's going on.

https://issues.apache.org/jira/browse/FELIX-2445 was not fixed until _after_ 
the gogo-0.6 release, thus gogo-0.6 tries to loadclass java.lang.System from 
bundle 1 (due to https://issues.apache.org/jira/browse/FELIX-2335).

This happens to work in the default framework distribution, because bundle 1 is 
the felix bundle repository,
but when you add your test bundle to the bundles directory, it becomes bundle 1 
and thus we get the error.

gogo-0.6.1 and a framework-3.0.3 are just about to be released, which will fix 
this.

You can work-around it now, by extracting and fixing gosh_profile, as follows:

$ cd felix-framework-3.0.2
$ jar xvf bundle/org.apache.felix.gogo.shell-0.6.0.jar gosh_profile
$ mkdir etc
$ mv gosh_profile etc

Then edit etc/gosh_profile, and change the following line:

addcommand system ((bundle 1) loadclass java.lang.System)

to

addcommand system ((bundle 0) loadclass java.lang.System)






> Bundle resolution causes CNFE for java.lang.System
> --------------------------------------------------
>
>                 Key: FELIX-2618
>                 URL: https://issues.apache.org/jira/browse/FELIX-2618
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: gogo-0.6.0
>         Environment: Fedora 11 Linux x86_64 Java 1.6.0_13-b03 Felix Framework 
> 3.0.2
>            Reporter: John Dunlap
>            Priority: Minor
>             Fix For: gogo-0.8.0
>
>         Attachments: dictionary-service.zip
>
>
> If I attempt to import the package org.apache.felix.shell in my bundle 
> manifest I get the following error,
> ERROR: Error starting 
> file:/home/jddunlap/apache-felix/felix-framework-3.0.2/bundle/dictionary-service-1.0-SNAPSHOT.jar
>  (org.osgi.framework.BundleException: Unresolved constraint in bundle [1]: 
> Unable to resolve 1.0: missing requirement [1.0] package; 
> (package=org.osgi.framework.shell))
> org.osgi.framework.BundleException: Unresolved constraint in bundle [1]: 
> Unable to resolve 1.0: missing requirement [1.0] package; 
> (package=org.osgi.framework.shell)
>       at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3409)
>       at org.apache.felix.framework.Felix.startBundle(Felix.java:1709)
>       at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1143)
>       at 
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
>       at java.lang.Thread.run(Thread.java:619)
> bundle://5.0:1/gosh_profile:15.20: ClassNotFoundException: java.lang.System
> java.lang.ClassNotFoundException: java.lang.System
>       at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1591)
>       at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887)
>       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.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136)
>       at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:465)
>       at 
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:335)
>       at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
>       at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:184)
>       at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:121)
>       at org.apache.felix.gogo.runtime.Closure.eval(Closure.java:265)
>       at 
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:307)
>       at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
>       at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:184)
>       at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:121)
>       at 
> org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:78)
>       at org.apache.felix.gogo.shell.Shell.source(Shell.java:186)
>       at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:106)
>       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.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136)
>       at 
> org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
>       at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:421)
>       at 
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:335)
>       at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
>       at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:184)
>       at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:121)
>       at 
> org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:78)
>       at org.apache.felix.gogo.shell.Activator.run(Activator.java:72)
>       at java.lang.Thread.run(Thread.java:619)
> Caused by: org.osgi.framework.BundleException: Unresolved constraint in 
> bundle [1]: Unable to resolve 1.0: missing requirement [1.0] package; 
> (package=org.osgi.framework.shell)
>       at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3409)
>       at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1584)
>       ... 33 more
> The problem appears to be in the manifest. If I remove
> "org.apache.felix.shell" from the Import-Package manifest entry, the
> error goes away. If I put it back the error returns. For example,
> changing this,
> "Import-Package: org.osgi.framework,org.apache.felix.shell"
> to this,
> "Import-Package: org.osgi.framework"
> makes the error go away. It does not seem to matter if I implement
> service interfaces from that package. The import itself appears to
> trigger the error.
> Issue created as requested by Richard S. Hall
> Cheers!
> -John

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to