2 Replies Latest reply on Apr 13, 2015 6:28 AM by Pasha Turok

    Running weld osgi example with felix on java se

    Pasha Turok Newbie

      I want to do the following solution:Apache Felix + Weld for Java SE. For that I want to run one of examples from weld archive - weld-osgi-paint.

       

      I have passed a lot of problems which was described here - java - Apache felix and org.osgi for weld cdi - constraint violation - Stack Overflow

       

      The last problem that I can't solve is the following exception:

       

      org.osgi.framework.BundleException: Unresolved constraint in bundle org.jboss.weld.examples.weld-osgi-paint-core [23]: Unable to resolve 23.0: missing requirement [23.0] osgi.extender; (osgi.extender=pax.cdi) at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826) at org.apache.felix.framework.Felix.startBundle(Felix.java:1868) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:931)

       

      Please help me to solve this problem. About few years ago I tried to impelement this solution but failed.

        • 1. Re: Running weld osgi example with felix on java se
          Pasha Turok Newbie

          The problem was in absence of pax.cdi.extender - I added it and dependency problem was solved. However, I cant run provided example. I use felix 4.6.1 and WELD 2.2.10.SP1 and I have the following bundles which I install and start:

           

          cdi-api.jar

          javax.annotation-api-1.2.jar

          javax.el-api-2.2.4.jar

          javax.interceptor-api-1.2.jar

          log4j-1.2.17.jar

          ops4j-base-lang-1.5.0.jar

          org.apache.felix.scr-1.8.2.jar

          org.apache.servicemix.bundles.javax-inject-1_2.jar

          org.osgi.compendium-4.3.1.jar

          pax-cdi-api-0.8.0.jar

          pax-cdi-extender-0.8.0.jar

          pax-cdi-extension-0.8.0.jar

          pax-cdi-spi-0.8.0.jar

          pax-swissbox-core-1.8.0.jar

          pax-swissbox-lifecycle-1.8.0.jar

          pax-swissbox-tracker-1.8.0.jar

          slf4j-api-1.7.6.jar

          slf4j-log4j12-1.7.2.jar

          weld-osgi-paint-api.jar

          weld-osgi-paint-core.jar

          weld-osgi-paint-square.jar

          weld-osgi-paint-triangle.jar

          weld-se-core.jar

          weld-se.jar

          xbean-bundleutils-3.18.jar

           

          Besides I have the following extra packages

          String SYSTEM_PACKAGES =

                  "org.osgi.framework;version=\"1.8\"," +

                  "org.osgi.service.packageadmin;version=\"1.8\","+

                  "org.osgi.framework.wiring;version=\"1.8\","+

                  "javax.swing,javax.management,javax.naming,javax.xml.parsers,"+

                  "org.w3c.dom,org.xml.sax,org.xml.sax.helpers";

                  configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES, SYSTEM_PACKAGES);

           

          I run the program and this is what I get

          org.osgi.framework.BundleException: Fragment bundles can not be started.

              at org.apache.felix.framework.Felix.startBundle(Felix.java:1981)

              at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977)

              at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:964)

           

          And nothing more. Will anyone help me?

          • 2. Re: Running weld osgi example with felix on java se
            Pasha Turok Newbie

            Ok, I've removed bundles for "javax.." and now I install only the following bundles:

            xbean-bundleutils-3.18.jar

            pax-cdi-api-0.8.0.jar

            pax-cdi-extension-0.8.0.jar

            pax-cdi-spi-0.8.0.jar

            pax-cdi-extender-0.8.0.jar

            pax-swissbox-core-1.8.0.jar

            pax-swissbox-lifecycle-1.8.0.jar

            pax-swissbox-tracker-1.8.0.jar

            ops4j-base-lang-1.5.0.jar

            slf4j-api-1.7.6.jar

            slf4j-log4j12-1.7.2.jar

            log4j-1.2.17.jar

            weld-osgi-paint-api.jar

            weld-osgi-paint-core.jar

            weld-osgi-paint-triangle.jar

            weld-osgi-paint-square.jar

             

            I start only two bundles:

            org.apache.felix.scr-1.8.2.jar

            weld-osgi-paint-core.jar

             

            Besides weld-se.jar and weld-se-core.jar I added to lib path and I export "javax.*" packges from them this way:

            String SYSTEM_PACKAGES =

                    "org.osgi.framework;version=\"1.8\"," +

                    "org.osgi.util.tracker;version=\"1.8\","+

                    "org.osgi.service.packageadmin;version=\"1.8\","+

                    "org.osgi.framework.wiring;version=\"1.8\","+

                    "javax.swing,javax.management,javax.naming,javax.xml.parsers,"+

                    "javax.el,javax.enterprise.context;version=\"1.0\","+

                    "javax.enterprise.event;version=\"1.0\","+

                    "javax.enterprise.inject;version=\"1.0\","+

                    "javax.enterprise.util;version=\"1.0\","+

                    "javax.inject;version=\"1.0\","+

                    "javax.annotation;version=\"1.1\","+

                    "javax.enterprise.context.spi;version=\"1.0\","+

                    "javax.enterprise.inject.spi;version=\"1.0\","+

                    "org.w3c.dom,org.xml.sax,org.xml.sax.helpers";

                    configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES, SYSTEM_PACKAGES);

             

            I start the program and I don't get any errors and exceptions. I get nothing. Help me!!!!