java.lang.ClassCastException:无法将 org.glassfish.web.loader.WebappClassLoader 转换为 org.osgi.framework.BundleReference
我正在使用 Glassfish 和 OSGI 开发一个简单的应用程序。我找到了这个教程: http://blogs.oracle.com/arungupta/entry/totd_154_dynamic_osgi_services 我修改了这个例子。您可以找到我定制的示例文件: http://uploading.com/files/cf1ffd63/test.zip/ 我使用 Web 模块和 EJB 模块创建了 EAR 包。我创建了一个调用 OSGI 包的会话 bean。我成功编译了该项目。问题是,当我将包上传到 Glassfish 应用程序服务器并尝试在 Web 模块中打开简单小程序时,会出现此错误消息:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.ClassCastException: Cannot cast org.glassfish.web.loader.WebappClassLoader to org.osgi.framework.BundleReference
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.1 logs.
GlassFish Server Open Source Edition 3.1.1
也许问题在于缺少依赖项。我找不到问题?您知道可能是什么问题吗?
I'm working on a simple application with Glassfish and OSGI. I found this tutorial:
http://blogs.oracle.com/arungupta/entry/totd_154_dynamic_osgi_services
I modified the example. You can find my customized example file:
http://uploading.com/files/cf1ffd63/test.zip/
I created EAR package with web module and EJB module. I created a session bean which calls the OSGI bundle. I successfully compiled the project. The problem is that when i uploaded the packages into Glassfish application server and tried to open the simple applet into the web module this error message appears:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.ClassCastException: Cannot cast org.glassfish.web.loader.WebappClassLoader to org.osgi.framework.BundleReference
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.1.1 logs.
GlassFish Server Open Source Edition 3.1.1
Maybe the problem is missing dependency. I can't find the problem? Do you have any idea what may be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
OSGi Core 4.2 规范 (org.osgi.framework;version=1.5) 的第 3.8.9 节要求所有捆绑包类加载器必须实现 BundleReference 接口。也许 GlassFish 中的类加载器不会执行此操作?您的 GlassFish 版本支持哪个版本的 OSGi Core 规范?
Section 3.8.9 of the OSGi Core 4.2 spec (org.osgi.framework;version=1.5) requires that all bundle class loaders must implement the BundleReference interface. Perhaps the class loader in GlassFish does not do this? What version of the OSGi Core spec does your version of GlassFish support?
您不应该将应用程序部署为耳朵,两个模块必须单独部署为 OSGi 包
You shouldn'tdeploy the app as an ear, both modules must be deployed separately as OSGi bundles