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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to