7

我正在尝试在 RESTlet文档上运行第一个服务器教程,但即使我将 jars 添加到我的类路径中,我也会遇到错误。我添加了 org.restlet.jar 和 org.restlet.ext.*

服务器的代码是:

package test;

import org.restlet.Server;
import org.restlet.data.Protocol;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;

public class Test extends ServerResource {  

    public static void main(String[] args) throws Exception {  
        // Create the HTTP server and listen on port 8182  
        new Server(Protocol.HTTP, 8182, Test.class).start();  
    }  

    @Get  
    public String toString() {  
        return "hello, world";  
    }  

}

我得到的错误是:

    11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.httpclient.HttpClientHelper
java.lang.NoClassDefFoundError: org/apache/http/conn/scheme/SocketFactory
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:488)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.scheme.SocketFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.javamail.JavaMailClientHelper
java.lang.NoClassDefFoundError: javax/mail/MessagingException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:488)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.jdbc.JdbcClientHelper
java.lang.NoClassDefFoundError: org/apache/commons/dbcp/ConnectionFactory
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:488)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.dbcp.ConnectionFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.lucene.SolrClientHelper
java.lang.NoClassDefFoundError: org/apache/solr/request/SolrRequestHandler
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:488)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.apache.solr.request.SolrRequestHandler
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.grizzly.HttpServerHelper
java.lang.NoClassDefFoundError: com/sun/grizzly/SelectorHandler
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: com.sun.grizzly.SelectorHandler
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.grizzly.HttpsServerHelper
java.lang.NoClassDefFoundError: com/sun/grizzly/SelectorHandler
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: com.sun.grizzly.SelectorHandler
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.jetty.AjpServerHelper
java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Connector
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Connector
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.jetty.HttpServerHelper
java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Connector
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Connector
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.jetty.HttpsServerHelper
java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Connector
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Connector
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.netty.HttpServerHelper
java.lang.NoClassDefFoundError: org/jboss/netty/channel/group/ChannelGroup
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.group.ChannelGroup
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.netty.HttpsServerHelper
java.lang.NoClassDefFoundError: org/jboss/netty/channel/group/ChannelGroup
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.group.ChannelGroup
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.simple.HttpServerHelper
java.lang.NoClassDefFoundError: org/simpleframework/http/core/Container
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.simpleframework.http.core.Container
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.simple.HttpsServerHelper
java.lang.NoClassDefFoundError: org/simpleframework/http/core/Container
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.getConstructor(Class.java:1657)
    at org.restlet.engine.Engine.registerHelper(Engine.java:716)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConnectors(Engine.java:490)
    at org.restlet.engine.Engine.<init>(Engine.java:333)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.simpleframework.http.core.Container
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 16 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.javamail.JavaMailConverter
java.lang.NoClassDefFoundError: javax/mail/MessagingException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    at org.restlet.engine.Engine.registerHelper(Engine.java:714)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConverters(Engine.java:501)
    at org.restlet.engine.Engine.<init>(Engine.java:337)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 17 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.jibx.JibxConverter
java.lang.NoClassDefFoundError: org/jibx/runtime/JiBXException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    at org.restlet.engine.Engine.registerHelper(Engine.java:714)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConverters(Engine.java:501)
    at org.restlet.engine.Engine.<init>(Engine.java:337)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.jibx.runtime.JiBXException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 17 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine registerHelper
INFO: Unable to register the helper org.restlet.ext.json.JsonConverter
java.lang.NoClassDefFoundError: org/json/JSONException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    at org.restlet.engine.Engine.registerHelper(Engine.java:714)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:749)
    at org.restlet.engine.Engine.registerHelpers(Engine.java:789)
    at org.restlet.engine.Engine.discoverConverters(Engine.java:501)
    at org.restlet.engine.Engine.<init>(Engine.java:337)
    at org.restlet.engine.Engine.register(Engine.java:248)
    at org.restlet.engine.Engine.register(Engine.java:237)
    at org.restlet.engine.Engine.getInstance(Engine.java:149)
    at org.restlet.Restlet.<init>(Restlet.java:99)
    at org.restlet.resource.Finder.<init>(Finder.java:147)
    at org.restlet.Server.<init>(Server.java:313)
    at test.Test.main(Test.java:12)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 17 more
11/01/2011 1:22:08 PM org.restlet.engine.Engine createHelper
WARNING: No available server connector supports the required protocols: 'HTTP' . Please add the JAR of a matching connector to your classpath.

我错过了什么?

4

4 回答 4

9

这是 Eclipse 问题,我必须删除所有 jar,只添加 org.restlet.jar 并清理项目。在我这样做之后,一切都按预期工作。

于 2011-01-11T02:01:23.270 回答
0

谢谢。我在 NetBeans IDE 中也遇​​到了同样的问题。我从项目库中删除了“org.restlet.ext.httpclient-2.1m1.jar”文件,此后没有任何错误。

于 2011-02-16T12:42:18.457 回答
0

只是为了更新它,从最新的restlet-jee-2.0.10/lib文件夹中只复制org.restlet.ext.servlet.jarand org.restlet.jar。这解决了 Eclipse 中的问题。

于 2011-10-14T17:56:18.973 回答
0

在 Eclipse 中将 /selectableRestWebComponent/src/services/FirstServerResource.java 作为 Web 组件运行后。在构建路径库中仅包含 org.restlet.jar。

确保你清理了项目,你可以在 Eclipse 项目选项卡中选中“自动构建”。

确保您有一个在后台运行或附加到 Eclipse 项目的服务器,例如 Apache tomcat 6.2。

控制台应显示消息“在端口 8182 上启动内部 [HTTP/1.1] 服务器”,而不是显示您在问题中显示的所有错误。

打开浏览器并转到 URL http://'localserverIPaddress':8182/test/tutorial,您应该会看到 hello, world 显示。

于 2014-01-02T19:47:10.820 回答