将服务端部署到阿里云服务器,使用DHC访问API报错

来源:15-3 项目完善与展望-2

passerbyYSQ

2020-02-24

HTTP Status 500 – Internal Server Error
Type 异常报告

消息 Servlet.init() for servlet [ITalkerApiServlet] threw exception

描述 服务器遇到一个意外的情况,阻止它完成请求。

Exception

javax.servlet.ServletException: Servlet.init() for servlet [ITalkerApiServlet] threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
org.apache.coyote.AbstractProtocolConnectionHandler.process(AbstractProtocol.java:868)org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:868) org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:868)org.apache.tomcat.util.net.NioEndpointSocketProcessor.doRun(NioEndpoint.java:1639)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624)org.apache.tomcat.util.threads.TaskThreadWrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
Root Cause

A MultiException has 1 exceptions. They are:

  1. org.glassfish.jersey.server.internal.scanning.ResourceFinderException: The URI scheme war of the URI war:file:/opt/tomcat/apache-tomcat-9.0.31/webapps-italker/ROOT.war*/WEB-INF/classes/net/qiujuer/web/italker/push/service/ is not supported. Package scanning deployment is not supported for such URIs.
    Try using a different deployment mechanism such as explicitly declaring root resource and provider classes using an extension of javax.ws.rs.core.Application

    org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1085)
    org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:978)
    org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1082)
    org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1074)
    org.glassfish.jersey.hk2.HK2InjectionManager.createAndInitialize(HK2InjectionManager.java:201)
    org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:354)
    org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:316)
    org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:337)
    org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
    org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
    javax.servlet.GenericServlet.init(GenericServlet.java:158)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
    org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    org.apache.coyote.AbstractProtocolConnectionHandler.process(AbstractProtocol.java:868)org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:868) org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:868)org.apache.tomcat.util.net.NioEndpointSocketProcessor.doRun(NioEndpoint.java:1639)
    org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624)org.apache.tomcat.util.threads.TaskThreadWrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Thread.java:748)
    Root Cause

org.glassfish.jersey.server.internal.scanning.ResourceFinderException: The URI scheme war of the URI war:file:/opt/tomcat/apache-tomcat-9.0.31/webapps-italker/ROOT.war*/WEB-INF/classes/net/qiujuer/web/italker/push/service/ is not supported. Package scanning deployment is not supported for such URIs.
Try using a different deployment mechanism such as explicitly declaring root resource and provider classes using an extension of javax.ws.rs.core.Application
org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.addResourceFinder(PackageNamesScanner.java:284)
org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.init(PackageNamesScanner.java:198)
org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.(PackageNamesScanner.java:154)
org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.(PackageNamesScanner.java:110)
org.glassfish.jersey.server.ResourceConfig.packages(ResourceConfig.java:674)
org.glassfish.jersey.server.ResourceConfig.packages(ResourceConfig.java:654)
net.qiujuer.web.italker.push.Application.(Application.java:20)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1375)
org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1083)
org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:978)
org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1082)
org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1074)
org.glassfish.jersey.hk2.HK2InjectionManager.createAndInitialize(HK2InjectionManager.java:201)
org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:354)
org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:316)
org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:337)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
javax.servlet.GenericServlet.init(GenericServlet.java:158)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
org.apache.coyote.AbstractProtocolConnectionHandler.process(AbstractProtocol.java:868)org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:868) org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:868)org.apache.tomcat.util.net.NioEndpointSocketProcessor.doRun(NioEndpoint.java:1639)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624)org.apache.tomcat.util.threads.TaskThreadWrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
):注意 主要问题的全部 stack 信息可以在 server logs 里查看

Apache Tomcat/9.0.31

想试一下注册的API,报如上错误

写回答

4回答

Qiujuer

2020-02-24

你将PUSH到服务器的war放到目录后,手动解压一下,然后重启服务器看看。

0
5
passerbyYSQ
回复
Qiujuer
老师,我已经把截图发在【回帖】里面了
2020-02-25
共5条回复

passerbyYSQ

提问者

2020-02-25

出现了另外的异常,空指针异常,【在本地测试正常,没问题】

//img.mukewang.com/szimg/5e5538b2092897a616610900.jpg


//img.mukewang.com/szimg/5e5538d009ee88bb12590876.jpg


服务器上的hibernate配置文件

//img.mukewang.com/szimg/5e5538d009d1afe612670728.jpg

//img.mukewang.com/szimg/5e5538d0095c00e008450731.jpg


0
2
passerbyYSQ
【mysql8的驱动jar包】我突然发现服务器上的war包里面的mysql驱动jar包还是5点几。 ||| 于是我想通过gradle依赖下载最新的驱动jar包,但是idea下载不了。我从其他途径下载了mysql-connector-java-8.0.19,传输到服务器上,然后拷贝到对应的webapps-italker/ROOT/WEB-INF/lib/下面。 ||| 重启tomcat后,访问index.jsp直接404。 ||| 心态炸裂。老师,我能不能在qq发你远程登录的账户和密码,您能不能帮我上去看一看??? o(╥﹏╥)o
2020-02-26
共2条回复

passerbyYSQ

提问者

2020-02-25

//img1.sycdn.imooc.com/szimg/5e54b286093224cb06590190.jpg


//img1.sycdn.imooc.com/szimg/5e54b286097762ca05960171.jpg


//img.mukewang.com/szimg/5e54b28609dcd8ad06590309.jpg


//img.mukewang.com/szimg/5e54b287090756aa07410555.jpg

----------------------

@Qiujuer


0
7
Qiujuer
回复
passerbyYSQ
明白了,应该是这样的,自己下载的包,在打包的时候并未正确打包到war中去。使用gradel打包的则会。 总结起来就是war包有缺失,所以直接崩溃了。
2020-03-02
共7条回复

passerbyYSQ

提问者

2020-02-24

本地测试正常

0
0

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

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

1749 学习 · 872 问题

查看课程