OSGI中的Restlet找不到com/sun/net/httpserver/HttpHandler [英] Restlet in OSGI can not find com/sun/net/httpserver/HttpHandler

查看:178
本文介绍了OSGI中的Restlet找不到com/sun/net/httpserver/HttpHandler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在嵌入式OSGi环境中使用 Restlet .我在捆绑的restlet测试的类路径中添加了org.restlet.jar版本2.3.0.但是它一直给我以下错误.

I am trying to use Restlet in embedded OSGi environment. I have added the org.restlet.jar version 2.3.0 in the class path of my restlet test bundled. But it kept giving me the following error.

java.lang.NoClassDefFoundError: com/sun/net/httpserver/HttpHandler

文档说,这个jar应该足够了,但是目前不起作用.该捆绑包由 Equinox框架启动,该框架由独立的启动器启动,随后将在Eclipse环境之外使用.

The documentation says that this jar should be enough but it is currently not working. The bundle is started by an Equinox Framework which is started by a standalone launcher, later to be used outside of Eclipse environment.

是否应该添加另一个jar fie以获取正确的服务器连接器?我不会使用servlet,因此 Restlet 连接器是唯一的选择.

Is there another jar fie that I should add to get the proper server connector? I will not be using servlets so the Restlet connectors are the only options.

当我手动启动捆绑软件时,收到以下警告:

When I manually start the bundle I get the following warning:

WARNING: No available server connector supports the required protocols: 'HTTP' . Please add the JAR of a matching connector to your classpath.

我已经花了很多时间让它运转起来没有运气.预先感谢!

I had already spent a lot of time to get it working with no luck. Thanks in advance!

推荐答案

我在因此,包com.sun.net.httpserver(属于JDK的一部分)需要暴露给OSGi环境.对我而言,最好的解决方案是在框架启动期间通过将其添加到以下属性来通过系统捆绑包将其公开:

So the package com.sun.net.httpserver (which is part of the JDK) needs to be exposed to the OSGi environment. The best solution that has worked for me is to expose it through the system bundle during framework launch by adding it to the following property:

org.osgi.framework.system.packages.extra = com.sun.net.httpserver

如果在OSGi环境中使用自定义框架启动器使用Restlet,则添加上述解决方案将使该包可用于导入.我认为他们应该在文档中添加此信息.将Restlet安装在Eclipse中并使用Eclipse启动器直接在Eclipse环境中使用时,不会发生此问题,因为我认为配置将自动设置.

If you are using Restlet in an OSGi environment using a custom framework launcher, adding the above solution will make the package available for import. I think they should have added this information in their documentation. This problem does not occur when Restlet is installed in Eclipse and used directly in Eclipse environment using Eclipse launcher because I think the configuration will be automatically setup.

这篇关于OSGI中的Restlet找不到com/sun/net/httpserver/HttpHandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆