Google App Engine for Java
这里看GAE支持的java框架/技术/语言 列表
http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine
然后是让Struts2运行在gae上的方法
这里有2个相关资料
http://groups.google.com/group/google-appengine-java/browse_thread/thread/19018b0317f27817/ec19c458bb15413b?lnk=gst&q=struts2#ec19c458bb15413b
http://www.nabble.com/Google-App-Engine-support--td22972179.html
只看下文也可以
使用Struts2时候报异常
WARNING: Caught OgnlException while setting property 'location' on type 'org.apache.struts2.dispatcher.ServletDispatcherResult'. java.lang.IllegalAccessException: Method [public void org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.String)] cannot be accessed. at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508) at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
SEVERE: ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'name' on 'class com.ociweb.gaestruts2.HelloAction: Error setting expression 'name' with value '[Ljava.lang.String;@24de7d'
解决方法:
1. 建class如下
package com.jun.util.listener; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.http.HttpSessionAttributeListener; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import ognl.OgnlRuntime; /** * 为了让Struts2能在AppEngine上运行,因此要在web.xml中添加这个监听 ** */ public class InitListener implements ServletContextListener, HttpSessionListener, HttpSessionAttributeListener { public InitListener() { } public void contextInitialized(ServletContextEvent sce) { OgnlRuntime.setSecurityManager(null); } public void contextDestroyed(ServletContextEvent arg0) { // TODO Auto-generated method stub } public void sessionCreated(HttpSessionEvent arg0) { // TODO Auto-generated method stub } public void sessionDestroyed(HttpSessionEvent arg0) { // TODO Auto-generated method stub } public void attributeAdded(HttpSessionBindingEvent arg0) { // TODO Auto-generated method stub } public void attributeRemoved(HttpSessionBindingEvent arg0) { // TODO Auto-generated method stub } public void attributeReplaced(HttpSessionBindingEvent arg0) { // TODO Auto-generated method stub } }
2.web.xm配置监听器
<listener> <listener-class>com.jun.util.listener.InitListener</listener-class> </listener>
此时再运行你的struts2项目就行了
