导入包而不编辑org

导入包而不编辑org

本文介绍了导入包而不编辑org.restlet中的清单文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Restlet进行客户(JSE2)和服务器(GAE)之间的通信.

I am using Restlet for my communication between my clients (JSE2) and my server(GAE).

客户端基于OSGi.

The clients are OSGi based.

我有一个包含我的资源接口的共享包和一个包含将资源包装到ClientResource的代码的包.但是org.restlet捆绑软件不导入任何这些捆绑软件.我认为编辑org.restlet捆绑包的清单并手动导入共享捆绑包不是正确的解决方案.这也是一个非常静态的解决方案.

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.

有没有更好的方法来导入这些接口,以便可以将它们包装到Restlet ClientResource中?

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]. ***

更新:由于共享包使用了一些来自org.restlet包的导入,因此它对清单的编辑无济于事.因此,当您尝试启动org.restlet捆绑包时,从共享捆绑包中导入的软件包会丢失.如果您首先启动共享捆绑软件,那么他会错过org.restlet中的软件包. (我希望我能解释清楚)

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)

推荐答案

我了解您的问题.我想出的最好的解决方案是在org.restlet清单文件(到目前为止为2.1.2)中添加"DynamicImport-Bundle:*".至少,这可以防止您产生循环依赖关系,并且不会在更改Restlet应用程序后强迫您手动调整导入.

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.

另请参阅: https://github.com/restlet/restlet-framework -java/issues/6

最诚挚的问候,西蒙

这篇关于导入包而不编辑org.restlet中的清单文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 08:03