2 Replies Latest reply on Jul 2, 2009 10:52 AM by Artur Socha

    class loading issues

    Artur Socha Newbie

      Hello ,

       

      I keep seeing weird problems. In some cases there are NoClassDefFoundError errors. I checked packages/exports and packages with  'missing' classes are exported.

      I also tried to embed such packaged within my bundle - no change.

       

      The only workaround that I'm aware of is to put 'missing classes' bundles in system directory and activate them at startup.

       

      I'm really confused about that. Can someone explain me why this situation happens?  Is there any other way to tackle that problem?.

       

      regards,

      Artur Socha

        • 1. Re: class loading issues
          Stan Lewis Novice

          It's likely that you're using a dependent library but not specifically importing the package in your own code, so the maven-bundle-plugin needs you to tell it what other packages your bundle needs to import.  You do this with the

           

          In this case I'm telling the plugin that my bundle also needs to have access to org.some.other.package whether or not my code actually imports this package.

          • 2. Re: class loading issues
            Artur Socha Newbie

            Thanks for response,

             

            Missing package is imported there.

             

            Ex .

            Problem:

            java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence

             

            Config:

            ...

            <Import-Package>

                                        *;resolution:=optional,

                                        org.apache.camel,

                                        org.apache.camel.builder,

                                        org.apache.camel.model,

                                        org.apache.log4j,

                                        org.aspectj.lang.annotation,

                                        org.springframework.beans.factory,

                                        org.apache.camel.osgi,

                                        org.apache.camel.component.jetty,

                                        org.springframework.aop.aspectj.annotation,

                                        org.springframework.aop.framework,

                                        org.springframework.aop,

                                        net.sf.cglib.proxy,

                                        org.aopalliance.aop,

                                        net.sf.cglib.core,

                                        net.sf.cglib.reflect,

                                        org.aspectj.lang.reflect,

                                        org.aspectj.lang,

                                        org.apache.commons.dbcp,

                                        org.springframework.orm.jpa,

                                        org.springframework.jdbc.datasource.lookup,

                                        org.springframework.orm.jpa.vendor,

                                        *org.hibernate.ejb*

             

                                    </Import-Package>