正确提取了图书馆?

时间:2018-03-05 20:02:40

标签: java jersey

几天前,我从Eclipse IDE切换到IntelliJ IDE。这是我第一次使用IntelliJ进行编码。我不知道如何描述我的问题。 :D问题出在哪里?我在我的Bungeecord-Proxy

中将此Java应用程序用作插件

堆栈跟踪:

  

20:46:16 [警告]加载插件时遇到异常:   CloudNet-RestAPI java.lang.ExceptionInInitializerError at   java.lang.Class.forName0(Native Method)at   java.lang.Class.forName(Class.java:264)at   com.sun.proxy。$ Proxy9。(未知来源)at   sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)     在   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)     在java.lang.reflect.Proxy.newProxyInstance(Proxy.java:739)at   com.sun.jersey.server.impl.application.WebApplicationImpl $ 26.run(WebApplicationImpl.java:1626)     在java.security.AccessController.doPrivileged(Native Method)at   com.sun.jersey.server.impl.application.WebApplicationImpl.createProxy(WebApplicationImpl.java:1623)     在   com.sun.jersey.server.impl.application.WebApplicationImpl。(WebApplicationImpl.java:335)     在   com.sun.jersey.server.impl.container.WebApplicationProviderImpl.createWebApplication(WebApplicationProviderImpl.java:55)     在   com.sun.jersey.spi.container.WebApplicationFactory.createWebApplication(WebApplicationFactory.java:66)     在   com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:160)     在   com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:264)     在   com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:246)     在   com.sun.jersey.api.container.httpserver.HttpServerFactory.create(HttpServerFactory.java:117)     在   com.sun.jersey.api.container.httpserver.HttpServerFactory.create(HttpServerFactory.java:92)     at me.singulativ.restapi.main.RestAPI.onEnable(RestAPI.java:17)at at   net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:227)     在net.md_5.bungee.BungeeCord.start(BungeeCord.java:266)at   net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:56)     在net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)引起:   java.lang.RuntimeException:java.lang.ClassNotFoundException:   com.sun.ws.rs.ext.RuntimeDelegateImpl at   javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:122)     在   javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:91)     在javax.ws.rs.core.EntityTag。(EntityTag.java:35)... 24   更多引起:java.lang.ClassNotFoundException:   com.sun.ws.rs.ext.RuntimeDelegateImpl at   net.md_5.bungee.api.plugin.PluginClassloader.loadClass0(PluginClassloader.java:53)     在   net.md_5.bungee.api.plugin.PluginClassloader.loadClass(PluginClassloader.java:27)     在java.lang.ClassLoader.loadClass(ClassLoader.java:357)at   java.lang.Class.forName0(Native Method)at   java.lang.Class.forName(Class.java:264)at   javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:62)at   javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:155)at at   javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:105)     ......还有26个

代码:

package me.singulativ.restapi.main;

import com.sun.jersey.api.container.httpserver.HttpServerFactory;
import com.sun.net.httpserver.HttpServer;
import net.md_5.bungee.api.plugin.Plugin;

import java.io.IOException;

public class RestAPI extends Plugin {

    private HttpServer server;

    @Override
    public void onEnable() {
        try {
            String host = "http://localhost:12345/";
            server = HttpServerFactory.create(host);
            server.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onDisable() {
        server.stop(0);
    }
}

Dependencies

Artifacts

0 个答案:

没有答案