com.sun.net.httpserver.HttpHandler ClassNotFound Java嵌入式运行时环境异常 [英] com.sun.net.httpserver.HttpHandler ClassNotFound Exception on Java Embedded Runtime Environment

查看:473
本文介绍了com.sun.net.httpserver.HttpHandler ClassNotFound Java嵌入式运行时环境异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图在电话中运行restlet。在日常的正常jre代码工作绝对正常,但在ejre我得到以下例外:

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

我正在使用restlet v。2.2。 1。对于jee和Java SE嵌入式运行时环境(构建1.7.0_21-b11,无头)Java HotSpot嵌入式客户端虚拟机(构建23.21-b01,混合模式)

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)

我尝试了restlet v。2.1。如此处所述,但它没有起作用。


有人有类似的问题吗?

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

Had someone a similar problem?

推荐答案

我必须解释一些事情之前(部分地)回答你的问题。
Restlet框架提供了一个API和一个实现,我们尝试在多个环境(经典的JVM,servlet容器,android,gwt,gae)中提供它们。由于这些环境仅支持部分JDK(GWT讨厌服务器代码),我们通过提供我们所称的版本框架来解决这个约束(cf http://restlet.com/learn/guide/2.2/editions/ )。

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/).

在ejre的上下文中,我了解到,不支持基于JDK轻量级服务器的内部服务器连接器。
为了帮助您,我们可以介绍一个新版本(比较这张票 https://github.com/restlet/restlet-framework-java/issues/939 )。

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).

由于我不知道能否提供它很快,我想知道你是否打算在JVM内运行一个HTTP服务器,或者你只想发出客户端请求。
在这种情况下,您可能尝试在(未测试)之前运行这些说明:

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));

这篇关于com.sun.net.httpserver.HttpHandler ClassNotFound Java嵌入式运行时环境异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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