当我尝试添加到队列时,它会给出此异常。它适用于开发但不适用于生产。
Caused by: java.lang.IllegalArgumentException: Invalid URL : null
at com.google.appengine.api.taskqueue.QueueApiHelper.translateError(QueueApiHelper.java:116)
at com.google.appengine.api.taskqueue.QueueImpl$2.wrap(QueueImpl.java:549)
at com.google.appengine.api.taskqueue.QueueImpl$2.wrap(QueueImpl.java:521)
at com.google.appengine.api.utils.FutureWrapper.wrapAndCache(FutureWrapper.java:53)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:90)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:86)
at com.google.appengine.api.taskqueue.QueueApiHelper.getInternal(QueueApiHelper.java:72)
at com.google.appengine.api.taskqueue.QueueImpl.add(QueueImpl.java:413)
at com.onixnet.sdm.server.SDMServiceImpl.sendEmails(SDMServiceImpl.java:155)
queue.add(withUrl("/worker").param("userId", Utils.getUserId()).param("storeType", storeType)
.param("associate", String.valueOf(associate)).param("fsm", String.valueOf(fsm)).param("sa", String.valueOf(sa))
.param("other1", String.valueOf(other1)).param("other1Str", other1Str).param("other2", String.valueOf(other2)).param("other2", other2Str)
.param("folder", folder).param("folderId", folderId)
.param("from", getUserEmail()).param("subject", subject).param("body", body)
.method(Method.GET));
<servlet>
<servlet-name>Worker</servlet-name>
<servlet-class>com.onixnet.sdm.server.WorkerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Worker</servlet-name>
<url-pattern>/worker</url-pattern>
</servlet-mapping>
<queue-entries>
<queue>
<name>default</name>
<rate>1/s</rate>
</queue>
</queue-entries>
https://developers.google.com/appengine/docs/java/taskqueue/overview-push
答案 0 :(得分:2)
我必须使用Method.POST
而不是GET
,并且在worker task servlet中,使用doPost()
。我相信这个请求对于GET来说太大了。问题是Google没有提供有用的错误消息,而是使用了一个神秘的消息。