ClassLoader problem [message #668444] |
Thu, 05 May 2011 12:54  |
Eclipse User |
|
|
|
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 #668543 is a reply to message #668478] |
Fri, 06 May 2011 03:42   |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.28786 seconds