You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Matej Pončák <ma...@r-sys.sk> on 2009/05/21 12:26:55 UTC

org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Hi.

I try to use Felix OSGi with GUI.
I have a problem with:
org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
package; (&(package=org.jdesktop.application)(version>=0.0.0))

My bundle is number 5.

-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (1.8.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
[   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
[   5] [Installed  ] [    1] MIM module (0.0.7)
-> update 5
-> start 5
org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
package; (&(package=org.jdesktop.application)(version>=0.0.0))
-> exports 5
[5] exports:
------------
Nothing
-> imports 5
[5] imports:
------------
Nothing
-> headers 5

MIM module (5)
--------------
Main-Class = mis.MISApp
Bundle-Activator = mis.MISApp
Bundle-Description = My description
Export-Package = mis.service
Bundle-Version = 0.0.7
Created-By = 10.0-b23 (Sun Microsystems Inc.)
Manifest-Version = 1.0
Bundle-Vendor = test
Bundle-Name = MIM module
Ant-Version = Apache Ant 1.7.0
Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
lib/felix.jar
Import-Package = org.osgi.framework,org.jdesktop.application
X-COMMENT = Main-Class will be added automatically by build
->


I seted this option in my config:
# To append packages to the default set of exported system packages,
# set this value.
org.osgi.framework.system.packages.extra=org.jdesktop.application.*


And my Java file is:
<filecontent>
/*
 * MISApp.java
 */

package mis;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceEvent;
import java.util.Properties;
import mis.service.MimService;



/**
 * The main class of the application.
 */
public class MISApp extends SingleFrameApplication implements
BundleActivator {
   
    public void start(BundleContext context)
    {
        Properties props = new Properties();
        props.put("Language", "English");
        context.registerService(
            MimService.class.getName(), new MimServiceImpl(), props);
    }


    public void stop(BundleContext context)
    {
        context=null;
        // NOTE: The service is automatically unregistered.
    }
   
   
    private static class MimServiceImpl implements MimService
    {
        // The set of words contained in the dictionary.
        String[] m_dictionary =
            { "welcome", "to", "the", "osgi", "tutorial" };

        /**
         * Implements DictionaryService.checkWord(). Determines
         * if the passed in word is contained in the dictionary.
         * @param word the word to be checked.
         * @return true if the word is in the dictionary,
         *         false otherwise.
        **/
        public void setMenuItem(String word)
        {
            word = word.toLowerCase();
           
            System.out.println("Prislo taketo slovo:" + word);
           /* // This is very inefficient
            for (int i = 0; i < m_dictionary.length; i++)
            {
                if (m_dictionary[i].equals(word))
                {
                    return true;
                }
            }
            return false;
            */
        }
    }

   

    /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
        show(new MISView(this));
    }

    /**
     * This method is to initialize the specified window by injecting
resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of MISApp
     */
    public static MISApp getApplication() {
        return Application.getInstance(MISApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        launch(MISApp.class, args);
    }
}

</filecontent>


When I want to run my application with command
java -jar MIS.jar
it works fine.

But when I try to run it in Felix prompt it doesn't run.

I tried to search in mail-archive, but it didn't help.

Thanks for all suggestions.

Matej


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/5/21 Matej Pončák <ma...@r-sys.sk>

>
> Although there is some Errors, it seems to my service is running.
>
> I can run my jar file with command  "java -jar MIS.jar" successfuly.
> I expected that felix.jar doesn't change my enviroment settings
> (classpath). So, do I have to set all my env. (classpath) settings to
> java command? I expected that Felix appends their own settings, but not
> overwrite.
>

looking at your original manifest, it contains the following:

   Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
lib/felix.jar

which the java launcher uses to augment the classpath when running with the
"-jar" option
( in this case the referenced jars are under an external lib directory
alongside the MIS.jar )

when you run this jarfile as a bundle under Felix, this manifest entry is
ignored because it
doesn't make sense in an OSGi application - the framework effectively treats
your bundle
as a self-contained unit, and doesn't know about the external lib directory
alongside it.

this is why you need to manually add those jars to your Felix launch command
- of course
you could write a custom launcher that scans a bunch of bundles, extracts
any Class-Path
headers, and add them to the launch classpath

however, you might like to know that in OSGi R4 you can embed jars inside
your bundle
(ie. as entries in the jarfile, like in a WAR) and refer to them using the
Bundle-ClassPath
header, for example:

   Bundle-ClassPath: ., lib/appframework-1.0.3.jar, lib/swing-worker-1.1.jar

where the appframework and swing worker jarfiles are actually inside your
bundle - this
is useful as it means you can embed implementation jars and keep them
private from
other bundles without breaking them open and inlining the contents

of course the downside of embedded jars is that classic java tools like
javac, etc can't
handle them - which is why the old Class-Path header refers to external
directories :(

HTH

Thanks a lot for  yours help.
> Can you please help me with actual error?
> (org.osgi.framework.BundleException: R3 imports cannot contain directives.)
>

as Richard said if your manifest is as shown in the first email then it
could be a bug in Felix's R3 parser

could you open an issue on JIRA and attach your bundle? (or a testcase
bundle that recreates the error)

Matej
>

-- 
Cheers, Stuart

Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Could you create a JIRA issue and include this manifest with it?

     http://issues.apache.org/jira/browse/FELIX

Thanks.

-> richard


On 5/22/09 2:52 AM, Matej Pončák wrote:
> I think I didn't change my manifest. If I change some item, it was only
> "Import-Package: org.osgi.framework,org.jdesktop.application"
>
> My actual manifest is:
>
> <manifestcontent>
> Manifest-Version: 1.0
> Ant-Version: Apache Ant 1.7.0
> Created-By: 10.0-b23 (Sun Microsystems Inc.)
> Main-Class: mis.MISApp
> Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
> lib/felix.jar
> X-COMMENT: Main-Class will be added automatically by build
> Bundle-Name: MIM module
> Bundle-Description: My description
> Bundle-Vendor: test
> Bundle-Version: 0.0.8
> Bundle-Activator: mis.MISApp
> Export-Package: mis.service
> Import-Package: org.osgi.framework,org.jdesktop.application
> </manifestcontent>
>
> With this manifest I can get error "org.osgi.framework.BundleException:
> R3 imports cannot contain directives."
>
>
>    
>> Did you change your MIM bundle's manifest from when you first showed it?
>>
>> I ask because I don't see any directives on your imports, but that is
>> what Felix is complaining about.
>>
>> Your bundle is considered an "R3" bundle because it doesn't include in
>> its manifest:
>>
>>      Bundle-ManifestVersion: 2
>>      Bundle-SymbolicName: my.foo.bundle
>>
>> It is ok to create an R3 bundle, it should still work, you just can
>> use R4 features.
>>
>> If your manifest still as you listed it, maybe a bug was introduced
>> into R3 manifest verification.
>>
>> ->  richard
>>
>> On 5/21/09 9:32 AM, Matej Pončák wrote:
>>      
>>> I tried launch it with command:
>>>
>>> java -classpath bin/felix.jar:../MIS/dist/lib/appframework-1.0.3.jar
>>> org.apache.felix.main.Main
>>>
>>> and .....
>>>
>>> I think its better:
>>>
>>> matej@Rompilio:~/NetBeansProjects/Felix$ java -classpath
>>> bin/felix.jar:../MIS/dist/lib/appframework-1.0.3.jar
>>> org.apache.felix.main.Main
>>>
>>> Welcome to Felix.
>>> =================
>>>
>>> org.osgi.framework.BundleException: R3 imports cannot contain
>>> directives.
>>>       at
>>> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>>>
>>>       at
>>> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>>>
>>>       at
>>> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>>>
>>>       at
>>> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>>>       at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>>>       at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>>>       at org.apache.felix.framework.Felix.init(Felix.java:581)
>>>       at org.apache.felix.framework.Felix.start(Felix.java:672)
>>>       at org.apache.felix.main.Main.main(Main.java:213)
>>> org.osgi.framework.BundleException: R3 imports cannot contain
>>> directives.
>>>       at
>>> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>>>
>>>       at
>>> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>>>
>>>       at
>>> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>>>
>>>       at
>>> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>>>       at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>>>       at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>>>       at org.apache.felix.framework.Felix.init(Felix.java:581)
>>>       at org.apache.felix.framework.Felix.start(Felix.java:672)
>>>       at org.apache.felix.main.Main.main(Main.java:213)
>>> ERROR: Unable to re-install
>>> file:/home/matej/NetBeansProjects/MIS/dist/MIS.jar
>>> (org.osgi.framework.BundleException: R3 imports cannot contain
>>> directives.)
>>> org.osgi.framework.BundleException: R3 imports cannot contain
>>> directives.
>>>       at
>>> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>>>
>>>       at
>>> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>>>
>>>       at
>>> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>>>
>>>       at
>>> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>>>       at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>>>       at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>>>       at org.apache.felix.framework.Felix.init(Felix.java:581)
>>>       at org.apache.felix.framework.Felix.start(Felix.java:672)
>>>       at org.apache.felix.main.Main.main(Main.java:213)
>>> ->
>>> ->
>>> ->
>>> ->   ps
>>> START LEVEL 1
>>>      ID   State         Level  Name
>>> [   0] [Active     ] [    0] System Bundle (1.8.0)
>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
>>> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
>>> [   5] [Active     ] [    1] MIM module (0.0.7)
>>> ->   services 5
>>>
>>> MIM module (5) provides:
>>> ------------------------
>>> Language = English
>>> objectClass = mis.service.MimService
>>> service.id = 26
>>> ->
>>>
>>> Although there is some Errors, it seems to my service is running.
>>>
>>>
>>> I can run my jar file with command  "java -jar MIS.jar" successfuly.
>>> I expected that felix.jar doesn't change my enviroment settings
>>> (classpath). So, do I have to set all my env. (classpath) settings to
>>> java command? I expected that Felix appends their own settings, but not
>>> overwrite.
>>>
>>> Thanks a lot for  yours help.
>>> Can you please help me with actual error?
>>> (org.osgi.framework.BundleException: R3 imports cannot contain
>>> directives.)
>>>
>>> Matej
>>>
>>>        
>>>>
>>>>          
>>>>> Any another ideas?
>>>>>
>>>>> Matej
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>>> And my Java file is:
>>>>>>
>>>>>>
>>>>>>
>>>>>>              
>>>>>>> <filecontent>
>>>>>>> /*
>>>>>>>    * MISApp.java
>>>>>>>    */
>>>>>>>
>>>>>>> package mis;
>>>>>>>
>>>>>>> import org.jdesktop.application.Application;
>>>>>>> import org.jdesktop.application.SingleFrameApplication;
>>>>>>> import org.osgi.framework.BundleActivator;
>>>>>>> import org.osgi.framework.BundleContext;
>>>>>>> import org.osgi.framework.ServiceListener;
>>>>>>> import org.osgi.framework.ServiceEvent;
>>>>>>> import java.util.Properties;
>>>>>>> import mis.service.MimService;
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> /**
>>>>>>>    * The main class of the application.
>>>>>>>    */
>>>>>>> public class MISApp extends SingleFrameApplication implements
>>>>>>> BundleActivator {
>>>>>>>
>>>>>>>      public void start(BundleContext context)
>>>>>>>      {
>>>>>>>          Properties props = new Properties();
>>>>>>>          props.put("Language", "English");
>>>>>>>          context.registerService(
>>>>>>>              MimService.class.getName(), new MimServiceImpl(),
>>>>>>> props);
>>>>>>>      }
>>>>>>>
>>>>>>>
>>>>>>>      public void stop(BundleContext context)
>>>>>>>      {
>>>>>>>          context=null;
>>>>>>>          // NOTE: The service is automatically unregistered.
>>>>>>>      }
>>>>>>>
>>>>>>>
>>>>>>>      private static class MimServiceImpl implements MimService
>>>>>>>      {
>>>>>>>          // The set of words contained in the dictionary.
>>>>>>>          String[] m_dictionary =
>>>>>>>              { "welcome", "to", "the", "osgi", "tutorial" };
>>>>>>>
>>>>>>>          /**
>>>>>>>           * Implements DictionaryService.checkWord(). Determines
>>>>>>>           * if the passed in word is contained in the dictionary.
>>>>>>>           * @param word the word to be checked.
>>>>>>>           * @return true if the word is in the dictionary,
>>>>>>>           *         false otherwise.
>>>>>>>          **/
>>>>>>>          public void setMenuItem(String word)
>>>>>>>          {
>>>>>>>              word = word.toLowerCase();
>>>>>>>
>>>>>>>              System.out.println("Prislo taketo slovo:" + word);
>>>>>>>             /* // This is very inefficient
>>>>>>>              for (int i = 0; i<   m_dictionary.length; i++)
>>>>>>>              {
>>>>>>>                  if (m_dictionary[i].equals(word))
>>>>>>>                  {
>>>>>>>                      return true;
>>>>>>>                  }
>>>>>>>              }
>>>>>>>              return false;
>>>>>>>              */
>>>>>>>          }
>>>>>>>      }
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>      /**
>>>>>>>       * At startup create and show the main frame of the application.
>>>>>>>       */
>>>>>>>      @Override protected void startup() {
>>>>>>>          show(new MISView(this));
>>>>>>>      }
>>>>>>>
>>>>>>>      /**
>>>>>>>       * This method is to initialize the specified window by
>>>>>>> injecting
>>>>>>> resources.
>>>>>>>       * Windows shown in our application come fully initialized
>>>>>>> from the
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>> GUI
>>>>>
>>>>>
>>>>>            
>>>>>>>       * builder, so this additional configuration is not needed.
>>>>>>>       */
>>>>>>>      @Override protected void configureWindow(java.awt.Window root) {
>>>>>>>      }
>>>>>>>
>>>>>>>      /**
>>>>>>>       * A convenient static getter for the application instance.
>>>>>>>       * @return the instance of MISApp
>>>>>>>       */
>>>>>>>      public static MISApp getApplication() {
>>>>>>>          return Application.getInstance(MISApp.class);
>>>>>>>      }
>>>>>>>
>>>>>>>      /**
>>>>>>>       * Main method launching the application.
>>>>>>>       */
>>>>>>>      public static void main(String[] args) {
>>>>>>>          launch(MISApp.class, args);
>>>>>>>      }
>>>>>>> }
>>>>>>>
>>>>>>> </filecontent>
>>>>>>>
>>>>>>>
>>>>>>> When I want to run my application with command
>>>>>>> java -jar MIS.jar
>>>>>>> it works fine.
>>>>>>>
>>>>>>> But when I try to run it in Felix prompt it doesn't run.
>>>>>>>
>>>>>>> I tried to search in mail-archive, but it didn't help.
>>>>>>>
>>>>>>> Thanks for all suggestions.
>>>>>>>
>>>>>>> Matej
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>>
>>>>>>              
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>
>>>>          
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>        
>
>
> <ma...@r-sys.sk>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>    

Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by Matej Pončák <ma...@r-sys.sk>.
I think I didn't change my manifest. If I change some item, it was only
"Import-Package: org.osgi.framework,org.jdesktop.application"

My actual manifest is:

<manifestcontent>
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 10.0-b23 (Sun Microsystems Inc.)
Main-Class: mis.MISApp
Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
lib/felix.jar
X-COMMENT: Main-Class will be added automatically by build
Bundle-Name: MIM module
Bundle-Description: My description
Bundle-Vendor: test
Bundle-Version: 0.0.8
Bundle-Activator: mis.MISApp
Export-Package: mis.service
Import-Package: org.osgi.framework,org.jdesktop.application
</manifestcontent>

With this manifest I can get error "org.osgi.framework.BundleException:
R3 imports cannot contain directives."


> Did you change your MIM bundle's manifest from when you first showed it?
>
> I ask because I don't see any directives on your imports, but that is
> what Felix is complaining about.
>
> Your bundle is considered an "R3" bundle because it doesn't include in
> its manifest:
>
>     Bundle-ManifestVersion: 2
>     Bundle-SymbolicName: my.foo.bundle
>
> It is ok to create an R3 bundle, it should still work, you just can
> use R4 features.
>
> If your manifest still as you listed it, maybe a bug was introduced
> into R3 manifest verification.
>
> -> richard
>
> On 5/21/09 9:32 AM, Matej Pončák wrote:
>> I tried launch it with command:
>>
>> java -classpath bin/felix.jar:../MIS/dist/lib/appframework-1.0.3.jar
>> org.apache.felix.main.Main
>>
>> and .....
>>
>> I think its better:
>>
>> matej@Rompilio:~/NetBeansProjects/Felix$ java -classpath
>> bin/felix.jar:../MIS/dist/lib/appframework-1.0.3.jar
>> org.apache.felix.main.Main
>>
>> Welcome to Felix.
>> =================
>>
>> org.osgi.framework.BundleException: R3 imports cannot contain
>> directives.
>>      at
>> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>>
>>      at
>> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>>
>>      at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>>
>>      at
>> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>>      at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>>      at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>>      at org.apache.felix.framework.Felix.init(Felix.java:581)
>>      at org.apache.felix.framework.Felix.start(Felix.java:672)
>>      at org.apache.felix.main.Main.main(Main.java:213)
>> org.osgi.framework.BundleException: R3 imports cannot contain
>> directives.
>>      at
>> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>>
>>      at
>> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>>
>>      at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>>
>>      at
>> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>>      at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>>      at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>>      at org.apache.felix.framework.Felix.init(Felix.java:581)
>>      at org.apache.felix.framework.Felix.start(Felix.java:672)
>>      at org.apache.felix.main.Main.main(Main.java:213)
>> ERROR: Unable to re-install
>> file:/home/matej/NetBeansProjects/MIS/dist/MIS.jar
>> (org.osgi.framework.BundleException: R3 imports cannot contain
>> directives.)
>> org.osgi.framework.BundleException: R3 imports cannot contain
>> directives.
>>      at
>> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>>
>>      at
>> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>>
>>      at
>> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>>
>>      at
>> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>>      at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>>      at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>>      at org.apache.felix.framework.Felix.init(Felix.java:581)
>>      at org.apache.felix.framework.Felix.start(Felix.java:672)
>>      at org.apache.felix.main.Main.main(Main.java:213)
>> ->
>> ->
>> ->
>> ->  ps
>> START LEVEL 1
>>     ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.8.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
>> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
>> [   5] [Active     ] [    1] MIM module (0.0.7)
>> ->  services 5
>>
>> MIM module (5) provides:
>> ------------------------
>> Language = English
>> objectClass = mis.service.MimService
>> service.id = 26
>> ->
>>
>> Although there is some Errors, it seems to my service is running.
>>
>>
>> I can run my jar file with command  "java -jar MIS.jar" successfuly.
>> I expected that felix.jar doesn't change my enviroment settings
>> (classpath). So, do I have to set all my env. (classpath) settings to
>> java command? I expected that Felix appends their own settings, but not
>> overwrite.
>>
>> Thanks a lot for  yours help.
>> Can you please help me with actual error?
>> (org.osgi.framework.BundleException: R3 imports cannot contain
>> directives.)
>>
>> Matej
>>   
>>>
>>>     
>>>> Any another ideas?
>>>>
>>>> Matej
>>>>
>>>>
>>>>       
>>>>> And my Java file is:
>>>>>
>>>>>
>>>>>         
>>>>>> <filecontent>
>>>>>> /*
>>>>>>   * MISApp.java
>>>>>>   */
>>>>>>
>>>>>> package mis;
>>>>>>
>>>>>> import org.jdesktop.application.Application;
>>>>>> import org.jdesktop.application.SingleFrameApplication;
>>>>>> import org.osgi.framework.BundleActivator;
>>>>>> import org.osgi.framework.BundleContext;
>>>>>> import org.osgi.framework.ServiceListener;
>>>>>> import org.osgi.framework.ServiceEvent;
>>>>>> import java.util.Properties;
>>>>>> import mis.service.MimService;
>>>>>>
>>>>>>
>>>>>>
>>>>>> /**
>>>>>>   * The main class of the application.
>>>>>>   */
>>>>>> public class MISApp extends SingleFrameApplication implements
>>>>>> BundleActivator {
>>>>>>
>>>>>>     public void start(BundleContext context)
>>>>>>     {
>>>>>>         Properties props = new Properties();
>>>>>>         props.put("Language", "English");
>>>>>>         context.registerService(
>>>>>>             MimService.class.getName(), new MimServiceImpl(),
>>>>>> props);
>>>>>>     }
>>>>>>
>>>>>>
>>>>>>     public void stop(BundleContext context)
>>>>>>     {
>>>>>>         context=null;
>>>>>>         // NOTE: The service is automatically unregistered.
>>>>>>     }
>>>>>>
>>>>>>
>>>>>>     private static class MimServiceImpl implements MimService
>>>>>>     {
>>>>>>         // The set of words contained in the dictionary.
>>>>>>         String[] m_dictionary =
>>>>>>             { "welcome", "to", "the", "osgi", "tutorial" };
>>>>>>
>>>>>>         /**
>>>>>>          * Implements DictionaryService.checkWord(). Determines
>>>>>>          * if the passed in word is contained in the dictionary.
>>>>>>          * @param word the word to be checked.
>>>>>>          * @return true if the word is in the dictionary,
>>>>>>          *         false otherwise.
>>>>>>         **/
>>>>>>         public void setMenuItem(String word)
>>>>>>         {
>>>>>>             word = word.toLowerCase();
>>>>>>
>>>>>>             System.out.println("Prislo taketo slovo:" + word);
>>>>>>            /* // This is very inefficient
>>>>>>             for (int i = 0; i<  m_dictionary.length; i++)
>>>>>>             {
>>>>>>                 if (m_dictionary[i].equals(word))
>>>>>>                 {
>>>>>>                     return true;
>>>>>>                 }
>>>>>>             }
>>>>>>             return false;
>>>>>>             */
>>>>>>         }
>>>>>>     }
>>>>>>
>>>>>>
>>>>>>
>>>>>>     /**
>>>>>>      * At startup create and show the main frame of the application.
>>>>>>      */
>>>>>>     @Override protected void startup() {
>>>>>>         show(new MISView(this));
>>>>>>     }
>>>>>>
>>>>>>     /**
>>>>>>      * This method is to initialize the specified window by
>>>>>> injecting
>>>>>> resources.
>>>>>>      * Windows shown in our application come fully initialized
>>>>>> from the
>>>>>>
>>>>>>            
>>>> GUI
>>>>
>>>>       
>>>>>>      * builder, so this additional configuration is not needed.
>>>>>>      */
>>>>>>     @Override protected void configureWindow(java.awt.Window root) {
>>>>>>     }
>>>>>>
>>>>>>     /**
>>>>>>      * A convenient static getter for the application instance.
>>>>>>      * @return the instance of MISApp
>>>>>>      */
>>>>>>     public static MISApp getApplication() {
>>>>>>         return Application.getInstance(MISApp.class);
>>>>>>     }
>>>>>>
>>>>>>     /**
>>>>>>      * Main method launching the application.
>>>>>>      */
>>>>>>     public static void main(String[] args) {
>>>>>>         launch(MISApp.class, args);
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> </filecontent>
>>>>>>
>>>>>>
>>>>>> When I want to run my application with command
>>>>>> java -jar MIS.jar
>>>>>> it works fine.
>>>>>>
>>>>>> But when I try to run it in Felix prompt it doesn't run.
>>>>>>
>>>>>> I tried to search in mail-archive, but it didn't help.
>>>>>>
>>>>>> Thanks for all suggestions.
>>>>>>
>>>>>> Matej
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>
>>>>>          
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>        
>>>
>>>      
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>    
>


<ma...@r-sys.sk>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Did you change your MIM bundle's manifest from when you first showed it?

I ask because I don't see any directives on your imports, but that is 
what Felix is complaining about.

Your bundle is considered an "R3" bundle because it doesn't include in 
its manifest:

     Bundle-ManifestVersion: 2
     Bundle-SymbolicName: my.foo.bundle

It is ok to create an R3 bundle, it should still work, you just can use 
R4 features.

If your manifest still as you listed it, maybe a bug was introduced into 
R3 manifest verification.

-> richard

On 5/21/09 9:32 AM, Matej Pončák wrote:
> I tried launch it with command:
>
> java -classpath bin/felix.jar:../MIS/dist/lib/appframework-1.0.3.jar
> org.apache.felix.main.Main
>
> and .....
>
> I think its better:
>
> matej@Rompilio:~/NetBeansProjects/Felix$ java -classpath
> bin/felix.jar:../MIS/dist/lib/appframework-1.0.3.jar
> org.apache.felix.main.Main
>
> Welcome to Felix.
> =================
>
> org.osgi.framework.BundleException: R3 imports cannot contain directives.
>      at
> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>      at
> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>      at
> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>      at
> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>      at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>      at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>      at org.apache.felix.framework.Felix.init(Felix.java:581)
>      at org.apache.felix.framework.Felix.start(Felix.java:672)
>      at org.apache.felix.main.Main.main(Main.java:213)
> org.osgi.framework.BundleException: R3 imports cannot contain directives.
>      at
> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>      at
> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>      at
> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>      at
> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>      at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>      at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>      at org.apache.felix.framework.Felix.init(Felix.java:581)
>      at org.apache.felix.framework.Felix.start(Felix.java:672)
>      at org.apache.felix.main.Main.main(Main.java:213)
> ERROR: Unable to re-install
> file:/home/matej/NetBeansProjects/MIS/dist/MIS.jar
> (org.osgi.framework.BundleException: R3 imports cannot contain directives.)
> org.osgi.framework.BundleException: R3 imports cannot contain directives.
>      at
> org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
>      at
> org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
>      at
> org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
>      at
> org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
>      at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
>      at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
>      at org.apache.felix.framework.Felix.init(Felix.java:581)
>      at org.apache.felix.framework.Felix.start(Felix.java:672)
>      at org.apache.felix.main.Main.main(Main.java:213)
> ->
> ->
> ->
> ->  ps
> START LEVEL 1
>     ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.8.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
> [   5] [Active     ] [    1] MIM module (0.0.7)
> ->  services 5
>
> MIM module (5) provides:
> ------------------------
> Language = English
> objectClass = mis.service.MimService
> service.id = 26
> ->
>
> Although there is some Errors, it seems to my service is running.
>
>
> I can run my jar file with command  "java -jar MIS.jar" successfuly.
> I expected that felix.jar doesn't change my enviroment settings
> (classpath). So, do I have to set all my env. (classpath) settings to
> java command? I expected that Felix appends their own settings, but not
> overwrite.
>
> Thanks a lot for  yours help.
> Can you please help me with actual error?
> (org.osgi.framework.BundleException: R3 imports cannot contain directives.)
>
> Matej
>    
>>
>>      
>>> Any another ideas?
>>>
>>> Matej
>>>
>>>
>>>        
>>>> And my Java file is:
>>>>
>>>>
>>>>          
>>>>> <filecontent>
>>>>> /*
>>>>>   * MISApp.java
>>>>>   */
>>>>>
>>>>> package mis;
>>>>>
>>>>> import org.jdesktop.application.Application;
>>>>> import org.jdesktop.application.SingleFrameApplication;
>>>>> import org.osgi.framework.BundleActivator;
>>>>> import org.osgi.framework.BundleContext;
>>>>> import org.osgi.framework.ServiceListener;
>>>>> import org.osgi.framework.ServiceEvent;
>>>>> import java.util.Properties;
>>>>> import mis.service.MimService;
>>>>>
>>>>>
>>>>>
>>>>> /**
>>>>>   * The main class of the application.
>>>>>   */
>>>>> public class MISApp extends SingleFrameApplication implements
>>>>> BundleActivator {
>>>>>
>>>>>     public void start(BundleContext context)
>>>>>     {
>>>>>         Properties props = new Properties();
>>>>>         props.put("Language", "English");
>>>>>         context.registerService(
>>>>>             MimService.class.getName(), new MimServiceImpl(), props);
>>>>>     }
>>>>>
>>>>>
>>>>>     public void stop(BundleContext context)
>>>>>     {
>>>>>         context=null;
>>>>>         // NOTE: The service is automatically unregistered.
>>>>>     }
>>>>>
>>>>>
>>>>>     private static class MimServiceImpl implements MimService
>>>>>     {
>>>>>         // The set of words contained in the dictionary.
>>>>>         String[] m_dictionary =
>>>>>             { "welcome", "to", "the", "osgi", "tutorial" };
>>>>>
>>>>>         /**
>>>>>          * Implements DictionaryService.checkWord(). Determines
>>>>>          * if the passed in word is contained in the dictionary.
>>>>>          * @param word the word to be checked.
>>>>>          * @return true if the word is in the dictionary,
>>>>>          *         false otherwise.
>>>>>         **/
>>>>>         public void setMenuItem(String word)
>>>>>         {
>>>>>             word = word.toLowerCase();
>>>>>
>>>>>             System.out.println("Prislo taketo slovo:" + word);
>>>>>            /* // This is very inefficient
>>>>>             for (int i = 0; i<  m_dictionary.length; i++)
>>>>>             {
>>>>>                 if (m_dictionary[i].equals(word))
>>>>>                 {
>>>>>                     return true;
>>>>>                 }
>>>>>             }
>>>>>             return false;
>>>>>             */
>>>>>         }
>>>>>     }
>>>>>
>>>>>
>>>>>
>>>>>     /**
>>>>>      * At startup create and show the main frame of the application.
>>>>>      */
>>>>>     @Override protected void startup() {
>>>>>         show(new MISView(this));
>>>>>     }
>>>>>
>>>>>     /**
>>>>>      * This method is to initialize the specified window by injecting
>>>>> resources.
>>>>>      * Windows shown in our application come fully initialized from the
>>>>>
>>>>>            
>>> GUI
>>>
>>>        
>>>>>      * builder, so this additional configuration is not needed.
>>>>>      */
>>>>>     @Override protected void configureWindow(java.awt.Window root) {
>>>>>     }
>>>>>
>>>>>     /**
>>>>>      * A convenient static getter for the application instance.
>>>>>      * @return the instance of MISApp
>>>>>      */
>>>>>     public static MISApp getApplication() {
>>>>>         return Application.getInstance(MISApp.class);
>>>>>     }
>>>>>
>>>>>     /**
>>>>>      * Main method launching the application.
>>>>>      */
>>>>>     public static void main(String[] args) {
>>>>>         launch(MISApp.class, args);
>>>>>     }
>>>>> }
>>>>>
>>>>> </filecontent>
>>>>>
>>>>>
>>>>> When I want to run my application with command
>>>>> java -jar MIS.jar
>>>>> it works fine.
>>>>>
>>>>> But when I try to run it in Felix prompt it doesn't run.
>>>>>
>>>>> I tried to search in mail-archive, but it didn't help.
>>>>>
>>>>> Thanks for all suggestions.
>>>>>
>>>>> Matej
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>
>>>>          
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>        
>>
>>      
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>    

Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by Matej Pončák <ma...@r-sys.sk>.
> 2009/5/21 Matej Pončák <ma...@r-sys.sk>
>
>   
>>> 2009/5/21 Matej Pončák <ma...@r-sys.sk>
>>>
>>>
>>>       
>>>> Hi.
>>>>
>>>> I try to use Felix OSGi with GUI.
>>>> I have a problem with:
>>>> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
>>>> package; (&(package=org.jdesktop.application)(version>=0.0.0))
>>>>
>>>> My bundle is number 5.
>>>>
>>>> -> ps
>>>> START LEVEL 1
>>>>   ID   State         Level  Name
>>>> [   0] [Active     ] [    0] System Bundle (1.8.0)
>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
>>>> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
>>>> [   5] [Installed  ] [    1] MIM module (0.0.7)
>>>> -> update 5
>>>> -> start 5
>>>> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
>>>> package; (&(package=org.jdesktop.application)(version>=0.0.0))
>>>> -> exports 5
>>>> [5] exports:
>>>> ------------
>>>> Nothing
>>>> -> imports 5
>>>> [5] imports:
>>>> ------------
>>>> Nothing
>>>> -> headers 5
>>>>
>>>> MIM module (5)
>>>> --------------
>>>> Main-Class = mis.MISApp
>>>> Bundle-Activator = mis.MISApp
>>>> Bundle-Description = My description
>>>> Export-Package = mis.service
>>>> Bundle-Version = 0.0.7
>>>> Created-By = 10.0-b23 (Sun Microsystems Inc.)
>>>> Manifest-Version = 1.0
>>>> Bundle-Vendor = test
>>>> Bundle-Name = MIM module
>>>> Ant-Version = Apache Ant 1.7.0
>>>> Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
>>>> lib/felix.jar
>>>> Import-Package = org.osgi.framework,org.jdesktop.application
>>>> X-COMMENT = Main-Class will be added automatically by build
>>>> ->
>>>>
>>>>
>>>> I seted this option in my config:
>>>> # To append packages to the default set of exported system packages,
>>>> # set this value.
>>>> org.osgi.framework.system.packages.extra=org.jdesktop.application.*
>>>>
>>>>
>>>>         
>>> can you try this instead:
>>>
>>>
>>>
>>>       
>> org.osgi.framework.system.packages.extra=org.jdesktop.application,org.jdesktop.application.*
>>     
>>> because according to the OSGi spec, a package wildcard of:
>>>
>>>    org.foo.*
>>>
>>> will only match against sub-packages of org.foo and _not_ org.foo itself
>>>
>>> just for reference, in case you think the solution to this would be to
>>>       
>> use:
>>     
>>>    org.foo*
>>>
>>> this isn't a valid package wildcard as the "*" has to be on it's own or
>>> after a "."
>>>
>>> ( if you think this is all confusing I agree, but that's the spec'd
>>> behaviour... )
>>>
>>>       
>> I tried change
>> org.osgi.framework.system.packages.extra=org.jdesktop.application.*
>>
>> to
>>
>>
>> org.osgi.framework.system.packages.extra=org.jdesktop.application,org.jdesktop.application.*
>>
>>
>>
>> Here is my output:
>>
>> -> ps
>> START LEVEL 1
>>   ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.8.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
>> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
>> [   5] [Resolved   ] [    1] MIM module (0.0.7)
>> -> update 5
>> -> ps
>> START LEVEL 1
>>   ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.8.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
>> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
>> [   5] [Installed  ] [    1] MIM module (0.0.7)
>> -> start 5
>> org.osgi.framework.BundleException: Activator start error in bundle [5].
>>    at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
>>    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
>>    at
>>
>> org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:105)
>>    at
>>
>> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:291)
>>    at
>>
>> org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:177)
>>    at java.lang.Thread.run(Thread.java:636)
>> Caused by: java.lang.NoClassDefFoundError:
>> org/jdesktop/application/SingleFrameApplication
>>    at java.lang.ClassLoader.defineClass1(Native Method)
>>    at java.lang.ClassLoader.defineClass(ClassLoader.java:637)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1556)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:562)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
>>    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:481)
>>    at
>> org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3344)
>>    at org.apache.felix.framework.Felix.startBundle(Felix.java:1453)
>>    ... 5 more
>> Caused by: java.lang.ClassNotFoundException:
>> org.jdesktop.application.SingleFrameApplication
>>    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>>    at java.security.AccessController.doPrivileged(Native Method)
>>    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>>    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
>>    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>>    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>>    at
>>
>> org.apache.felix.framework.ExtensionManager$ExtensionManagerModule.getClassByDelegation(ExtensionManager.java:653)
>>    at
>> org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports(ModuleImpl.java:1184)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:557)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
>>    at
>>
>> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
>>    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>>    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
>>    ... 15 more
>> java.lang.NoClassDefFoundError:
>> org/jdesktop/application/SingleFrameApplication
>> -> headers 5
>>
>> MIM module (5)
>> --------------
>> Main-Class = mis.MISApp
>> Bundle-Activator = mis.MISApp
>> Bundle-Description = My description
>> Export-Package = mis.service
>> Bundle-Version = 0.0.7
>> Created-By = 10.0-b23 (Sun Microsystems Inc.)
>> Manifest-Version = 1.0
>> Bundle-Vendor = test
>> Bundle-Name = MIM module
>> Ant-Version = Apache Ant 1.7.0
>> Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
>> lib/felix.jar
>> Import-Package = org.osgi.framework,org.jdesktop.application
>> X-COMMENT = Main-Class will be added automatically by build
>> -> exports 5
>> [5] exports:
>> ------------
>> mis.service; version=0.0.0
>> -> imports 5
>> [5] imports:
>> ------------
>> org.osgi.framework; version=1.4.0 -> org.apache.felix.framework [0]
>> org.jdesktop.application; version=0.0.0 -> org.apache.felix.framework [0]
>> ->
>>
>>     
>
> OK, so you now have your client bundle wired to the system bundle for
> "org.jdesktop.application"
> - presumably you've put the JDesktop jars on the same classpath that you use
> to launch Felix?
>
> such as:
>
>    java -classpath bin/felix.jar:<jdesktop-jars> org.apache.felix.main.Main
>
> the jars need to be on the launching classpath so the Felix system bundle
> can delegate to them
>
>   
I tried launch it with command:

java -classpath bin/felix.jar:../MIS/dist/lib/appframework-1.0.3.jar
org.apache.felix.main.Main

and .....

I think its better:

matej@Rompilio:~/NetBeansProjects/Felix$ java -classpath
bin/felix.jar:../MIS/dist/lib/appframework-1.0.3.jar
org.apache.felix.main.Main

Welcome to Felix.
=================

org.osgi.framework.BundleException: R3 imports cannot contain directives.
    at
org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
    at
org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
    at
org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
    at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
    at org.apache.felix.framework.Felix.init(Felix.java:581)
    at org.apache.felix.framework.Felix.start(Felix.java:672)
    at org.apache.felix.main.Main.main(Main.java:213)
org.osgi.framework.BundleException: R3 imports cannot contain directives.
    at
org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
    at
org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
    at
org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
    at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
    at org.apache.felix.framework.Felix.init(Felix.java:581)
    at org.apache.felix.framework.Felix.start(Felix.java:672)
    at org.apache.felix.main.Main.main(Main.java:213)
ERROR: Unable to re-install
file:/home/matej/NetBeansProjects/MIS/dist/MIS.jar
(org.osgi.framework.BundleException: R3 imports cannot contain directives.)
org.osgi.framework.BundleException: R3 imports cannot contain directives.
    at
org.apache.felix.framework.util.manifestparser.ManifestParser.checkAndNormalizeR3(ManifestParser.java:613)
    at
org.apache.felix.framework.util.manifestparser.ManifestParser.<init>(ManifestParser.java:259)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(ModuleImpl.java:155)
    at
org.apache.felix.framework.BundleImpl.createModule(BundleImpl.java:970)
    at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:79)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2123)
    at org.apache.felix.framework.Felix.init(Felix.java:581)
    at org.apache.felix.framework.Felix.start(Felix.java:672)
    at org.apache.felix.main.Main.main(Main.java:213)
->
->
->
-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (1.8.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
[   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
[   5] [Active     ] [    1] MIM module (0.0.7)
-> services 5

MIM module (5) provides:
------------------------
Language = English
objectClass = mis.service.MimService
service.id = 26
->

Although there is some Errors, it seems to my service is running.


I can run my jar file with command  "java -jar MIS.jar" successfuly.
I expected that felix.jar doesn't change my enviroment settings
(classpath). So, do I have to set all my env. (classpath) settings to
java command? I expected that Felix appends their own settings, but not
overwrite.

Thanks a lot for  yours help.
Can you please help me with actual error?
(org.osgi.framework.BundleException: R3 imports cannot contain directives.)

Matej
>   
>> Any another ideas?
>>
>> Matej
>>
>>     
>>> And my Java file is:
>>>
>>>       
>>>> <filecontent>
>>>> /*
>>>>  * MISApp.java
>>>>  */
>>>>
>>>> package mis;
>>>>
>>>> import org.jdesktop.application.Application;
>>>> import org.jdesktop.application.SingleFrameApplication;
>>>> import org.osgi.framework.BundleActivator;
>>>> import org.osgi.framework.BundleContext;
>>>> import org.osgi.framework.ServiceListener;
>>>> import org.osgi.framework.ServiceEvent;
>>>> import java.util.Properties;
>>>> import mis.service.MimService;
>>>>
>>>>
>>>>
>>>> /**
>>>>  * The main class of the application.
>>>>  */
>>>> public class MISApp extends SingleFrameApplication implements
>>>> BundleActivator {
>>>>
>>>>    public void start(BundleContext context)
>>>>    {
>>>>        Properties props = new Properties();
>>>>        props.put("Language", "English");
>>>>        context.registerService(
>>>>            MimService.class.getName(), new MimServiceImpl(), props);
>>>>    }
>>>>
>>>>
>>>>    public void stop(BundleContext context)
>>>>    {
>>>>        context=null;
>>>>        // NOTE: The service is automatically unregistered.
>>>>    }
>>>>
>>>>
>>>>    private static class MimServiceImpl implements MimService
>>>>    {
>>>>        // The set of words contained in the dictionary.
>>>>        String[] m_dictionary =
>>>>            { "welcome", "to", "the", "osgi", "tutorial" };
>>>>
>>>>        /**
>>>>         * Implements DictionaryService.checkWord(). Determines
>>>>         * if the passed in word is contained in the dictionary.
>>>>         * @param word the word to be checked.
>>>>         * @return true if the word is in the dictionary,
>>>>         *         false otherwise.
>>>>        **/
>>>>        public void setMenuItem(String word)
>>>>        {
>>>>            word = word.toLowerCase();
>>>>
>>>>            System.out.println("Prislo taketo slovo:" + word);
>>>>           /* // This is very inefficient
>>>>            for (int i = 0; i < m_dictionary.length; i++)
>>>>            {
>>>>                if (m_dictionary[i].equals(word))
>>>>                {
>>>>                    return true;
>>>>                }
>>>>            }
>>>>            return false;
>>>>            */
>>>>        }
>>>>    }
>>>>
>>>>
>>>>
>>>>    /**
>>>>     * At startup create and show the main frame of the application.
>>>>     */
>>>>    @Override protected void startup() {
>>>>        show(new MISView(this));
>>>>    }
>>>>
>>>>    /**
>>>>     * This method is to initialize the specified window by injecting
>>>> resources.
>>>>     * Windows shown in our application come fully initialized from the
>>>>         
>> GUI
>>     
>>>>     * builder, so this additional configuration is not needed.
>>>>     */
>>>>    @Override protected void configureWindow(java.awt.Window root) {
>>>>    }
>>>>
>>>>    /**
>>>>     * A convenient static getter for the application instance.
>>>>     * @return the instance of MISApp
>>>>     */
>>>>    public static MISApp getApplication() {
>>>>        return Application.getInstance(MISApp.class);
>>>>    }
>>>>
>>>>    /**
>>>>     * Main method launching the application.
>>>>     */
>>>>    public static void main(String[] args) {
>>>>        launch(MISApp.class, args);
>>>>    }
>>>> }
>>>>
>>>> </filecontent>
>>>>
>>>>
>>>> When I want to run my application with command
>>>> java -jar MIS.jar
>>>> it works fine.
>>>>
>>>> But when I try to run it in Felix prompt it doesn't run.
>>>>
>>>> I tried to search in mail-archive, but it didn't help.
>>>>
>>>> Thanks for all suggestions.
>>>>
>>>> Matej
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>
>>>>         
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/5/21 Matej Pončák <ma...@r-sys.sk>

>
> > 2009/5/21 Matej Pončák <ma...@r-sys.sk>
> >
> >
> >> Hi.
> >>
> >> I try to use Felix OSGi with GUI.
> >> I have a problem with:
> >> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
> >> package; (&(package=org.jdesktop.application)(version>=0.0.0))
> >>
> >> My bundle is number 5.
> >>
> >> -> ps
> >> START LEVEL 1
> >>   ID   State         Level  Name
> >> [   0] [Active     ] [    0] System Bundle (1.8.0)
> >> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
> >> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
> >> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
> >> [   5] [Installed  ] [    1] MIM module (0.0.7)
> >> -> update 5
> >> -> start 5
> >> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
> >> package; (&(package=org.jdesktop.application)(version>=0.0.0))
> >> -> exports 5
> >> [5] exports:
> >> ------------
> >> Nothing
> >> -> imports 5
> >> [5] imports:
> >> ------------
> >> Nothing
> >> -> headers 5
> >>
> >> MIM module (5)
> >> --------------
> >> Main-Class = mis.MISApp
> >> Bundle-Activator = mis.MISApp
> >> Bundle-Description = My description
> >> Export-Package = mis.service
> >> Bundle-Version = 0.0.7
> >> Created-By = 10.0-b23 (Sun Microsystems Inc.)
> >> Manifest-Version = 1.0
> >> Bundle-Vendor = test
> >> Bundle-Name = MIM module
> >> Ant-Version = Apache Ant 1.7.0
> >> Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
> >> lib/felix.jar
> >> Import-Package = org.osgi.framework,org.jdesktop.application
> >> X-COMMENT = Main-Class will be added automatically by build
> >> ->
> >>
> >>
> >> I seted this option in my config:
> >> # To append packages to the default set of exported system packages,
> >> # set this value.
> >> org.osgi.framework.system.packages.extra=org.jdesktop.application.*
> >>
> >>
> >
> > can you try this instead:
> >
> >
> >
> org.osgi.framework.system.packages.extra=org.jdesktop.application,org.jdesktop.application.*
> >
> > because according to the OSGi spec, a package wildcard of:
> >
> >    org.foo.*
> >
> > will only match against sub-packages of org.foo and _not_ org.foo itself
> >
> > just for reference, in case you think the solution to this would be to
> use:
> >
> >    org.foo*
> >
> > this isn't a valid package wildcard as the "*" has to be on it's own or
> > after a "."
> >
> > ( if you think this is all confusing I agree, but that's the spec'd
> > behaviour... )
> >
> I tried change
> org.osgi.framework.system.packages.extra=org.jdesktop.application.*
>
> to
>
>
> org.osgi.framework.system.packages.extra=org.jdesktop.application,org.jdesktop.application.*
>
>
>
> Here is my output:
>
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.8.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
> [   5] [Resolved   ] [    1] MIM module (0.0.7)
> -> update 5
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.8.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
> [   5] [Installed  ] [    1] MIM module (0.0.7)
> -> start 5
> org.osgi.framework.BundleException: Activator start error in bundle [5].
>    at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
>    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
>    at
>
> org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:105)
>    at
>
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:291)
>    at
>
> org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:177)
>    at java.lang.Thread.run(Thread.java:636)
> Caused by: java.lang.NoClassDefFoundError:
> org/jdesktop/application/SingleFrameApplication
>    at java.lang.ClassLoader.defineClass1(Native Method)
>    at java.lang.ClassLoader.defineClass(ClassLoader.java:637)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1556)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:562)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:481)
>    at
> org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3344)
>    at org.apache.felix.framework.Felix.startBundle(Felix.java:1453)
>    ... 5 more
> Caused by: java.lang.ClassNotFoundException:
> org.jdesktop.application.SingleFrameApplication
>    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>    at java.security.AccessController.doPrivileged(Native Method)
>    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
>    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>    at
>
> org.apache.felix.framework.ExtensionManager$ExtensionManagerModule.getClassByDelegation(ExtensionManager.java:653)
>    at
> org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports(ModuleImpl.java:1184)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:557)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
>    at
>
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
>    ... 15 more
> java.lang.NoClassDefFoundError:
> org/jdesktop/application/SingleFrameApplication
> -> headers 5
>
> MIM module (5)
> --------------
> Main-Class = mis.MISApp
> Bundle-Activator = mis.MISApp
> Bundle-Description = My description
> Export-Package = mis.service
> Bundle-Version = 0.0.7
> Created-By = 10.0-b23 (Sun Microsystems Inc.)
> Manifest-Version = 1.0
> Bundle-Vendor = test
> Bundle-Name = MIM module
> Ant-Version = Apache Ant 1.7.0
> Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
> lib/felix.jar
> Import-Package = org.osgi.framework,org.jdesktop.application
> X-COMMENT = Main-Class will be added automatically by build
> -> exports 5
> [5] exports:
> ------------
> mis.service; version=0.0.0
> -> imports 5
> [5] imports:
> ------------
> org.osgi.framework; version=1.4.0 -> org.apache.felix.framework [0]
> org.jdesktop.application; version=0.0.0 -> org.apache.felix.framework [0]
> ->
>

OK, so you now have your client bundle wired to the system bundle for
"org.jdesktop.application"
- presumably you've put the JDesktop jars on the same classpath that you use
to launch Felix?

such as:

   java -classpath bin/felix.jar:<jdesktop-jars> org.apache.felix.main.Main

the jars need to be on the launching classpath so the Felix system bundle
can delegate to them


> Any another ideas?
>
> Matej
>
> > And my Java file is:
> >
> >> <filecontent>
> >> /*
> >>  * MISApp.java
> >>  */
> >>
> >> package mis;
> >>
> >> import org.jdesktop.application.Application;
> >> import org.jdesktop.application.SingleFrameApplication;
> >> import org.osgi.framework.BundleActivator;
> >> import org.osgi.framework.BundleContext;
> >> import org.osgi.framework.ServiceListener;
> >> import org.osgi.framework.ServiceEvent;
> >> import java.util.Properties;
> >> import mis.service.MimService;
> >>
> >>
> >>
> >> /**
> >>  * The main class of the application.
> >>  */
> >> public class MISApp extends SingleFrameApplication implements
> >> BundleActivator {
> >>
> >>    public void start(BundleContext context)
> >>    {
> >>        Properties props = new Properties();
> >>        props.put("Language", "English");
> >>        context.registerService(
> >>            MimService.class.getName(), new MimServiceImpl(), props);
> >>    }
> >>
> >>
> >>    public void stop(BundleContext context)
> >>    {
> >>        context=null;
> >>        // NOTE: The service is automatically unregistered.
> >>    }
> >>
> >>
> >>    private static class MimServiceImpl implements MimService
> >>    {
> >>        // The set of words contained in the dictionary.
> >>        String[] m_dictionary =
> >>            { "welcome", "to", "the", "osgi", "tutorial" };
> >>
> >>        /**
> >>         * Implements DictionaryService.checkWord(). Determines
> >>         * if the passed in word is contained in the dictionary.
> >>         * @param word the word to be checked.
> >>         * @return true if the word is in the dictionary,
> >>         *         false otherwise.
> >>        **/
> >>        public void setMenuItem(String word)
> >>        {
> >>            word = word.toLowerCase();
> >>
> >>            System.out.println("Prislo taketo slovo:" + word);
> >>           /* // This is very inefficient
> >>            for (int i = 0; i < m_dictionary.length; i++)
> >>            {
> >>                if (m_dictionary[i].equals(word))
> >>                {
> >>                    return true;
> >>                }
> >>            }
> >>            return false;
> >>            */
> >>        }
> >>    }
> >>
> >>
> >>
> >>    /**
> >>     * At startup create and show the main frame of the application.
> >>     */
> >>    @Override protected void startup() {
> >>        show(new MISView(this));
> >>    }
> >>
> >>    /**
> >>     * This method is to initialize the specified window by injecting
> >> resources.
> >>     * Windows shown in our application come fully initialized from the
> GUI
> >>     * builder, so this additional configuration is not needed.
> >>     */
> >>    @Override protected void configureWindow(java.awt.Window root) {
> >>    }
> >>
> >>    /**
> >>     * A convenient static getter for the application instance.
> >>     * @return the instance of MISApp
> >>     */
> >>    public static MISApp getApplication() {
> >>        return Application.getInstance(MISApp.class);
> >>    }
> >>
> >>    /**
> >>     * Main method launching the application.
> >>     */
> >>    public static void main(String[] args) {
> >>        launch(MISApp.class, args);
> >>    }
> >> }
> >>
> >> </filecontent>
> >>
> >>
> >> When I want to run my application with command
> >> java -jar MIS.jar
> >> it works fine.
> >>
> >> But when I try to run it in Felix prompt it doesn't run.
> >>
> >> I tried to search in mail-archive, but it didn't help.
> >>
> >> Thanks for all suggestions.
> >>
> >> Matej
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
> >>
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

-- 
Cheers, Stuart

Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by Matej Pončák <ma...@r-sys.sk>.
> 2009/5/21 Matej Pončák <ma...@r-sys.sk>
>
>   
>> Hi.
>>
>> I try to use Felix OSGi with GUI.
>> I have a problem with:
>> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
>> package; (&(package=org.jdesktop.application)(version>=0.0.0))
>>
>> My bundle is number 5.
>>
>> -> ps
>> START LEVEL 1
>>   ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.8.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
>> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
>> [   5] [Installed  ] [    1] MIM module (0.0.7)
>> -> update 5
>> -> start 5
>> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
>> package; (&(package=org.jdesktop.application)(version>=0.0.0))
>> -> exports 5
>> [5] exports:
>> ------------
>> Nothing
>> -> imports 5
>> [5] imports:
>> ------------
>> Nothing
>> -> headers 5
>>
>> MIM module (5)
>> --------------
>> Main-Class = mis.MISApp
>> Bundle-Activator = mis.MISApp
>> Bundle-Description = My description
>> Export-Package = mis.service
>> Bundle-Version = 0.0.7
>> Created-By = 10.0-b23 (Sun Microsystems Inc.)
>> Manifest-Version = 1.0
>> Bundle-Vendor = test
>> Bundle-Name = MIM module
>> Ant-Version = Apache Ant 1.7.0
>> Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
>> lib/felix.jar
>> Import-Package = org.osgi.framework,org.jdesktop.application
>> X-COMMENT = Main-Class will be added automatically by build
>> ->
>>
>>
>> I seted this option in my config:
>> # To append packages to the default set of exported system packages,
>> # set this value.
>> org.osgi.framework.system.packages.extra=org.jdesktop.application.*
>>
>>     
>
> can you try this instead:
>
>
> org.osgi.framework.system.packages.extra=org.jdesktop.application,org.jdesktop.application.*
>
> because according to the OSGi spec, a package wildcard of:
>
>    org.foo.*
>
> will only match against sub-packages of org.foo and _not_ org.foo itself
>
> just for reference, in case you think the solution to this would be to use:
>
>    org.foo*
>
> this isn't a valid package wildcard as the "*" has to be on it's own or
> after a "."
>
> ( if you think this is all confusing I agree, but that's the spec'd
> behaviour... )
>   
I tried change
org.osgi.framework.system.packages.extra=org.jdesktop.application.*

to

org.osgi.framework.system.packages.extra=org.jdesktop.application,org.jdesktop.application.*



Here is my output:

-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (1.8.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
[   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
[   5] [Resolved   ] [    1] MIM module (0.0.7)
-> update 5
-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (1.8.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
[   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
[   5] [Installed  ] [    1] MIM module (0.0.7)
-> start 5
org.osgi.framework.BundleException: Activator start error in bundle [5].
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
    at
org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:105)
    at
org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:291)
    at
org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:177)
    at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.NoClassDefFoundError:
org/jdesktop/application/SingleFrameApplication
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:637)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1556)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:562)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:481)
    at
org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3344)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1453)
    ... 5 more
Caused by: java.lang.ClassNotFoundException:
org.jdesktop.application.SingleFrameApplication
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    at
org.apache.felix.framework.ExtensionManager$ExtensionManagerModule.getClassByDelegation(ExtensionManager.java:653)
    at
org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports(ModuleImpl.java:1184)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:557)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
    ... 15 more
java.lang.NoClassDefFoundError:
org/jdesktop/application/SingleFrameApplication
-> headers 5

MIM module (5)
--------------
Main-Class = mis.MISApp
Bundle-Activator = mis.MISApp
Bundle-Description = My description
Export-Package = mis.service
Bundle-Version = 0.0.7
Created-By = 10.0-b23 (Sun Microsystems Inc.)
Manifest-Version = 1.0
Bundle-Vendor = test
Bundle-Name = MIM module
Ant-Version = Apache Ant 1.7.0
Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
lib/felix.jar
Import-Package = org.osgi.framework,org.jdesktop.application
X-COMMENT = Main-Class will be added automatically by build
-> exports 5
[5] exports:
------------
mis.service; version=0.0.0
-> imports 5
[5] imports:
------------
org.osgi.framework; version=1.4.0 -> org.apache.felix.framework [0]
org.jdesktop.application; version=0.0.0 -> org.apache.felix.framework [0]
->


Any another ideas?

Matej

> And my Java file is:
>   
>> <filecontent>
>> /*
>>  * MISApp.java
>>  */
>>
>> package mis;
>>
>> import org.jdesktop.application.Application;
>> import org.jdesktop.application.SingleFrameApplication;
>> import org.osgi.framework.BundleActivator;
>> import org.osgi.framework.BundleContext;
>> import org.osgi.framework.ServiceListener;
>> import org.osgi.framework.ServiceEvent;
>> import java.util.Properties;
>> import mis.service.MimService;
>>
>>
>>
>> /**
>>  * The main class of the application.
>>  */
>> public class MISApp extends SingleFrameApplication implements
>> BundleActivator {
>>
>>    public void start(BundleContext context)
>>    {
>>        Properties props = new Properties();
>>        props.put("Language", "English");
>>        context.registerService(
>>            MimService.class.getName(), new MimServiceImpl(), props);
>>    }
>>
>>
>>    public void stop(BundleContext context)
>>    {
>>        context=null;
>>        // NOTE: The service is automatically unregistered.
>>    }
>>
>>
>>    private static class MimServiceImpl implements MimService
>>    {
>>        // The set of words contained in the dictionary.
>>        String[] m_dictionary =
>>            { "welcome", "to", "the", "osgi", "tutorial" };
>>
>>        /**
>>         * Implements DictionaryService.checkWord(). Determines
>>         * if the passed in word is contained in the dictionary.
>>         * @param word the word to be checked.
>>         * @return true if the word is in the dictionary,
>>         *         false otherwise.
>>        **/
>>        public void setMenuItem(String word)
>>        {
>>            word = word.toLowerCase();
>>
>>            System.out.println("Prislo taketo slovo:" + word);
>>           /* // This is very inefficient
>>            for (int i = 0; i < m_dictionary.length; i++)
>>            {
>>                if (m_dictionary[i].equals(word))
>>                {
>>                    return true;
>>                }
>>            }
>>            return false;
>>            */
>>        }
>>    }
>>
>>
>>
>>    /**
>>     * At startup create and show the main frame of the application.
>>     */
>>    @Override protected void startup() {
>>        show(new MISView(this));
>>    }
>>
>>    /**
>>     * This method is to initialize the specified window by injecting
>> resources.
>>     * Windows shown in our application come fully initialized from the GUI
>>     * builder, so this additional configuration is not needed.
>>     */
>>    @Override protected void configureWindow(java.awt.Window root) {
>>    }
>>
>>    /**
>>     * A convenient static getter for the application instance.
>>     * @return the instance of MISApp
>>     */
>>    public static MISApp getApplication() {
>>        return Application.getInstance(MISApp.class);
>>    }
>>
>>    /**
>>     * Main method launching the application.
>>     */
>>    public static void main(String[] args) {
>>        launch(MISApp.class, args);
>>    }
>> }
>>
>> </filecontent>
>>
>>
>> When I want to run my application with command
>> java -jar MIS.jar
>> it works fine.
>>
>> But when I try to run it in Felix prompt it doesn't run.
>>
>> I tried to search in mail-archive, but it didn't help.
>>
>> Thanks for all suggestions.
>>
>> Matej
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>     
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/5/21 Richard S. Hall <he...@ungoverned.org>

> Wild cards do not work at all for system packages, only for boot
> delegation. You have to explicitly list each system package. The original
> line didn't match because the system bundle was exporting
> "org.jdesktop.application.*", which obviously no one was importing.
>

quite right, my mind must have been elsewhere :) ... system packages can't
use package
wildcards because they're determined upfront, unlike bootdelegation or
dynamic imports
which come into play at request time


> -> richard


-- 
Cheers, Stuart

Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 5/21/09 6:37 AM, Stuart McCulloch wrote:
> 2009/5/21 Matej Pončák<ma...@r-sys.sk>
>
>    
>> Hi.
>>
>> I try to use Felix OSGi with GUI.
>> I have a problem with:
>> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
>> package; (&(package=org.jdesktop.application)(version>=0.0.0))
>>
>> My bundle is number 5.
>>
>> ->  ps
>> START LEVEL 1
>>    ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.8.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
>> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
>> [   5] [Installed  ] [    1] MIM module (0.0.7)
>> ->  update 5
>> ->  start 5
>> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
>> package; (&(package=org.jdesktop.application)(version>=0.0.0))
>> ->  exports 5
>> [5] exports:
>> ------------
>> Nothing
>> ->  imports 5
>> [5] imports:
>> ------------
>> Nothing
>> ->  headers 5
>>
>> MIM module (5)
>> --------------
>> Main-Class = mis.MISApp
>> Bundle-Activator = mis.MISApp
>> Bundle-Description = My description
>> Export-Package = mis.service
>> Bundle-Version = 0.0.7
>> Created-By = 10.0-b23 (Sun Microsystems Inc.)
>> Manifest-Version = 1.0
>> Bundle-Vendor = test
>> Bundle-Name = MIM module
>> Ant-Version = Apache Ant 1.7.0
>> Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
>> lib/felix.jar
>> Import-Package = org.osgi.framework,org.jdesktop.application
>> X-COMMENT = Main-Class will be added automatically by build
>> ->
>>
>>
>> I seted this option in my config:
>> # To append packages to the default set of exported system packages,
>> # set this value.
>> org.osgi.framework.system.packages.extra=org.jdesktop.application.*
>>
>>      
>
> can you try this instead:
>
>
> org.osgi.framework.system.packages.extra=org.jdesktop.application,org.jdesktop.application.*
>    

Wild cards do not work at all for system packages, only for boot 
delegation. You have to explicitly list each system package. The 
original line didn't match because the system bundle was exporting 
"org.jdesktop.application.*", which obviously no one was importing.

-> richard

> because according to the OSGi spec, a package wildcard of:
>
>     org.foo.*
>
> will only match against sub-packages of org.foo and _not_ org.foo itself
>
> just for reference, in case you think the solution to this would be to use:
>
>     org.foo*
>
> this isn't a valid package wildcard as the "*" has to be on it's own or
> after a "."
>
> ( if you think this is all confusing I agree, but that's the spec'd
> behaviour... )
>
> And my Java file is:
>    
>> <filecontent>
>> /*
>>   * MISApp.java
>>   */
>>
>> package mis;
>>
>> import org.jdesktop.application.Application;
>> import org.jdesktop.application.SingleFrameApplication;
>> import org.osgi.framework.BundleActivator;
>> import org.osgi.framework.BundleContext;
>> import org.osgi.framework.ServiceListener;
>> import org.osgi.framework.ServiceEvent;
>> import java.util.Properties;
>> import mis.service.MimService;
>>
>>
>>
>> /**
>>   * The main class of the application.
>>   */
>> public class MISApp extends SingleFrameApplication implements
>> BundleActivator {
>>
>>     public void start(BundleContext context)
>>     {
>>         Properties props = new Properties();
>>         props.put("Language", "English");
>>         context.registerService(
>>             MimService.class.getName(), new MimServiceImpl(), props);
>>     }
>>
>>
>>     public void stop(BundleContext context)
>>     {
>>         context=null;
>>         // NOTE: The service is automatically unregistered.
>>     }
>>
>>
>>     private static class MimServiceImpl implements MimService
>>     {
>>         // The set of words contained in the dictionary.
>>         String[] m_dictionary =
>>             { "welcome", "to", "the", "osgi", "tutorial" };
>>
>>         /**
>>          * Implements DictionaryService.checkWord(). Determines
>>          * if the passed in word is contained in the dictionary.
>>          * @param word the word to be checked.
>>          * @return true if the word is in the dictionary,
>>          *         false otherwise.
>>         **/
>>         public void setMenuItem(String word)
>>         {
>>             word = word.toLowerCase();
>>
>>             System.out.println("Prislo taketo slovo:" + word);
>>            /* // This is very inefficient
>>             for (int i = 0; i<  m_dictionary.length; i++)
>>             {
>>                 if (m_dictionary[i].equals(word))
>>                 {
>>                     return true;
>>                 }
>>             }
>>             return false;
>>             */
>>         }
>>     }
>>
>>
>>
>>     /**
>>      * At startup create and show the main frame of the application.
>>      */
>>     @Override protected void startup() {
>>         show(new MISView(this));
>>     }
>>
>>     /**
>>      * This method is to initialize the specified window by injecting
>> resources.
>>      * Windows shown in our application come fully initialized from the GUI
>>      * builder, so this additional configuration is not needed.
>>      */
>>     @Override protected void configureWindow(java.awt.Window root) {
>>     }
>>
>>     /**
>>      * A convenient static getter for the application instance.
>>      * @return the instance of MISApp
>>      */
>>     public static MISApp getApplication() {
>>         return Application.getInstance(MISApp.class);
>>     }
>>
>>     /**
>>      * Main method launching the application.
>>      */
>>     public static void main(String[] args) {
>>         launch(MISApp.class, args);
>>     }
>> }
>>
>> </filecontent>
>>
>>
>> When I want to run my application with command
>> java -jar MIS.jar
>> it works fine.
>>
>> But when I try to run it in Felix prompt it doesn't run.
>>
>> I tried to search in mail-archive, but it didn't help.
>>
>> Thanks for all suggestions.
>>
>> Matej
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>      
>
>
>    

Re: org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.jdesktop.application)(version>=0.0.0))

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/5/21 Matej Pončák <ma...@r-sys.sk>

> Hi.
>
> I try to use Felix OSGi with GUI.
> I have a problem with:
> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
> package; (&(package=org.jdesktop.application)(version>=0.0.0))
>
> My bundle is number 5.
>
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.8.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
> [   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
> [   5] [Installed  ] [    1] MIM module (0.0.7)
> -> update 5
> -> start 5
> org.osgi.framework.BundleException: Unresolved constraint in bundle 5:
> package; (&(package=org.jdesktop.application)(version>=0.0.0))
> -> exports 5
> [5] exports:
> ------------
> Nothing
> -> imports 5
> [5] imports:
> ------------
> Nothing
> -> headers 5
>
> MIM module (5)
> --------------
> Main-Class = mis.MISApp
> Bundle-Activator = mis.MISApp
> Bundle-Description = My description
> Export-Package = mis.service
> Bundle-Version = 0.0.7
> Created-By = 10.0-b23 (Sun Microsystems Inc.)
> Manifest-Version = 1.0
> Bundle-Vendor = test
> Bundle-Name = MIM module
> Ant-Version = Apache Ant 1.7.0
> Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
> lib/felix.jar
> Import-Package = org.osgi.framework,org.jdesktop.application
> X-COMMENT = Main-Class will be added automatically by build
> ->
>
>
> I seted this option in my config:
> # To append packages to the default set of exported system packages,
> # set this value.
> org.osgi.framework.system.packages.extra=org.jdesktop.application.*
>

can you try this instead:


org.osgi.framework.system.packages.extra=org.jdesktop.application,org.jdesktop.application.*

because according to the OSGi spec, a package wildcard of:

   org.foo.*

will only match against sub-packages of org.foo and _not_ org.foo itself

just for reference, in case you think the solution to this would be to use:

   org.foo*

this isn't a valid package wildcard as the "*" has to be on it's own or
after a "."

( if you think this is all confusing I agree, but that's the spec'd
behaviour... )

And my Java file is:
> <filecontent>
> /*
>  * MISApp.java
>  */
>
> package mis;
>
> import org.jdesktop.application.Application;
> import org.jdesktop.application.SingleFrameApplication;
> import org.osgi.framework.BundleActivator;
> import org.osgi.framework.BundleContext;
> import org.osgi.framework.ServiceListener;
> import org.osgi.framework.ServiceEvent;
> import java.util.Properties;
> import mis.service.MimService;
>
>
>
> /**
>  * The main class of the application.
>  */
> public class MISApp extends SingleFrameApplication implements
> BundleActivator {
>
>    public void start(BundleContext context)
>    {
>        Properties props = new Properties();
>        props.put("Language", "English");
>        context.registerService(
>            MimService.class.getName(), new MimServiceImpl(), props);
>    }
>
>
>    public void stop(BundleContext context)
>    {
>        context=null;
>        // NOTE: The service is automatically unregistered.
>    }
>
>
>    private static class MimServiceImpl implements MimService
>    {
>        // The set of words contained in the dictionary.
>        String[] m_dictionary =
>            { "welcome", "to", "the", "osgi", "tutorial" };
>
>        /**
>         * Implements DictionaryService.checkWord(). Determines
>         * if the passed in word is contained in the dictionary.
>         * @param word the word to be checked.
>         * @return true if the word is in the dictionary,
>         *         false otherwise.
>        **/
>        public void setMenuItem(String word)
>        {
>            word = word.toLowerCase();
>
>            System.out.println("Prislo taketo slovo:" + word);
>           /* // This is very inefficient
>            for (int i = 0; i < m_dictionary.length; i++)
>            {
>                if (m_dictionary[i].equals(word))
>                {
>                    return true;
>                }
>            }
>            return false;
>            */
>        }
>    }
>
>
>
>    /**
>     * At startup create and show the main frame of the application.
>     */
>    @Override protected void startup() {
>        show(new MISView(this));
>    }
>
>    /**
>     * This method is to initialize the specified window by injecting
> resources.
>     * Windows shown in our application come fully initialized from the GUI
>     * builder, so this additional configuration is not needed.
>     */
>    @Override protected void configureWindow(java.awt.Window root) {
>    }
>
>    /**
>     * A convenient static getter for the application instance.
>     * @return the instance of MISApp
>     */
>    public static MISApp getApplication() {
>        return Application.getInstance(MISApp.class);
>    }
>
>    /**
>     * Main method launching the application.
>     */
>    public static void main(String[] args) {
>        launch(MISApp.class, args);
>    }
> }
>
> </filecontent>
>
>
> When I want to run my application with command
> java -jar MIS.jar
> it works fine.
>
> But when I try to run it in Felix prompt it doesn't run.
>
> I tried to search in mail-archive, but it didn't help.
>
> Thanks for all suggestions.
>
> Matej
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart