请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

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

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回答

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

0 回复 有任何疑惑可以回复我~
  • 提问者 passerbyYSQ #1
    我在webapps-italker目录下将ROOT.war解压后,并将ROOT.war暂时移到其他地方,然后重启tomcat。连index.jsp也访问不了,访问直接404。
    回复 有任何疑惑可以回复我~ 2020-02-25 09:31:40
  • 提问者 passerbyYSQ #2
    老师,我有点奇怪,这是上面报错日志中的一个路径,为什么路径中“ROOT.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.
    回复 有任何疑惑可以回复我~ 2020-02-25 09:44:28
  • Qiujuer 回复 提问者 passerbyYSQ #3
    你解压后的目录截图我看看,有些时候是目录错误了。
    回复 有任何疑惑可以回复我~ 2020-02-25 12:42:40
提问者 passerbyYSQ 2020-02-25 23:11:23

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

https://img1.sycdn.imooc.com//szimg/5e5538b2092897a616610900.jpg


https://img1.sycdn.imooc.com//szimg/5e5538d009ee88bb12590876.jpg


服务器上的hibernate配置文件

https://img1.sycdn.imooc.com//szimg/5e5538d009d1afe612670728.jpg

https://img1.sycdn.imooc.com//szimg/5e5538d0095c00e008450731.jpg


0 回复 有任何疑惑可以回复我~
  • 提问者 passerbyYSQ #1
    我把方言改为org.hibernate.dialect.MySQL8Dialect,重新试了一下,也是一样
    回复 有任何疑惑可以回复我~ 2020-02-25 23:36:54
  • 提问者 passerbyYSQ #2
    【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 02:08:20
提问者 passerbyYSQ 2020-02-25 13:40:09

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


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


https://img1.sycdn.imooc.com//szimg/5e54b28609dcd8ad06590309.jpg


https://img1.sycdn.imooc.com//szimg/5e54b287090756aa07410555.jpg

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

@Qiujuer


0 回复 有任何疑惑可以回复我~
  • Qiujuer #1
    你在talker中解压的时候,放到ROOT目录下。也就是使用ROOT包裹起来。
    回复 有任何疑惑可以回复我~ 2020-02-25 19:55:21
  • 提问者 passerbyYSQ 回复 Qiujuer #2
    老师,按照您说的,我改正之后又重新用DHC访问注册的API。又报空指针错误。报错截图和服务器上的hibernate配置文件的截图,我发在上面的回帖。   但是我在本地测试没问题,本地的mysql数据库是5.7,服务器上的mysql是8。
    回复 有任何疑惑可以回复我~ 2020-02-25 23:14:53
  • Qiujuer 回复 提问者 passerbyYSQ #3
    方便私聊发我ip之类的么。我帮你看看。
    回复 有任何疑惑可以回复我~ 2020-02-26 09:55:13
提问者 passerbyYSQ 2020-02-24 14:17:12

本地测试正常

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信