
Originally Posted by
polosatiy
I've just checked "getFile()" method and I've found an error.
The problem with this line:
Code:
ResourceUtils.getFile(getURI(), getDescription());
URI starts from "bundle", but ResourceUtils expects "file". That's why is doesn't work.
Try to use URL or InputStream.
So what you are saying is a bug with the spring ResourceUtils ? I guessthe value of URI getting passed is "bundle://258.0:1/repo/test.db4o".
In ResourceUtils.getFile(),
Code:
if (!URL_PROTOCOL_FILE.equals(resourceUrl.getProtocol())) {
throw new FileNotFoundException(
description + " cannot be resolved to absolute file path " +
"because it does not reside in the file system: " + resourceUrl);
}
Here its expecting "file" but getting "bundle" and hence the exception. Thanks for debugging this for me.
But the follow-up question is how its so obvious that the protocol will be a file ? Any resource uri deployed in an OSGi bundle will always start with a bundle. Isn't this a bug ? My problem now is, the ObjectContainerFactoryBean is a third party code which I've little control over. Moreover, the inherent call to Db4o.openFile() is the only method available, so getting File is the only choice. Not sure how to resolve this now.