`

struts-portlet-plugin开发portlet时报错

阅读更多

异常:Exception occurred during processing request: null

08:36:23,796 ERROR [struts2.dispatcher.Dispatcher] Exception occurred during processing request: null
java.lang.NullPointerException
at org.apache.struts2.portlet.interceptor.PortletStateInterceptor.intercept(PortletStateInterceptor.java:49)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

 

 这个是使用struts-portel-plugin开发portlet时遇到的异常,主要原因是如下处的phase为空造成的。

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		PortletPhase phase = (PortletPhase) invocation.getInvocationContext().get(PortletConstants.PHASE);
		if (phase.isRender()) {
			restoreStack(invocation);
			return invocation.invoke();
		} else if (phase.isAction()) {
			try {
				return invocation.invoke();
			} finally {
				saveStack(invocation);
			}
		} else {
			return invocation.invoke();
		}
	}

 解决方法:用struts-portlet-plugin开发portlet时不能在web.xml中添加如下的struts过滤器,去掉即可了。

<!-- 	<filter> -->
<!-- 		<filter-name>struts2</filter-name> -->
<!-- 		<filter-class> -->
<!-- 			org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter -->
<!-- 		</filter-class> -->
<!-- 	</filter> -->

<!-- 	<filter-mapping> -->
<!-- 		<filter-name>struts2</filter-name> -->
<!-- 		<url-pattern>/*</url-pattern> -->
<!-- 	</filter-mapping> -->

 

1
3
分享到:
评论

相关推荐

    Struts2开发常用jar包

    plugin-2.5.10.1.jar,struts2-pell-multipart-plugin-2.5.10.1.jar,struts2-plexus-plugin-2.5.10.1.jar,struts2-portlet-plugin-2.5.10.1.jar,struts2-rest-plugin-2.5.10.1.jar,struts2-sitegraph-plugin-2.5...

    struts-2.3.30-all所有jar包

    struts2-portlet-plugin-2.3.30.jar, struts2-rest-plugin-2.3.30.jar, struts2-sitegraph-plugin-2.3.30.jar, struts2-sitemesh-plugin-2.3.30.jar, struts2-spring-plugin-2.3.30.jar, struts2-struts1-plugin-...

    struts2-portlet-plugin-2.1.6.jar

    struts2-portlet-plugin-2.1.6.jar

    struts2-portlet-plugin-2.1.8.1.jar

    在portlet 开发中用到struts2需要的jar文件

    struts-2.5.2-all所有jar包

    struts2-portlet-plugin-2.5.2.jar, struts2-rest-plugin-2.5.2.jar, struts2-sitegraph-plugin-2.5.2.jar, struts2-sitemesh-plugin-2.5.2.jar, struts2-spring-plugin-2.5.2.jar, struts2-testng-plugin-2.5.2.jar...

    struts-2.5.10-all所有jar包

    struts2-portlet-plugin-2.5.10.jar,struts2-rest-plugin-2.5.10.jar,struts2-sitegraph-plugin-2.5.10.jar,struts2-sitemesh-plugin-2.5.10.jar,struts2-spring-plugin-2.5.10.jar,struts2-testng-plugin-2.5.10....

    struts2集成portal框架liferay开发包

    Liferay2插件整合Struts2插件 struts2-portlet-plugin-2.2.1.jar

    271个java需要用的jar包

    struts2-portlet-plugin-2.3.15.3.jar struts2-rest-plugin-2.3.15.3.jar struts2-sitegraph-plugin-2.3.15.3.jar struts2-sitemesh-plugin-2.3.15.3.jar struts2-spring-plugin-2.3.15.3.jar struts2-struts1-...

    Struts2相关的jar包

    包含Struts2需要的全部jar:struts2-core-2.1.8.1.ja、struts2-portlet-plugin-2.1.8.1.jar、xwork-core-2.1.6.jar、ognl-2.7.3.jar、freemarker-2.3.15.jar、commons-fileupload-1.2.1.jar、antlr-2.7.2.jar等等 ...

    javaweb项目常用jar包

    spring-webmvc-portlet-4.1.6.RELEASE.jar spring-websocket-4.1.6.RELEASE.jar struts2-core-2.3.20.jar struts2-json-plugin-2.3.20.jar struts2-sitemesh-plugin-2.0.14.jar struts2-spring-plugin-2.3.20....

    ssh+mysql55jar包集合

    三大框架的jar包,能够跑得起来项目. /xscjManager/WebContent/WEB-INF/lib/.../xscjManager/WebContent/WEB-INF/lib/struts2-spring-plugin-2.2.3.jar /xscjManager/WebContent/WEB-INF/lib/xwork-core-2.3.4.1.jar

Global site tag (gtag.js) - Google Analytics