Announcement Announcement Module
Collapse
No announcement yet.
Problems to setup transitive dependency across bundles Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems to setup transitive dependency across bundles

    I have maven project with multiple modules that I want to turn into OSGi bundles and deploy to the S2AP to be available to web modules. In order to follow the migration steps carefully, I started with one exported service from one module and created a new project with a simple web module to test it.

    Having the Eclipse AP tool to deploy the web module, I received a classpath not found error from the installed bundle. I did not understand why the class loader was not able to find a class that should be available through the spring library, since I included the <Import-Library: org.springframework.spring;version="[2.5.4,3.0)"> header in the manifest file. To get rid of this, I included one Import-Package after every successive complaint from the class loader. So far, my manifest file looks like this:

    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-SymbolicName: org.helianto.core
    Bundle-Vendor: I-Serv Consultoria Empresarial
    Bundle-Name: Helianto Core package
    Bundle-Version: 0.0.1.20080612
    Import-Bundle: com.springsource.org.apache.commons.dbcp;version="[1.2.2.osgi,1.2.2.osgi]",
    com.springsource.org.hsqldb;version="[1.8.0.9,1.8.0.9]"
    Import-Library: org.springframework.spring;version="[2.5.4,3.0)",
    org.hibernate.ejb
    Export-Package: org.helianto.core,
    org.helianto.core.creation,
    ...
    Import-Package: org.springframework.context.support,
    org.springframework.orm;version="[2.5.5.A,2.5.5.A]",
    org.springframework.orm.hibernate3;version="[2.5.5.A,2.5.5.A]",
    ...
    org.springframework.transaction.support;version="[2.5.5.A,2.5.5.A]"

    But from the last error report (see below) I see that now the required dependency comes from a spring bundle, not from the bundle I deployed. I certainly missed the point to set up this the right way. I also found a discussion topic having a similar issue: http://www.springsource.com/beta/applicationplatform/comments.php?DiscussionID=216&page=1#Item_0

    My question: where in the documentation or discussions can I look for a missing step on my setup?

    Thank you,

    Mauricio

    ...
    [2008-09-08 09:04:50.382] ction(5)-192.168.254.150 <SPDE0010I> Deployment of 'iservport-web-test.war' version '0' completed.
    [2008-09-08 09:04:50.398] platform-dm-12 <SPDE0020E> Application context creation failure for bundle 'org.helianto.core'.
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'userMgr' defined in URL [bundleentry://69/META-INF/spring/org.helianto.core.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:480)
    ...
    at com.springsource.platform.kernel.dm.ContextPropaga tingTaskExecutor$2.run(ContextPropagatingTaskExecu tor.java:82)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.NoClassDefFoundError: org/hibernate/HibernateException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    ...
    Caused by: com.springsource.platform.osgi.framework.PlatformC lassNotFoundException: org.hibernate.HibernateException in PlatformBundleClassLoader: [bundle=org.springframework.orm_2.5.5.A]
    at com.springsource.platform.osgi.framework.equinox.P latformBundleClassLoader.loadClass(PlatformBundleC lassLoader.java:136)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
    ... 36 more
    Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException
    at org.eclipse.osgi.framework.internal.core.BundleLoa der.findClassInternal(BundleLoader.java:481)
    at org.eclipse.osgi.framework.internal.core.BundleLoa der.findClass(BundleLoader.java:397)
    at org.eclipse.osgi.framework.internal.core.BundleLoa der.findClass(BundleLoader.java:385)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClass Loader.loadClass(DefaultClassLoader.java:87)
    at com.springsource.platform.osgi.framework.equinox.P latformBundleClassLoader.loadClass(PlatformBundleC lassLoader.java:134)
    ... 38 more

  • #2
    Problems to setup transitive dependency across bundles

    Hi Mauricio,

    Just out of curiosity, are you certain you've properly copied the Hibernate library (e.g., org.hibernate.ejb-library-3.3.2.GA.libd) and all corresponding bundles to the correct locations in the Platform (e.g., repository/libraries/usr and repository/bundles/usr, respectively)?

    After doing so, did you restart the Platform as well?

    Regards,

    Sam

    Comment


    • #3
      Problems to setup transitive dependency across bundles

      Thank you Sam,

      Well, I missed that. At the time of my previous question, I did not realize the library has only references to bundles actually installed under repository/bundles/usr. But, yes, now I assured -> I properly copied the Hibernate library (e.g., org.hibernate.ejb-library-3.3.2.GA.libd) and all corresponding bundles to the correct locations in the Platform (e.g., repository/libraries/usr and repository/bundles/usr, respectively), and also restarted Eclipse and the Platform (also using Eclipse -clean option). But the error remains:

      [2008-09-08 11:09:10.588] ction(6)-192.168.254.150 <SPSC1000I> Creating web application '/iservport-web-test'.
      [2008-09-08 11:09:11.088] async-delivery-thread-1 <SPSC1001I> Starting web application '/iservport-web-test'.
      [2008-09-08 11:09:11.447] platform-dm-7 <SPDE0020E> Application context creation failure for bundle 'org.helianto.core'.
      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'userMgr' defined in URL [bundleentry://73/META-INF/spring/org.helianto.core.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException
      ...
      Caused by: java.lang.NoClassDefFoundError: org/hibernate/HibernateException
      at java.lang.Class.getDeclaredConstructors0(Native Method)
      ...

      I also noticed this from the OSGi console:

      21 ACTIVE org.springframework.orm_2.5.5.A
      22 INSTALLED com.springsource.org.hibernate_3.2.6.ga
      23 INSTALLED com.springsource.org.hibernate.annotations_3.3.1.g a
      24 INSTALLED com.springsource.org.hibernate.ejb_3.3.2.GA
      25 ACTIVE com.springsource.org.hibernate.annotations.common_ 3.3.0.ga

      Regards,

      Mauricio

      Comment


      • #4
        Problems to setup transitive dependency across bundles

        Hi Mauricio,

        The output from the OSGi console is interesting... What errors, if any, do you get if you attempt to start the Hibernate and Hibernate annotations bundles in the console? E.g.:

        > start 22
        > start 23

        My guess is that some of these bundles' dependencies are missing from the repository. The errors should help us to confirm that's the case.

        Thanks,
        Andy

        Comment


        • #5
          Problems to setup transitive dependency across bundles

          Hi Andy,

          Here is the output:

          osgi> start 22
          org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Import-Package: antlr; version="[2.7.6,3.0.0)"
          at org.eclipse.osgi.framework.internal.core.BundleHos t.startWorker(BundleHost.java:305)
          at org.eclipse.osgi.framework.internal.core.AbstractB undle.start(AbstractBundle.java:265)
          at org.eclipse.osgi.framework.internal.core.AbstractB undle.start(AbstractBundle.java:257)
          at org.eclipse.osgi.framework.internal.core.Framework CommandProvider._start(FrameworkCommandProvider.ja va:257)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.eclipse.osgi.framework.internal.core.Framework CommandInterpreter.execute(FrameworkCommandInterpr eter.java:150)
          at org.eclipse.osgi.framework.internal.core.Framework Console.docommand(FrameworkConsole.java:302)
          at org.eclipse.osgi.framework.internal.core.Framework Console.console(FrameworkConsole.java:287)
          at org.eclipse.osgi.framework.internal.core.Framework Console.run(FrameworkConsole.java:223)
          at java.lang.Thread.run(Thread.java:619)

          osgi> start 23
          org.osgi.framework.BundleException: A fragment bundle cannot be started: file:///C:springsource-ap
          epositoryundlesusrcom.springsource.org.hibernate. annotations-3.3.1.ga.jar [23]
          at org.eclipse.osgi.framework.internal.core.BundleFra gment.startWorker(BundleFragment.java:224)
          at org.eclipse.osgi.framework.internal.core.AbstractB undle.start(AbstractBundle.java:265)
          at org.eclipse.osgi.framework.internal.core.AbstractB undle.start(AbstractBundle.java:257)
          at org.eclipse.osgi.framework.internal.core.Framework CommandProvider._start(FrameworkCommandProvider.ja va:257)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.eclipse.osgi.framework.internal.core.Framework CommandInterpreter.execute(FrameworkCommandInterpr eter.java:150)
          at org.eclipse.osgi.framework.internal.core.Framework Console.docommand(FrameworkConsole.java:302)
          at org.eclipse.osgi.framework.internal.core.Framework Console.console(FrameworkConsole.java:287)
          at org.eclipse.osgi.framework.internal.core.Framework Console.run(FrameworkConsole.java:223)
          at java.lang.Thread.run(Thread.java:619)

          osgi> start 24
          org.osgi.framework.BundleException: A fragment bundle cannot be started: file:///C:springsource-ap
          epositoryundlesusrcom.springsource.org.hibernate. ejb-3.3.2.GA.jar [24]
          at org.eclipse.osgi.framework.internal.core.BundleFra gment.startWorker(BundleFragment.java:224)
          at org.eclipse.osgi.framework.internal.core.AbstractB undle.start(AbstractBundle.java:265)
          at org.eclipse.osgi.framework.internal.core.AbstractB undle.start(AbstractBundle.java:257)
          at org.eclipse.osgi.framework.internal.core.Framework CommandProvider._start(FrameworkCommandProvider.ja va:257)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.eclipse.osgi.framework.internal.core.Framework CommandInterpreter.execute(FrameworkCommandInterpr eter.java:150)
          at org.eclipse.osgi.framework.internal.core.Framework Console.docommand(FrameworkConsole.java:302)
          at org.eclipse.osgi.framework.internal.core.Framework Console.console(FrameworkConsole.java:287)
          at org.eclipse.osgi.framework.internal.core.Framework Console.run(FrameworkConsole.java:223)
          at java.lang.Thread.run(Thread.java:619)

          Regards,

          Mauricio

          Comment


          • #6
            Problems to setup transitive dependency across bundles

            Hi Mauricio,

            Go to this page...

            http://www.springsource.com/repository/app/library/version/detail?name=org.hibernate.ejb&version=3.3.2.GA&sea rchType=librariesByName&searchQuery=hibernate

            ... and make sure you have each of the bundles listed under the "Required Dependencies" section installed in your repository.

            Or, if you're using version 3.3.1 of the Hibernate library, go to this page:

            http://www.springsource.com/repository/app/library/version/detail?name=org.hibernate.ejb&version=3.3.1.ga&sea rchType=librariesByName&searchQuery=hibernate

            Regards,

            Sam

            Comment


            • #7
              Problems to setup transitive dependency across bundles

              Hi Sam,

              I checked my directory listing against the library listing. It seems to be ok. Here it is:

              C:springsource-ap
              epositoryundlesusr>dir
              O volume na unidade C é OS
              O Número de Série do Volume é 728E-074C

              Pasta de C:springsource-ap
              epositoryundlesusr

              08/09/2008 11:02 <DIR> .
              08/09/2008 11:02 <DIR> ..
              08/09/2008 11:01 53.767 com.springsource.javax.persistence-1.0.0.jar
              04/09/2008 05:49 122.704 com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
              04/09/2008 05:49 124.489 com.springsource.org.apache.commons.dbcp-sources-1.2.2.osgi.jar
              08/09/2008 11:00 2.299.277 com.springsource.org.hibernate-3.2.6.ga.jar
              08/09/2008 11:00 283.157 com.springsource.org.hibernate.annotations-3.3.1.ga.jar
              08/09/2008 11:01 67.589 com.springsource.org.hibernate.annotations.common-3.3.0.ga.jar
              08/09/2008 11:01 120.623 com.springsource.org.hibernate.ejb-3.3.2.GA.jar
              08/09/2008 09:02 233.257 helianto-core.jar
              8 arquivo(s) 3.304.863 bytes
              2 pasta(s) 34.830.360.576 bytes disponíveis

              Regards,

              Maurício

              Comment


              • #8
                Problems to setup transitive dependency across bundles

                Hi Mauricio,

                Your directory listing only lists the bundles directly referenced by the library, but it does NOT list all of the "Required Dependencies" of those bundles. Please review my previous post.

                You'll notice under the "Required Dependencies" section of the SpringSource Enterprise Bundle Repository for the Hibernate JPA library (version 3.3.2) that you need the following as well:

                (see the previously listed URL for better formatting)

                JBoss Hibernate Object-Relational Mapper com.springsource.org.hibernate 3.2.6.ga
                JBoss Hibernate Annotations com.springsource.org.hibernate.annotations 3.3.1.ga
                JBoss Hibernate Common Annotations com.springsource.org.hibernate.annotations.common 3.3.0.ga
                JBoss Hibernate Entity Manager com.springsource.org.hibernate.ejb 3.3.2.GA
                Java Persistence API com.springsource.javax.persistence 1.0.0
                ANTLR com.springsource.antlr 2.7.7
                Javassist Java Programming Assistant com.springsource.javassist 3.3.0.ga
                CGLIB Code Generation Library com.springsource.net.sf.cglib 2.1.3
                Apache Commons Collections com.springsource.org.apache.commons.collections 3.2.0
                Apache Commons Logging com.springsource.org.apache.commons.logging 1.1.1
                dom4j DOM Processor com.springsource.org.dom4j 1.6.1
                Java XML Stream API com.springsource.javax.xml.stream 1.0.1
                ObjectWeb ASM com.springsource.org.objectweb.asm 1.5.3
                ObjectWeb ASM Attributes com.springsource.org.objectweb.asm.tree.attrs 1.5.3

                Regards,

                Sam

                Comment


                • #9
                  Problems to setup transitive dependency across bundles

                  Sam, Andy,

                  I do not know if you are in Europe or US, what is your time zone? Knowing that would help me plan the rest of my day (I am at GMT-3). Thanks.

                  Comment


                  • #10
                    Problems to setup transitive dependency across bundles

                    Sorry, I should have read more carefully. The listing now shows:

                    Pasta de C:springsource-ap
                    epositoryundlesusr

                    08/09/2008 12:39 <DIR> .
                    08/09/2008 12:39 <DIR> ..
                    08/09/2008 12:35 445.573 com.springsource.antlr-2.7.7.jar
                    08/09/2008 12:35 464.134 com.springsource.javassist-3.3.0.ga.jar
                    08/09/2008 11:01 53.767 com.springsource.javax.persistence-1.0.0.jar
                    08/09/2008 12:35 328.786 com.springsource.net.sf.cglib-2.1.3.jar
                    08/09/2008 12:36 578.877 com.springsource.org.apache.commons.collections-3.2.0.jar
                    04/09/2008 05:49 122.704 com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
                    04/09/2008 05:49 124.489 com.springsource.org.apache.commons.dbcp-sources-1.2.2.osgi.jar
                    08/09/2008 12:36 61.465 com.springsource.org.apache.commons.logging-1.1.1.jar
                    08/09/2008 12:36 314.484 com.springsource.org.dom4j-1.6.1.jar
                    08/09/2008 11:00 2.299.277 com.springsource.org.hibernate-3.2.6.ga.jar
                    08/09/2008 11:00 283.157 com.springsource.org.hibernate.annotations-3.3.1.ga.jar
                    08/09/2008 11:01 67.589 com.springsource.org.hibernate.annotations.common-3.3.0.ga.jar
                    08/09/2008 11:01 120.623 com.springsource.org.hibernate.ejb-3.3.2.GA.jar
                    08/09/2008 12:38 26.710 com.springsource.org.objectweb.asm-1.5.3.jar
                    08/09/2008 12:38 17.181 com.springsource.org.objectweb.asm.attrs-1.5.3.jar
                    08/09/2008 09:02 233.257 helianto-core.jar

                    and the console shows:

                    23 ACTIVE org.springframework.orm_2.5.5.A
                    24 ACTIVE com.springsource.org.hibernate_3.2.6.ga
                    Fragments=25, 26
                    25 RESOLVED com.springsource.org.hibernate.annotations_3.3.1.g a
                    Master=24
                    26 RESOLVED com.springsource.org.hibernate.ejb_3.3.2.GA
                    Master=24
                    27 ACTIVE com.springsource.antlr_2.7.7
                    28 ACTIVE com.springsource.javassist_3.3.0.ga
                    29 ACTIVE com.springsource.org.dom4j_1.6.1
                    30 ACTIVE com.springsource.org.objectweb.asm_1.5.3
                    31 ACTIVE com.springsource.org.objectweb.asm.tree.attrs_1.5. 3
                    32 ACTIVE com.springsource.org.hibernate.annotations.common_ 3.3.0.ga
                    33 ACTIVE org.springframework.transaction_2.5.5.A

                    Now the error is pointing to other unresolved dependencies. My next step is to place the dependencies in the right place.

                    Thanks,

                    Mauricio

                    Comment

                    Working...
                    X