Quantcast

Issue with Struts2 Submit action attribute in Struts2 and Rest Plugin

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue with Struts2 Submit action attribute in Struts2 and Rest Plugin

Kiran Kongala
Hi,

I have a Enterprise java application and we are using Struts1.2 &
 struts2-core-2.3.14.jar and everything is fine.

But now I want to use the Rest Plugin and I copied the rest plugin
(struts2-rest-plugin-2.3.14.jar) and made the below changes in the
Struts.xml file. Currently I am not using the Struts Convention plugin.

<constant name=*"struts.devMode"* value=*"false"*/>

<constant name=*"struts.action.extension"* value=*"xhtml,,xml,json,action"*
/>

<constant name=*"struts.mapper.class"* value=
*"org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"* />

<constant name=*"struts.mapper.prefixMapping"* value=*"/rest:rest,:struts"*
/>

I haven't written any Rest Code yet. All the links are working.

But I get the below error in some of the JSPs(NullPointerException).











*java.lang.NullPointerException        at
org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper.getUriFromActionMapping(PrefixBasedActionMapper.java:116)
at
org.apache.struts2.components.FormButton.evaluateExtraParams(FormButton.java:83)
at
org.apache.struts2.components.Submit.evaluateExtraParams(Submit.java:86)
at
org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:876)
at
org.apache.struts2.components.Submit.evaluateParams(Submit.java:82)
at org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:55)*


That JSP has copule of submit buttons and below is the code.


*<s:submit type="button" label="Update Member Info"
action="updateRequestInformation"                          onclick="return
onCheckRequestInfo();" id="btnUpdMemberInfo" cssClass="cpslink">
</s:submit>*

When I remove the action attribute from the s:submit, I don't get the error
but when I add the action attribute I am getting the error.

I have lot of jsps which has lot of submit buttons with action attributes.


 I was reading on the stackoverflow and some one suggested to override the
below constant in the struts.xml file but didn't help.

*<constant name="struts.mapper.action.prefix.enabled" value="true" />*



Please share your ideas. Is there a way other than changing the Struts
Submit button

Thanks


*Complete Log Information Below*


2017-02-28 13:32:00,519 ERROR [[ACTIVE] ExecuteThread: '0' for queue:
'weblogic.
kernel.Default (self-tuning)'] (CommonsLogger.java:38) - Could not open
template










*java.lang.NullPointerException        at
org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper.getUriFromActionMapping(PrefixBasedActionMapper.java:116)
at
org.apache.struts2.components.FormButton.evaluateExtraParams(FormButton.java:83)
at
org.apache.struts2.components.Submit.evaluateExtraParams(Submit.java:86)
at
org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:876)
at
org.apache.struts2.components.Submit.evaluateParams(Submit.java:82)
at org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:55)*
        at org.apache.struts2.views.jsp.ComponentTagSupport.
doStartTag(Component
TagSupport.java:53)
        at jsp_servlet._jsp2._originalrequest.__
nextrequesttowork._jsp__tag44(__
nextrequesttowork.java:2354)
        at jsp_servlet._jsp2._originalrequest.__
nextrequesttowork._jsp__tag43(__
nextrequesttowork.java:2311)
        at jsp_servlet._jsp2._originalrequest.__
nextrequesttowork._jsp__tag35(__
nextrequesttowork.java:1980)
        at jsp_servlet._jsp2._originalrequest.__
nextrequesttowork._jsp__tag34(__
nextrequesttowork.java:1901)
        at jsp_servlet._jsp2._originalrequest.__
nextrequesttowork._jsp__tag7(__n
extrequesttowork.java:924)
        at jsp_servlet._jsp2._originalrequest.__
nextrequesttowork._jspService(__
nextrequesttowork.java:303)
        at weblogic.servlet.jsp.JspBase.service(JspBase.java:35)
        at weblogic.servlet.internal.StubSecurityHelper$
ServletServiceAction.run
(StubSecurityHelper.java:286)
        at weblogic.servlet.internal.StubSecurityHelper$
ServletServiceAction.run
(StubSecurityHelper.java:260)
        at weblogic.servlet.internal.StubSecurityHelper.
invokeServlet(StubSecuri
tyHelper.java:137)
        at weblogic.servlet.internal.ServletStubImpl.execute(
ServletStubImpl.jav
a:350)
        at weblogic.servlet.internal.ServletStubImpl.
onAddToMapException(Servlet
StubImpl.java:489)
        at weblogic.servlet.internal.ServletStubImpl.execute(
ServletStubImpl.jav
a:376)
        at weblogic.servlet.internal.ServletStubImpl.execute(
ServletStubImpl.jav
a:247)
        at weblogic.servlet.internal.RequestDispatcherImpl.
invokeServlet(Request
DispatcherImpl.java:612)
        at weblogic.servlet.internal.RequestDispatcherImpl.include(
RequestDispat
cherImpl.java:483)
        at weblogic.servlet.jsp.PageContextImpl.include(
PageContextImpl.java:161
)
        at weblogic.servlet.jsp.PageContextImpl.include(
PageContextImpl.java:182
)
        at org.apache.tiles.jsp.context.JspTilesRequestContext.
include(JspTilesR
equestContext.java:80)
        at org.apache.tiles.jsp.context.JspTilesRequestContext.
dispatch(JspTiles
RequestContext.java:73)
        at org.apache.tiles.context.TilesRequestContextWrapper.
dispatch(TilesReq
uestContextWrapper.java:72)
        at org.apache.struts2.tiles.StrutsTilesRequestContext.
dispatch(StrutsTil
esRequestContext.java:84)
        at org.apache.tiles.impl.BasicTilesContainer.render(
BasicTilesContainer.
java:283)
        at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(
InsertAttribute
Tag.java:140)
        at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(
InsertAttribute
Tag.java:117)
        at org.apache.tiles.jsp.taglib.RenderTagSupport.execute(
RenderTagSupport
.java:154)
        at org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.
doEndTag(RoleSecur
ityTagSupport.java:75)
        at org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(
ContainerTag
Support.java:80)
        at jsp_servlet._jsp2._layout.__baselayout2._jsp__tag29(__
baselayout2.jav
a:1419)
        at jsp_servlet._jsp2._layout.__baselayout2._jspService(__
baselayout2.jav
a:299)
        at weblogic.servlet.jsp.JspBase.service(JspBase.java:35)
        at weblogic.servlet.internal.StubSecurityHelper$
ServletServiceAction.run
(StubSecurityHelper.java:286)
        at weblogic.servlet.internal.StubSecurityHelper$
ServletServiceAction.run
(StubSecurityHelper.java:260)
        at weblogic.servlet.internal.StubSecurityHelper.
invokeServlet(StubSecuri
tyHelper.java:137)
        at weblogic.servlet.internal.ServletStubImpl.execute(
ServletStubImpl.jav
a:350)
        at weblogic.servlet.internal.ServletStubImpl.
onAddToMapException(Servlet
StubImpl.java:489)
        at weblogic.servlet.internal.ServletStubImpl.execute(
ServletStubImpl.jav
a:376)
        at weblogic.servlet.internal.ServletStubImpl.execute(
ServletStubImpl.jav
a:247)
        at weblogic.servlet.internal.RequestDispatcherImpl.
invokeServlet(Request
DispatcherImpl.java:612)
        at weblogic.servlet.internal.RequestDispatcherImpl.forward(
RequestDispat
cherImpl.java:275)
        at org.apache.tiles.servlet.context.ServletTilesRequestContext.
forward(S
ervletTilesRequestContext.java:198)
        at org.apache.tiles.servlet.context.ServletTilesRequestContext.
dispatch(
ServletTilesRequestContext.java:179)
        at org.apache.tiles.context.TilesRequestContextWrapper.
dispatch(TilesReq
uestContextWrapper.java:72)
        at org.apache.struts2.tiles.StrutsTilesRequestContext.
dispatch(StrutsTil
esRequestContext.java:84)
        at org.apache.tiles.impl.BasicTilesContainer.render(
BasicTilesContainer.
java:606)
        at org.apache.tiles.impl.BasicTilesContainer.render(
BasicTilesContainer.
java:246)
        at org.apache.struts2.views.tiles.TilesResult.doExecute(
TilesResult.java
:105)
        at org.apache.struts2.dispatcher.StrutsResultSupport.execute(
StrutsResul
tSupport.java:186)
        at org.apache.struts2.rest.RestActionInvocation.
executeResult(RestAction
Invocation.java:240)
        at org.apache.struts2.rest.RestActionInvocation.
processResult(RestAction
Invocation.java:197)
        at org.apache.struts2.rest.RestActionInvocation.invoke(
RestActionInvocat
ion.java:145)
        at com.opensymphony.xwork2.DefaultActionProxy.execute(
DefaultActionProxy
.java:147)
        at org.apache.struts2.dispatcher.Dispatcher.serviceAction(
Dispatcher.jav
a:546)
        at org.apache.struts2.dispatcher.ng.ExecuteOperations.
executeAction(Exec
uteOperations.java:77)
        at org.apache.struts2.dispatcher.ng.filter.
StrutsPrepareAndExecuteFilter
.doFilter(StrutsPrepareAndExecuteFilter.java:91)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(
FilterChainImpl.ja
va:78)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(
RequestEventsF
ilter.java:32)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(
FilterChainImpl.ja
va:78)
        at weblogic.servlet.internal.WebAppServletContext$
ServletInvocationActio
n.wrapRun(WebAppServletContext.java:3654)
        at weblogic.servlet.internal.WebAppServletContext$
ServletInvocationActio
n.run(WebAppServletContext.java:3620)
        at weblogic.security.acl.internal.AuthenticatedSubject.
doAs(Authenticate
dSubject.java:326)
        at weblogic.security.service.SecurityManager.
runAsForUserCode(SecurityMa
nager.java:196)
        at weblogic.servlet.provider.WlsSecurityProvider.
runAsForUserCode(WlsSec
urityProvider.java:203)
        at weblogic.servlet.provider.WlsSubjectHandle.run(
WlsSubjectHandle.java:
71)
        at weblogic.servlet.internal.WebAppServletContext.
doSecuredExecute(WebAp
pServletContext.java:2423)
        at weblogic.servlet.internal.WebAppServletContext.
securedExecute(WebAppS
ervletContext.java:2280)
        at weblogic.servlet.internal.WebAppServletContext.execute(
WebAppServletC
ontext.java:2258)
        at weblogic.servlet.internal.ServletRequestImpl.
runInternal(ServletReque
stImpl.java:1626)
        at weblogic.servlet.internal.ServletRequestImpl.run(
ServletRequestImpl.j
ava:1586)
        at weblogic.servlet.provider.ContainerSupportProviderImpl$
WlsRequestExec
utor.run(ContainerSupportProviderImpl.java:270)
        at weblogic.invocation.ComponentInvocationContextMana
ger._runAs(Componen
tInvocationContextManager.java:348)
        at weblogic.invocation.ComponentInvocationContextMana
ger.runAs(Component
InvocationContextManager.java:333)
        at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(
LivePartitio
nUtility.java:54)
        at weblogic.work.PartitionUtility.runWorkUnderContext(
PartitionUtility.j
ava:41)
        at weblogic.work.SelfTuningWorkManagerImpl.
runWorkUnderContext(SelfTunin
gWorkManagerImpl.java:617)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:397)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
2017-02-28 13:32:00,541 ERROR [[ACTIVE] ExecuteThread: '0' for queue:
'weblogic.
kernel.Default (self-tuning)'] (BasicTilesContainer.java:612) - Error
rendering
tile
Loading...