您好我正在使用注释来映射servlet而不是web.xml
,我试图使用objectify(我正在使用java8版本的谷歌应用程序引擎)从数据存储中检索实体,并且我正在使用静态块来注册实体(类)。Objectifyfilter的注释
I got this error:
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.
at com.googlecode.objectify.ObjectifyService.ofy(ObjectifyService.java:44)
我知道这一点,需要有物化在web.xml过滤器:在我的情况,我不使用(如下面的代码)的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>
Question:
我如何在注释中实现这种对象化过滤器?
在'web.xml'指定(下面的代码)客观化过滤器后' \t \t ObjectifyFilter过滤器名称> \t <滤波器级> com.googlecode.objectify.ObjectifyFilter <器/过滤器级> \t \t <滤波器映射> \t ObjectifyFilter过滤器名称> \t /* URL模式> \t过滤器映射> \t '我不能能开索引页(我得到'错误404' errror)@Sai Pullabhotla –
Prakash
'Error'-com.google.appengine.tools.development.jetty9 .LocalResourceFileServlet的doGet 警告:/指数 – Prakash
是否有误迎宾文件列表:未找到文件?在添加web.xml之前它工作吗? webapp中是否有资源“/ index”? –