问题
I am using Restlet for my communication between my clients (JSE2) and my server(GAE).
The clients are OSGi based.
I have a shared bundle containing my resource interfaces and a bundle containing the code to wrap a resource to a ClientResource. But the org.restlet bundle doesn't import any of these bundles. I think its not the right solution to edit the manifest of the org.restlet bundle and import the shared bundle manualy. Also this is a very static solution.
Is there a beter way to import these interface so i can wrap them into a Restlet ClientResource?
This is the exception where i'm dealing with:
java.lang.ClassNotFoundException: *** Class 'crm.resources.server.restlet.ContactResource' was not found because bundle org.restlet [3] does not import 'crm.resources.server.restlet' even though bundle crm.shared.resources.server [4] does export it. To resolve this issue, add an import for 'crm.resources.server.restlet' to bundle org.restlet [3]. ***
Update: Its useless to edit the manifest because the shared bundle uses some imports from the org.restlet bundle. So when you try to start the org.restlet bundle the imported packages from the shared bundle are missing. If you start the shared bundle first, he miss the packages from the org.restlet. (I hope i'm explaining it clearly)
回答1:
I understand your issue. The best solution i came up with is to add "DynamicImport-Bundle: *" in org.restlet MANIFEST-File (2.1.2 so far). At least, that prevents you from circular dependencies and doesn't force you to manually adjust the imports once you change your restlet application.
See also: https://github.com/restlet/restlet-framework-java/issues/6
Best regards, Simon
来源:https://stackoverflow.com/questions/8433657/import-package-without-edit-the-manifest-file-in-org-restlet