*(紧急)部署到阿里云服务器之后出现500错误,提示空指针异常**

来源:3-3 完成第一个Restful接口

qq_慕莱坞7599538

2020-05-24

  • HTTP Status 500 – Internal Server Error


    Type Exception Report

    Message java.lang.NullPointerException

    Description The server encountered an unexpected condition that prevented it from fulfilling the request.

    Exception

    javax.servlet.ServletException: java.lang.NullPointerException
      org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:434)
      org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:372)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    

Root Cause

java.lang.NullPointerException
	net.qiujuer.web.italker.push.utils.Hib.query(Hib.java:111)
	net.qiujuer.web.italker.push.factory.UserFactory.findByPhone(UserFactory.java:46)
	net.qiujuer.web.italker.push.service.AccountService.register(AccountService.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:498)
	org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:74)
	org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
	org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
	org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:247)
	org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
	org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:388)
	org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:346)
	org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
	org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:337)
	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:280)
	org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:316)
	org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1084)
	org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:418)
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:372)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
写回答

1回答

Qiujuer

2020-05-28

net.qiujuer.web.italker.push.factory.UserFactory.findByPhone(UserFactory.java:46)

错误在这一步发生的,可以定位一下这里的代码,核对一下看看是不是接收的参数异常之类的。

另外这里是数据库的操作,也需要核对一下是不是数据库的初始化异常了,比如没有链接到数据库之类的。

0
0

手把手开发完整的即时通讯App 客户端+服务端+MVP架构

客户端+服务端+MVP架构+封装思想+主流框架

1749 学习 · 872 问题

查看课程