Google Cloud Endpoint本地测试例外

时间:2021-12-03 20:19:01

While testing a Google cloud endpoint API using JS it always returned null. While investigating, I opened the API root URL in a new tab http://localhost:8888/_ah/api and the below exception was thrown:

在使用JS测试Google云端点API时,它始终返回null。在调查时,我在新选项卡http:// localhost:8888 / _ah / api中打开了API根URL,并抛出了以下异常:

HTTP ERROR 500

HTTP错误500

Problem accessing /_ah/api. Reason:

访问/ _ah / api时出现问题。原因:

String index out of range: 0

Caused by:

引起:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:658) at com.google.api.server.spi.tools.devserver.DevApiUtil.stripLeadingSlash(DevApiUtil.java:17) at com.google.api.server.spi.tools.devserver.RestApiServlet.service(RestApiServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366) at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349) at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:97) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:487) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Powered by Jetty://

java.lang.StringIndexOutOfBoundsException:字符串索引超出范围:在com.google.api.server.spi.tools.devserver.DevApiUtil.stripLeadingSlash(DevApiUtil.java)的java.lang.String.charAt(String.java:658)处为0 :17)位于org.mortbay的javax.servlet.http.HttpServlet.service(HttpServlet.java:717)的com.google.api.server.spi.tools.devserver.RestApiServlet.service(RestApiServlet.java:120)。 jetty.servlet.ServletHolder.handle(ServletHolder.java:511)位于com.google.appengine.api.socket.dev.DevSocketFilter的org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)。 doFilter(DevSocketFilter.java:74)位于com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)的org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)在com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerifica)的org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157) tionFilter.java:34)atg.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63) org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)位于org.mortbay.jetty.servlet的com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) .ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler) .java:1157)com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)com的com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)。 google.appengine.tools.development.DevAppServerModulesFilter.doFilter (devAppServerModulesFilter.java:116)org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)at org。位于org.mortbay.jetle上的orb.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)的mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)(ContextHandler。 java:765)atg.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)位于org.mortbay.jetty的com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:97) .handler.HandlerWrapper.handle(HandlerWrapper.java:152)at com.google.appengine.tools.development.JettyContainerService $ ApiProxyHandler.handle(JettyContainerService.java:487)at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper) .java:152)org.mortbay.jet.Server.handle(Server.java:326)org.mortbay.jetty.HttpConnection.handleRequest(HttpConne) ction.java:542)org.mortbay.jetty.HttpPctioner上org.mortbay.jet.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:923)org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)atg.mortbay.jetty.HttpParser org.mortbay上org.mortbay.io.SeleChannelEndPoint.run(SelectChannelEndPoint.java:409)的org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)上的.parseAvailable(HttpParser.java:212)。 thread.QueuedThreadPool $ PoolThread.run(QueuedThreadPool.java:582)由Jetty提供支持://

Any help is highly appreciated, thanks in advance!

任何帮助都非常感谢,提前感谢!

1 个解决方案

#1


0  

Have you tried http://localhost:8888/_ah/api/

你试过http:// localhost:8888 / _ah / api /

It seems that the devapiutil takes http://localhost:8888/_ah/api as base url without check and it checks what comes after. / character will tell that's your root.

似乎devapiutil将http:// localhost:8888 / _ah / api作为基本URL而没有检查,它检查后面的内容。 /字符会告诉你这是你的根。

see more:

查看更多:

Google appEngine: 404 when accesing /_ah/api

Google appEngine:404访问/ _ah / api时

#1


0  

Have you tried http://localhost:8888/_ah/api/

你试过http:// localhost:8888 / _ah / api /

It seems that the devapiutil takes http://localhost:8888/_ah/api as base url without check and it checks what comes after. / character will tell that's your root.

似乎devapiutil将http:// localhost:8888 / _ah / api作为基本URL而没有检查,它检查后面的内容。 /字符会告诉你这是你的根。

see more:

查看更多:

Google appEngine: 404 when accesing /_ah/api

Google appEngine:404访问/ _ah / api时