8 Replies Latest reply on Mar 16, 2012 12:24 PM by take5

    Deployment problem to as7 osgi from STS 2.8.1

    take5

      Hi!

       

      I'm new in JBOSS, and osgi, so it will be easy! :-)

      My problem:

      I wrote my first osgi code in STS. It is the "Hello world". (Start plug-in project, from hello world template) I started the JBoss AS 7.1.1 from STS and use the "Mark as Deployable" from right-click menu.

      Then I have got this error:

       

      12:25:32,209 ERROR [org.jboss.as.osgi] (MSC service thread 1-2) JBAS011900: Cannot start bundle: jboss-as-helloword-osgi:1.0.0.qualifier: org.osgi.framework.BundleException: Cannot start bundle: jboss-as-helloword-osgi:1.0.0.qualifier

          at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:328) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

          at org.jboss.osgi.framework.internal.HostBundleState.startInternal(HostBundleState.java:223) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

          at org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:494) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

          at org.jboss.as.osgi.deployment.BundleStartTracker$1.processService(BundleStartTracker.java:144) [jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.osgi.deployment.BundleStartTracker$1.transition(BundleStartTracker.java:119) [jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl.invokeListener(ServiceControllerImpl.java:1416) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl.access$2700(ServiceControllerImpl.java:49) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$ListenerTask.run(ServiceControllerImpl.java:1954) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_27]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_27]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]

      Caused by: java.lang.ClassNotFoundException: jboss_as_helloword_osgi.OsgiActivator from [Module "deployment.jboss-as-helloword-osgi:1.0.0.qualifier" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:132) [jboss-modules.jar:1.1.1.GA]

          at org.jboss.osgi.framework.internal.HostBundleRevision.loadClass(HostBundleRevision.java:114) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

          at org.jboss.osgi.framework.internal.AbstractBundleState.loadClass(AbstractBundleState.java:415) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

          at org.jboss.osgi.framework.internal.HostBundleState.loadClass(HostBundleState.java:151) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

          at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:294) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

          ... 10 more

       

      Then I run the "Unmark as deployable". 

       

      After it I made an export from the prject (Deployable plug-ins and fragments). I opened the JBoss AS console and  on the Deployment page I add the exported package. Enabled it, and on OSGI Baundle pages I started it. And it "run" correctly.

       

      My question that, what is the problem the deployment from the STS.

       

      Thx!

      Feri

       

      Ps: Win7 environment, the AS run same machine.

        • 1. Re: Deployment problem to as7 osgi from STS 2.8.1
          thomas.diesler

          I'm not familiar with the SpringSource Tool Suite.

           

          However, your bundle needs to contain jboss_as_helloword_osgi.OsgiActivator.class. Does it?

          Note, underscore instead of dot in the package name seems fishy. Is this intentional?

          • 2. Re: Deployment problem to as7 osgi from STS 2.8.1
            take5

            Hi Thomas,

             

            Thank you yourt attantion. STS an Eclipse-powered development environment, so at this point Eclipse 3.7.1.

            Here is my code:

             

            package jboss_as_helloword_osgi;

             

            import org.osgi.framework.BundleActivator;

            import org.osgi.framework.BundleContext;

             

            public class OsgiActivator implements BundleActivator

            {

             

                @Override

                public void start(BundleContext context) throws Exception

                {

                    System.out.println("Hello AS7 World!!");

                }

               

                @Override

                public void stop(BundleContext context) throws Exception

                {

                    System.out.println("Goodbye AS7 World!!");

                }

             

            }

             

            And the MANIFEST.MF:

             

            Manifest-Version: 1.0

            Bundle-ManifestVersion: 2

            Bundle-Name: Jboss-as-helloword-osgi

            Bundle-SymbolicName: jboss-as-helloword-osgi;singleton:=true

            Bundle-Version: 1.0.0.qualifier

            Bundle-Activator: jboss_as_helloword_osgi.OsgiActivator

            Import-Package: org.osgi.framework;version="1.3.0"

            Bundle-RequiredExecutionEnvironment: JavaSE-1.6

             

            Do you have any other idea?

             

            Feri

            • 3. Re: Deployment problem to as7 osgi from STS 2.8.1
              thomas.diesler

              That looks ok. Could you post the relevant part of the server DEBUG log?

              Also, this class 'jboss_as_helloword_osgi.OsgiActivator.class' is in the jar, is it?

              • 4. Re: Deployment problem to as7 osgi from STS 2.8.1
                take5

                Hi Thomas,

                 

                Yes, it is in the jar. I attache the log file, I hope you will see anything.

                 

                Thx!

                Feri

                • 5. Re: Deployment problem to as7 osgi from STS 2.8.1
                  thomas.diesler

                  I just see this

                   

                  13:36:38,865 ERROR [org.jboss.as.osgi] (MSC service thread 1-6) JBAS011900: Cannot start bundle: jboss-as-helloword-osgi:1.0.0.qualifier: org.osgi.framework.BundleException: Cannot start bundle: jboss-as-helloword-osgi:1.0.0.qualifier

                      at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:328) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                      at org.jboss.osgi.framework.internal.HostBundleState.startInternal(HostBundleState.java:223) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                      at org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:494) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                      at org.jboss.as.osgi.deployment.BundleStartTracker$1.processService(BundleStartTracker.java:144) [jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.as.osgi.deployment.BundleStartTracker$1.transition(BundleStartTracker.java:119) [jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]

                      at org.jboss.msc.service.ServiceControllerImpl.invokeListener(ServiceControllerImpl.java:1416) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      at org.jboss.msc.service.ServiceControllerImpl.access$2700(ServiceControllerImpl.java:49) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      at org.jboss.msc.service.ServiceControllerImpl$ListenerTask.run(ServiceControllerImpl.java:1954) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_27]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_27]

                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]

                  Caused by: java.lang.ClassNotFoundException: jboss_as_helloword_osgi.OsgiActivator from [Module "deployment.jboss-as-helloword-osgi:1.0.0.qualifier" from Service Module Loader]

                      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:132) [jboss-modules.jar:1.1.1.GA]

                      at org.jboss.osgi.framework.internal.HostBundleRevision.loadClass(HostBundleRevision.java:114) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                      at org.jboss.osgi.framework.internal.AbstractBundleState.loadClass(AbstractBundleState.java:415) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                      at org.jboss.osgi.framework.internal.HostBundleState.loadClass(HostBundleState.java:151) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                      at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:294) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                      ... 10 more

                   

                  Could you attach the deployment too?

                  • 6. Re: Deployment problem to as7 osgi from STS 2.8.1
                    take5

                    I attache the file, what deployed.

                    • 7. Re: Deployment problem to as7 osgi from STS 2.8.1
                      thomas.diesler

                      This is not a valid bundle deployment

                       

                      [tdiesler@tdvaio Downloads]$ jar -tf jboss-as-helloword-osgi | sort
                      bin/
                      bin/jboss_as_helloword_osgi/
                      bin/jboss_as_helloword_osgi/OsgiActivator.class
                      build.properties
                      .classpath
                      META-INF/
                      META-INF/MANIFEST.MF
                      .project
                      .settings/
                      .settings/org.eclipse.jdt.core.prefs
                      .settings/org.eclipse.m2e.core.prefs
                      .settings/org.eclipse.pde.core.prefs
                      .settings/org.jboss.ide.eclipse.as.core.prefs
                      src/
                      src/jboss_as_helloword_osgi/
                      src/jboss_as_helloword_osgi/OsgiActivator.java
                      

                       

                      As you can see BundleActivator is in bin. This would correspond to

                       

                      Bundle-Activator: bin.jboss_as_helloword_osgi.OsgiActivator
                      

                       

                      which of course is silly.

                       

                      It looks like that this is the eclipse project structure but not the target deployment. The correct content would look simmilar to

                       

                      jboss_as_helloword_osgi/OsgiActivator.class
                      META-INF/MANIFEST.MF
                      
                      • 8. Re: Deployment problem to as7 osgi from STS 2.8.1
                        take5

                        Thank you Thomas, this is a problem. It is my mistake. I think that the tool is work correctly.

                        Thank you again!

                        Feri