我在Netbeans官方网站上关注本教程:https://netbeans.org/kb/docs/websvc/rest.html#test-rest
我使用Netbeans 8,Tomcat 8,Java EE 7和MySQL
在我从数据库测试 RESTful Web服务之前,每件事情都有效,我的数据库名为文章,我收到此错误:
Etat HTTP 500 - java.lang.NullPointerException
type Rapport d''exception
message java.lang.NullPointerException
description Le serveur a rencontré une erreur interne qui l''a empêché de satisfaire la requête.
exception
javax.servlet.ServletException: java.lang.NullPointerException
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:392)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:382)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:345)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:220)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
cause mère
java.lang.NullPointerException
com.rest.service.AbstractFacade.findAll(AbstractFacade.java:41)
com.rest.service.ArticleFacadeREST.findAll(ArticleFacadeREST.java:66)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:497)
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:195)
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:402)
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349)
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259)
org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
org.glassfish.jersey.internal.Errors.process(Errors.java:315)
org.glassfish.jersey.internal.Errors.process(Errors.java:297)
org.glassfish.jersey.internal.Errors.process(Errors.java:267)
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236)
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1010)
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:382)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:345)
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:220)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/8.0.24.
Apache Tomcat/8.0.24
是的,有人能帮帮我吗?
答案 0 :(得分:0)
您收到的错误是HTTP 500错误,这意味着内部服务器错误,这反过来意味着您有一个未处理的异常。
根据您发布的信息,错误是(生成的)java代码中的空指针异常。
您的错误似乎与球衣库有关。从您的教程:
如果输出窗口显示一个或多个类的错误消息 无法存在且项目未构建,添加Jersey 库到编译时库。右键单击项目节点 并选择属性。在“属性”树菜单中,选择“库”。 单击添加库并浏览泽西岛库
可能与添加/设置的方式有关