java 嵌入式 http server,com.sun.net.httpserver.HttpHandler ClassNotFound Java嵌入式运行时环境异常...

i am trying to run restlet on an ejre. In eclipse with normal jre the code works absolutely fine, but in the ejre i get the following exception:

java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler cannot be found

I am using restlet v. 2.2.1. for jee and Java SE Embedded Runtime Environment (build 1.7.0_21-b11, headless) Java HotSpot Embedded Client VM (build 23.21-b01, mixed mode)

I tried restlet v. 2.1. as mentioned in here but it did not work.

Had someone a similar problem?

解决方案

I have to explain a few things before (partly) answering your question.

Restlet Framework provides an API and an implementation, and we try to provide them in multiple environments (classical JVM, servlet container, android, gwt, gae). As these environments supports only parts of the JDKs (GWT hates server code for example), we address this constraint by providing what we call "editions" of the framework (cf http://restlet.com/learn/guide/2.2/editions/).

In the context of the ejre, I understand that the internal server connector based on the JDK lightweight server is not supported.

In order to help you we can introduce a new edition (cf this ticket https://github.com/restlet/restlet-framework-java/issues/939).

As I'm not sure to be able to provide it shortly, I would like to know if you intend to run an HTTP server inside the JVM, or if you just want to issue client requests.

In this case, you may try to run these instructions before (not tested):

org.restlet.engine.Engine.register(false);

Engine.getInstance().getRegisteredClients().add(new org.restlet.engine.connector.HttpClientHelper(null));

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值