[英]503 Service Unavailable for google endpoints
我正在使用端点尝试为我的Web应用程序创建患者实体。 当我尝试运行API时,我不断收到以下错误代码。
503 Service Unavailable
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "java.lang.IllegalStateException: You have not started an Objectify context. You are probably missing the ObjectifyFilter. If you are not running in the context of an http request, see the ObjectifyService.run() method."
}
],
"code": 503,
"message": "java.lang.IllegalStateException: You have not started an Objectify context. You are probably missing the ObjectifyFilter. If you are not running in the context of an http request, see the ObjectifyService.run() method."
}
}
我知道这与static ofy文件有关,我不确定如何向其中添加过滤器。 这是我的静态对象化文件的代码。
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;
public class OfyService
{
public static Objectify ofy()
{
return ObjectifyService.ofy();
}
}
然后我通过在API类中使用此方法来调用ofy文件
ofy().save().entity(patient).now();
将此代码添加到您的web.xml
<filter>
<filter-name>ObjectifyFilter</filter-name>
<filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ObjectifyFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.