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:

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





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to