Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SeMantic Information Logistics Architecture (SMILA) » ClassLoader problem
ClassLoader problem [message #668444] Thu, 05 May 2011 12:54 Go to next message
Lox  is currently offline Lox
Messages: 4
Registered: May 2011
Junior Member
Hello,

I'm developing a small tool that serves as a wrapper for an xquery api implementation based on BaseX.

So, I have to instantiate the driver like this
XQDataSource source = (XQDataSource) Class.forName(DRIVER).newInstance();

where DRIVER is obviously the String containing the class of the driver.

Now, when I run this bundle as a standalone or call it from another standalone bundle, it works.

But if I try to call it from a Pipelet or from the crawler I get a ClassNotFoundException.

All the imported/exported packages seem ok.

Maybe someone knows where I'm mistaking?
Is it due to the BundleLoader in OSGI working differently and wanting a different "path" for the class?

Thank you very much.
Re: ClassLoader problem [message #668478 is a reply to message #668444] Thu, 05 May 2011 15:53 Go to previous messageGo to next message
Lox  is currently offline Lox
Messages: 4
Registered: May 2011
Junior Member
Ok, I can just reply to myself.

It seems that I was missing a point.

Yes, I said "a" point and not "the" point.

For some reason, in the Manifest of my xquery wrapper, I had to add also another line containing just a dot ("." without quotes) in the Bundle-ClassPath section.
This besides the other jar files I was importing.

I don't know why, maybe it's an escape value meaning "root"? If that's so, it's not very clear.

Oh well, maybe this will be useful to others incurring in the same problem.
Any better explanation of this behaviour is welcome!
Re: ClassLoader problem [message #668543 is a reply to message #668478] Fri, 06 May 2011 03:42 Go to previous messageGo to next message
thomas menzel is currently offline thomas menzel
Messages: 81
Registered: July 2009
Member
If you don't have a Bundle-Classpath header in ur .MF then it defaults
to ".", i.e. the root of the bundle which is to where PDE compiles the
classes (defined in ur build.properties) from your source files.

If u u add a jar to the Classpath then the CP is just the one as defined
by the ref'ed jar and you sources are not any more. So that is why u
have to also add the . in order for ur classes to work.


On 05.05.2011 21:53, Lox wrote:
> Ok, I can just reply to myself.
>
> It seems that I was missing a point.
>
> Yes, I said "a" point and not "the" point.
>
> For some reason, in the Manifest of my xquery wrapper, I had to add also
> another line containing just a dot ("." without quotes) in the
> Bundle-ClassPath section.
> This besides the other jar files I was importing.
>
> I don't know why, maybe it's an escape value meaning "root"? If that's
> so, it's not very clear.
>
> Oh well, maybe this will be useful to others incurring in the same problem.
> Any better explanation of this behaviour is welcome!


--
thomas menzel aka tom


thomas menzel aka tom
Re: ClassLoader problem [message #668604 is a reply to message #668543] Fri, 06 May 2011 07:57 Go to previous message
Lox  is currently offline Lox
Messages: 4
Registered: May 2011
Junior Member
thank you for the explanation!
Previous Topic:Release 0.8 is out!
Next Topic:HtmlToText Pipelet and encoding
Goto Forum:
  


Current Time: Sun Apr 20 06:58:15 EDT 2014

Powered by FUDForum. Page generated in 0.05068 seconds