You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by kato <ja...@smartstream-stp.com> on 2012/11/29 12:41:00 UTC

OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Hi,

I am using ehcache 2.5.1 to cache my objects. I've deployed on ServiceMix
4.3.

I am using the ServiceMix bundle version of Ehcache, which has the headers
set as follows


    karaf@root> osgi:headers 281 | more  
      
    Apache ServiceMix :: Bundles :: ehcache (281)  
    ---------------------------------------------  
    Manifest-Version = 1.0  
    Bnd-LastModified = 1333038240996  
    Tool = Bnd-1.50.0  
    Built-By = jbonofre  
    Build-Jdk = 1.6.0_26  
    DynamicImport-Packages = *  
    Created-By = Apache Maven Bundle Plugin  
      
    Bundle-Vendor = The Apache Software Foundation  
    Bundle-Name = Apache ServiceMix :: Bundles :: ehcache  
    Bundle-DocURL = http://www.apache.org/  
    Bundle-Description = This OSGi bundle wraps ehcache 2.5.1 jar file.  
    Bundle-SymbolicName = org.apache.servicemix.bundles.ehcache  
    Bundle-Version = 2.5.1.1  
    Bundle-License = http://www.apache.org/licenses/LICENSE-2.0.txt  
    Bundle-ManifestVersion = 2  
      
    Import-Package =  
            javax.jms;resolution:=optional,  
            javax.management,  
            javax.management.openmbean,  
            javax.naming,  
            ...  



I have made sure that my bundle exports the offending package:

    karaf@root> packages:exports 282  
        ID Packages  
       282 a.b; version=1.0.0.SNAPSHOT  
       282 a.b.c; version=1.0.0.SNAPSHOT  

And yet I still get the runtime error:

    Caused by: java.lang.ClassNotFoundException: a.b.SomeClass not found by
org.apache.servicemix.bundles.ehcache [281]  
            at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)  
            at
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)  
            at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1806)  
            at
java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_26]  
            at java.lang.Class.forName0(Native Method)[:1.6.0_26]  
            at java.lang.Class.forName(Class.java:247)[:1.6.0_26]  
            at
net.sf.ehcache.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:129)  
            at
net.sf.ehcache.util.PreferTCCLObjectInputStream.resolveClass(PreferTCCLObjectInputStream.java:44)  


What am I missing?

cheers,
Kato



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-ClassNotFoundException-despite-using-DynamicImport-Packages-tp5715060.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by Filippo Balicchia <fb...@gmail.com>.
Hi James,
At the moment I can not answer precisely,
But to address the problem IHMO it is better to remove the dynaminc import
In this manner you can figure out What you're missing.

Could probably be the bundle ehcache but it is merely a hypothesis.

let me know

Regards

--Filippo

2012/11/29 kato <ja...@smartstream-stp.com>:
> James

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by kato <ja...@smartstream-stp.com>.
Hi Filippo,

The package is one of my own that I have deployed in a bundle. In the above
post I have called it a.b

Specifically, the exception reports a class within the package cannot be
found, i.e. the class I am trying to cache.

Could there be some version problem? I am pretty sure that there are no
other packages also exporting the same package since there is only one
version reported through packages:exports

Cheers,
James



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-ClassNotFoundException-despite-using-DynamicImport-Packages-tp5715060p5715062.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by Filippo Balicchia <fb...@gmail.com>.
Hi Kato,

could you tell me please which package is not find ?

Regards.

--Filippo


2012/11/29 kato <ja...@smartstream-stp.com>:
> Hi,
>
> I am using ehcache 2.5.1 to cache my objects. I've deployed on ServiceMix
> 4.3.
>
> I am using the ServiceMix bundle version of Ehcache, which has the headers
> set as follows
>
>
>     karaf@root> osgi:headers 281 | more
>
>     Apache ServiceMix :: Bundles :: ehcache (281)
>     ---------------------------------------------
>     Manifest-Version = 1.0
>     Bnd-LastModified = 1333038240996
>     Tool = Bnd-1.50.0
>     Built-By = jbonofre
>     Build-Jdk = 1.6.0_26
>     DynamicImport-Packages = *
>     Created-By = Apache Maven Bundle Plugin
>
>     Bundle-Vendor = The Apache Software Foundation
>     Bundle-Name = Apache ServiceMix :: Bundles :: ehcache
>     Bundle-DocURL = http://www.apache.org/
>     Bundle-Description = This OSGi bundle wraps ehcache 2.5.1 jar file.
>     Bundle-SymbolicName = org.apache.servicemix.bundles.ehcache
>     Bundle-Version = 2.5.1.1
>     Bundle-License = http://www.apache.org/licenses/LICENSE-2.0.txt
>     Bundle-ManifestVersion = 2
>
>     Import-Package =
>             javax.jms;resolution:=optional,
>             javax.management,
>             javax.management.openmbean,
>             javax.naming,
>             ...
>
>
>
> I have made sure that my bundle exports the offending package:
>
>     karaf@root> packages:exports 282
>         ID Packages
>        282 a.b; version=1.0.0.SNAPSHOT
>        282 a.b.c; version=1.0.0.SNAPSHOT
>
> And yet I still get the runtime error:
>
>     Caused by: java.lang.ClassNotFoundException: a.b.SomeClass not found by
> org.apache.servicemix.bundles.ehcache [281]
>             at
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)
>             at
> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
>             at
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1806)
>             at
> java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_26]
>             at java.lang.Class.forName0(Native Method)[:1.6.0_26]
>             at java.lang.Class.forName(Class.java:247)[:1.6.0_26]
>             at
> net.sf.ehcache.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:129)
>             at
> net.sf.ehcache.util.PreferTCCLObjectInputStream.resolveClass(PreferTCCLObjectInputStream.java:44)
>
>
> What am I missing?
>
> cheers,
> Kato
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-ClassNotFoundException-despite-using-DynamicImport-Packages-tp5715060.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by kato <ja...@smartstream-stp.com>.
Thanks folks. I can see there is nothing left to be done on this one. I'll
check out those links for future.

What are the approximate timescales for release of these patched bundles?

Cheers,
Kato



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-ClassNotFoundException-despite-using-DynamicImport-Packages-tp5715060p5715102.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by Gert Vanthienen <ge...@gmail.com>.
Hey Filippo,

Good catch - if you refresh that page now, this should be fixed as well!

Thanks,

Gert


On Thu, Nov 29, 2012 at 5:30 PM, Filippo Balicchia <fb...@gmail.com>wrote:

> Hi Gert,
> while i'm reading your mail I see that
> Discussion Forum has a broken link ;-)
>
> If you have time please fix that
>
> Regards
>
> --Filippo
>
> 2012/11/29 Gert Vanthienen <ge...@gmail.com>:
> > to the right location for JIRA, so disre
>

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by Filippo Balicchia <fb...@gmail.com>.
Hi Gert,
while i'm reading your mail I see that
Discussion Forum has a broken link ;-)

If you have time please fix that

Regards

--Filippo

2012/11/29 Gert Vanthienen <ge...@gmail.com>:
> to the right location for JIRA, so disre

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by Gert Vanthienen <ge...@gmail.com>.
Kato,

You can also find more information about contributing and creating patches
in http://servicemix.apache.org/community/contributing.html - Filippo
already pointed you to the right location for JIRA, so disregard the broken
links in that page (will fix that up right after sending this mail ;))

Regards,

Gert


On Thu, Nov 29, 2012 at 4:57 PM, Filippo Balicchia <fb...@gmail.com>wrote:

> Hi James,
>
> I have just made a jira to trace the problem.
> https://issues.apache.org/jira/browse/SMX4-1303
>
> I hope this is ok for you.
>
> Regards
>
> --Filippo
>
> 2012/11/29 kato <ja...@smartstream-stp.com>:
> > Thanks Gert, you have sharp eyes! Just what I was looking for...
> >
> > I have manually adjusted the header and it seems to work.
> >
> > I am not sure how to patch or raise a JIRA. Can you give me the links to
> the
> > necessary information please?
> >
> > Cheers,
> > James
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://servicemix.396122.n5.nabble.com/OSGi-ClassNotFoundException-despite-using-DynamicImport-Packages-tp5715060p5715072.html
> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
>

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by Filippo Balicchia <fb...@gmail.com>.
Hi James,

I have just made a jira to trace the problem.
https://issues.apache.org/jira/browse/SMX4-1303

I hope this is ok for you.

Regards

--Filippo

2012/11/29 kato <ja...@smartstream-stp.com>:
> Thanks Gert, you have sharp eyes! Just what I was looking for...
>
> I have manually adjusted the header and it seems to work.
>
> I am not sure how to patch or raise a JIRA. Can you give me the links to the
> necessary information please?
>
> Cheers,
> James
>
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-ClassNotFoundException-despite-using-DynamicImport-Packages-tp5715060p5715072.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by kato <ja...@smartstream-stp.com>.
Thanks Gert, you have sharp eyes! Just what I was looking for...

I have manually adjusted the header and it seems to work.

I am not sure how to patch or raise a JIRA. Can you give me the links to the
necessary information please?

Cheers,
James





--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-ClassNotFoundException-despite-using-DynamicImport-Packages-tp5715060p5715072.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by Gert Vanthienen <ge...@gmail.com>.
Kato,

There seems to be a problem with the OSGi headers of that bundle.  The
bundle header should be called DynamicImport-Package instead of
DynamicImport-Packages.  Could you raise a JIRA issue to get that fixed?
 If you fancy providing a patch as well, that would be very welcome too
obviously ;)  Source code can be found at
http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/ehcache-2.5.1/

Regards,

Gert


On Thu, Nov 29, 2012 at 12:41 PM, kato <ja...@smartstream-stp.com>wrote:

> Hi,
>
> I am using ehcache 2.5.1 to cache my objects. I've deployed on ServiceMix
> 4.3.
>
> I am using the ServiceMix bundle version of Ehcache, which has the headers
> set as follows
>
>
>     karaf@root> osgi:headers 281 | more
>
>     Apache ServiceMix :: Bundles :: ehcache (281)
>     ---------------------------------------------
>     Manifest-Version = 1.0
>     Bnd-LastModified = 1333038240996
>     Tool = Bnd-1.50.0
>     Built-By = jbonofre
>     Build-Jdk = 1.6.0_26
>     DynamicImport-Packages = *
>     Created-By = Apache Maven Bundle Plugin
>
>     Bundle-Vendor = The Apache Software Foundation
>     Bundle-Name = Apache ServiceMix :: Bundles :: ehcache
>     Bundle-DocURL = http://www.apache.org/
>     Bundle-Description = This OSGi bundle wraps ehcache 2.5.1 jar file.
>     Bundle-SymbolicName = org.apache.servicemix.bundles.ehcache
>     Bundle-Version = 2.5.1.1
>     Bundle-License = http://www.apache.org/licenses/LICENSE-2.0.txt
>     Bundle-ManifestVersion = 2
>
>     Import-Package =
>             javax.jms;resolution:=optional,
>             javax.management,
>             javax.management.openmbean,
>             javax.naming,
>             ...
>
>
>
> I have made sure that my bundle exports the offending package:
>
>     karaf@root> packages:exports 282
>         ID Packages
>        282 a.b; version=1.0.0.SNAPSHOT
>        282 a.b.c; version=1.0.0.SNAPSHOT
>
> And yet I still get the runtime error:
>
>     Caused by: java.lang.ClassNotFoundException: a.b.SomeClass not found by
> org.apache.servicemix.bundles.ehcache [281]
>             at
>
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)
>             at
> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
>             at
>
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1806)
>             at
> java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_26]
>             at java.lang.Class.forName0(Native Method)[:1.6.0_26]
>             at java.lang.Class.forName(Class.java:247)[:1.6.0_26]
>             at
> net.sf.ehcache.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:129)
>             at
>
> net.sf.ehcache.util.PreferTCCLObjectInputStream.resolveClass(PreferTCCLObjectInputStream.java:44)
>
>
> What am I missing?
>
> cheers,
> Kato
>
>
>
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/OSGi-ClassNotFoundException-despite-using-DynamicImport-Packages-tp5715060.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>

Re: OSGi ClassNotFoundException despite using DynamicImport-Packages = *

Posted by Filippo Balicchia <fb...@gmail.com>.
Hi James,
another approach to follow see if the packages used in class a.b.SomeClass
are exported by ehcache bundle

Regards

--Filippo