Announcement Announcement Module
Collapse
No announcement yet.
Problem with Dashboard Tutorial: Creating a Spring-powered OSGi Bundle Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Dashboard Tutorial: Creating a Spring-powered OSGi Bundle

    I am new to Spring and OSGi, and decided to go through the tutorials from the STS Dashboard. I am getting stuck though at the step "Creating a Spring-powered OSGi Bundle". In "Exploring the console output" it reads:
    "You should see a series of INFO messages as the extender bundle automatically creates the module context for the Spring-powered sample bundle."
    This never happens however. When I run the bundle I just see an osgi prompt, no messages. I suspect the tutorial refers to a previous version of Eclipse (I am using 3.5.0 on Ubuntu Linux and also the installer version under Windows XP, but both produce the same problem), because in the first step: "Setting the target platform for Spring Dynamic Modules" it reads:
    "Click the link below to open the PDE preferences page and select "Spring Dynamic Modules for OSGi Service Platforms" from the target selection box at the bottom of the panel. Click the Load target button to load the bundles in the target platform definition, and then click OK to close the dialog."
    Both of my installations do not have such a page.
    There is a "Plug-in Development" header in the Eclipse Preferences Dialog, and below this header is an item called "Target Platform" which displays a single Entry in the "Target Definitions" List Box, titled "Running Platform". I created a new entry by pressing the "Add" button, then select "Template" from the "Initialize the target definition with" radio button group, and finally select "Spring Dynamic Modules for SGGi(tm) Service Platforms 1.1.2" and press "Next". At this point there is a Tab Page titled "Locations" and in the single List Box below there is a single entry with the following location:
    ${bundle_loc:org.springframework.ide.eclipse.osgi. targetdefinition}/release/target
    I pressed finish and activated the "Spring DM Release" Target Definition by checking the Check Box, but this didn't seem to fix the issue. So I am stuck!

    Any suggestions as to how to resolve this? It seems like a configuration issue, not a bug, but the Tutorial seems broken.

    Gert

  • #2
    same here

    For what it is worth, I'm having identical issues w/ the tutorial. Seems to be independent of eclipse (3.4 or 3.5) and OS (windows or rhel). I followed the same work-arounds that you did. You might check
    .metadata/.plugins/org.eclipse.pde.core/Spring Powered Bundle Sample
    for logs. There, I found a log w/ the stack dump:

    Code:
    !SESSION 2009-08-30 22:52:45.764 -----------------------------------------------
    eclipse.buildId=unknown
    java.version=1.5.0_18
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
    Command-line arguments:  -dev file:/root/workspace-sts-2.1.0.SR01/.metadata/.plugins/org.eclipse.pde.core/Spring Powered Bundle Sample/dev.properties -os linux -ws gtk -arch x86 -clean -console
    
    !ENTRY org.springframework.osgi.extender 4 0 2009-08-30 22:52:46.936
    !MESSAGE 
    !STACK 0
    org.osgi.framework.BundleException: The activator org.springframework.osgi.extender.internal.activator.ContextLoaderListener for bundle org.springframework.osgi.extender is invalid
    	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:146)
    	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:980)
    	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
    	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:355)
    	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1074)
    	at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:616)
    	at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:508)
    	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:299)
    	at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:489)
    	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:211)
    	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:321)
    Caused by: java.lang.StackOverflowError
    	at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:150)
    	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:289)
    	at org.slf4j.impl.JCLLoggerFactory.getLogger(JCLLoggerFactory.java:69)
    	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:209)
    ...
    I'm guessing that since the extender bundle is broken, we don't see the messages the tutorial tells us that we should see.

    At this point I quit with the conclusion that the tutorial is broken for this release of STS.

    Comment


    • #3
      Resolution

      Probably the problem appears with the SLF4J and commons plugins bundled with the Target Platform.

      I experienced the same issue as mentioned by you guys i.e. I could not see log statements.

      To avoid this, click on Run ==> Run Configurations ==> OSGI Framework. Select your Run time configuration i.e. Spring Powered Bundle Sample. Under the target platform, I selected all bundles and unchecked com.springsource.slf4j.api and com.springsource.slf4j.jcl.

      After doing this, I could see logs on the console. Posting a resolution here so that others don't spend hours on finding out root cause of the issue!

      Comment


      • #4
        Thanks max540 and sonkalp,

        Sonkalps suggestion indeed works. In fact you only need to disable one of the 2, either "com.springsource.slf4j.api" or "com.springsource.slf4j.jcl".

        The fact is however that the tutorial in the current STS packages is broken and need fixing. I think many people, like me, follow these kind of tutorials to quickly evaluate the technology, and if you come across hurdles like this, many people will regard the product as inmature.
        It is not only that the logging messags do not show, also the instructions about setting the target platform are wrong (or maybe obsolete)

        So I rewrote the the affected paragraphs:
        Setting the target platform for Spring Dynamics Modules

        Before creating the sample project for this tutorial, you need to ensure that the Eclipse Plug-in Development target platform is set to the "Spring DM Release" target.
        Click the link below to open the “Plug-in Development” page under the “Target Platform” category. You will see a listbox labeled “Target Definitions” with a single entry, “Running Platform” which is checkmarked and labeled “(Active)”. Click the “Add” button to the right to open the “Create New Target Definition” Wizard and click on the “Template” radio button. Select “Spring Dynamic Modules for OSGi (tm) Service Platforms 1.1.2” and press “Next” and finally “Finish” to accept the proposed name and location and close the wizard. A new entry "Spring DM Release" is displayed in the “Target Definitions” listbox. Click the checkbox to activate it.

        Launching your bundle in OSGi

        The Spring Powered Bundle project defines a launch configuration called "Spring Powered Bundle Sample". Open the run configurations dialog by clicking the link below and select this launch profile under the "OSGi Framework" category. Click “Select All” and de-select either “com.springsource.sl4j.api (1.5.6)” or “com.springsource.sl4j.jcl (1.5.6)”. Click on the Run button to launch the framework.
        I hereby grant and invite Springsource to use this updated text anyway they like including it in their next STS update if they wish.

        I will now continue my tutorial.

        Comment


        • #5
          I'm having other issues as well...Live Update samples don't work.

          In niether the OSGi tutorials or the Spring DM tutorials.

          No matter what I change, nothing happens.

          If anyone has a solution to that, I'd ;ove to see it, since that is a big selling point for this kind of dev

          Comment


          • #6
            Hi,

            I already post a thread without answer for the same problem here : http://forum.springsource.org/showthread.php?t=76021

            I tried to download STS 2.1.0 to resolved the problem and it's worse . There is about 880 modules that can be selected.

            Comment


            • #7
              Gert is right...please fix the tutorials

              I spend a fair amount of time and frustration fumbling around with problems with the SDM for OSGI tutorial before I finally found this support thread. I just want to echo Gert's sentiments that it is important that you SpringSource guys keep these tutorials up to date. The tutorials ARE THE mechanism for evaluating your platform, and problems with them may lead folks to abandon your tools in haste. I almost did.

              Blat

              Comment


              • #8
                Originally posted by Blatwurst View Post
                I just want to echo Gert's sentiments that it is important that you SpringSource guys keep these tutorials up to date. The tutorials ARE THE mechanism for evaluating your platform, and problems with them may lead folks to abandon your tools in haste. I almost did.

                Blat
                Couldn't agree more. I spent the last 4 hours in frustration with this problem, and if it hadn't been for this thread which helped me by removing the "...jcl" bundle I would already be evaluating Netbeans + Glassfish 3 instead. Actually, might do that anyway because I can't get live update to work as the tutorial explains.

                Again, the previous posters are so right when they say how important the tutorials are. SpringSource, I generally love your products, but I need to know how to use them.

                Geir

                Comment


                • #9
                  All,

                  you're absolutely right: the tutorials are important and shouldn't get outdated.

                  Somehow this post slipped through the cracks on my end. I just now noticed it.

                  The problems are fixed now and will make it into the next version of STS.

                  Sorry for everyone you experienced issues with this tutorial. Thanks to everyone you helped out.

                  Christian

                  Comment


                  • #10
                    Originally posted by Christian Dupuis View Post
                    The problems are fixed now and will make it into the next version of STS.

                    That is great news, thank you! I am very eager to try this out, but it doesn't look like you guys publish nightly/snapshot builds, right? When can I expect the next release which includes this fix?

                    Thanks!

                    Geir

                    Comment


                    • #11
                      The problem resurrected

                      Originally posted by Christian Dupuis View Post
                      The problems are fixed now and will make it into the next version of STS.
                      hum I don't think it has been done!

                      here is my console output for the latest release :
                      SpringSource Tool Suite
                      Version: 2.3.0.RELEASE
                      Build Id: 200912171331

                      Code:
                      osgi> 12 mars 2010 05:41:40 org.springframework.osgi.extender.internal.activator.ContextLoaderListener start
                      INFO: Starting [org.springframework.osgi.extender] bundle v.[1.1.2.B]
                      12 mars 2010 05:41:40 org.springframework.osgi.extender.internal.support.ExtenderConfiguration <init>
                      INFO: No custom extender configuration detected; using defaults...
                      12 mars 2010 05:41:40 org.springframework.scheduling.timer.TimerTaskExecutor afterPropertiesSet
                      INFO: Initializing Timer
                      12 mars 2010 05:41:40 org.springframework.osgi.extender.support.DefaultOsgiApplicationContextCreator createApplicationContext
                      INFO: Discovered configurations {osgibundle:/META-INF/spring/*.xml} in bundle [Spring Powered Bundle Sample (com.springsource.osgi.springdm.simple)]
                      12 mars 2010 05:41:40 org.springframework.context.support.AbstractApplicationContext prepareRefresh
                      INFO: Refreshing org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@667cbde6: display name [OsgiBundleXmlApplicationContext(bundle=com.springsource.osgi.springdm.simple, config=osgibundle:/META-INF/spring/*.xml)]; startup date [Fri Mar 12 05:41:40 CET 2010]; root of context hierarchy
                      12 mars 2010 05:41:40 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
                      INFO: Loading XML bean definitions from URL [bundleentry://3/META-INF/spring/module-context.xml]
                      12 mars 2010 05:41:40 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
                      INFO: Bean factory for application context [org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@667cbde6]: org.springframework.beans.factory.support.DefaultListableBeanFactory@70e434d
                      12 mars 2010 05:41:40 org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor stageOne
                      INFO: No outstanding OSGi service dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=com.springsource.osgi.springdm.simple, config=osgibundle:/META-INF/spring/*.xml)
                      12 mars 2010 05:41:40 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
                      INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@70e434d: defining beans [echoService]; root of factory hierarchy
                      12 mars 2010 05:41:40 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
                      INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@70e434d: defining beans [echoService]; root of factory hierarchy
                      12 mars 2010 05:41:40 org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext completeRefresh
                      GRAVE: Post refresh error
                      org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.springsource.osgi.springdm.simple.internal.DefaultEchoService] for bean with name 'echoService' defined in URL [bundleentry://3/META-INF/spring/module-context.xml]; nested exception is java.lang.ClassNotFoundException: com.springsource.osgi.springdm.simple.internal.DefaultEchoService not found from bundle [com.springsource.osgi.springdm.simple]
                      	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)
                      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)
                      	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177)
                      	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:758)
                      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:422)
                      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
                      	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:288)
                      	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
                      	at java.lang.Thread.run(Unknown Source)
                      Caused by: java.lang.ClassNotFoundException: com.springsource.osgi.springdm.simple.internal.DefaultEchoService not found from bundle [com.springsource.osgi.springdm.simple]
                      	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
                      	at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
                      	at java.lang.ClassLoader.loadClass(Unknown Source)
                      	at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)
                      	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)
                      	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)
                      	... 8 more
                      Caused by: java.lang.ClassNotFoundException: com.springsource.osgi.springdm.simple.internal.DefaultEchoService
                      	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:481)
                      	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397)
                      	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385)
                      	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
                      	at java.lang.ClassLoader.loadClass(Unknown Source)
                      	at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:313)
                      	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
                      	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1274)
                      	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
                      	... 13 more
                      Exception in thread "SpringOsgiExtenderThread-2" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.springsource.osgi.springdm.simple.internal.DefaultEchoService] for bean with name 'echoService' defined in URL [bundleentry://3/META-INF/spring/module-context.xml]; nested exception is java.lang.ClassNotFoundException: com.springsource.osgi.springdm.simple.internal.DefaultEchoService not found from bundle [com.springsource.osgi.springdm.simple]
                      	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)
                      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)
                      	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177)
                      	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:758)
                      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:422)
                      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
                      	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:288)
                      	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
                      	at java.lang.Thread.run(Unknown Source)
                      Caused by: java.lang.ClassNotFoundException: com.springsource.osgi.springdm.simple.internal.DefaultEchoService not found from bundle [com.springsource.osgi.springdm.simple]
                      	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
                      	at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
                      	at java.lang.ClassLoader.loadClass(Unknown Source)
                      	at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)
                      	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)
                      	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)
                      	... 8 more
                      Caused by: java.lang.ClassNotFoundException: com.springsource.osgi.springdm.simple.internal.DefaultEchoService
                      	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:481)
                      	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397)
                      	at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385)
                      	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
                      	at java.lang.ClassLoader.loadClass(Unknown Source)
                      	at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:313)
                      	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
                      	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1274)
                      	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
                      	... 13 more
                      is there a way of solution?

                      Comment


                      • #12
                        Still there in 2.3.2.

                        Comment


                        • #13
                          Still Broken in v2.5.1

                          Further, the dashboard tutorials are outdated for the Live Update, JUnit, and Spring-Powered OSGi Bundle projects - and that's as far as I've gotten!

                          These really need to be updated or removed.

                          Comment

                          Working...
                          X