Am 06.11.2014 um 18:09 schrieb Lukasz Lenart:
2014-11-06 18:00 GMT+01:00 Lukasz Lenart <lukaszlen...@apache.org>:
2014-11-06 17:02 GMT+01:00 Volker Krebs <volker.kr...@abas.de>:
I still have an odd behavior and can't figure out what has changed from
2.3.16.3 to 2.3.18
We have an Action with an service interface as class member.
Something like this pseudo Action:
public class EditAction extends ActionSupport implements Preparable {
protected MyService myService;
public void prepare() throws Exception {
myService = new MyServiceImpl();
}
public String execute() throws Exception {
myService.doSomething();
}
}
In 2.3.16.3 this works fine.
In 2.3.18 I get the following exception.
As you can see from the stack trace we're using spring integration plugin.
2014-11-06 03:14:05,040 ERROR [http-bio-60123-exec-5]
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler - Could not
create and/or set value back on to object
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'com.mycompany.interfaces.MyService': Could not resolve matching
constructor
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:238)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowire(AbstractAutowireCapableBeanFactory.java:308)
at
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:194)
at
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.createObject(InstantiatingNullHandler.java:163)
at
com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler.nullPropertyValue(InstantiatingNullHandler.java:137)
at
com.opensymphony.xwork2.ognl.OgnlNullHandlerWrapper.nullPropertyValue(OgnlNullHandlerWrapper.java:21)
at ognl.ASTProperty.getValueBody(ASTProperty.java:118)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
at ognl.SimpleNode.getValue(SimpleNode.java:258)
at ognl.ASTChain.setValueBody(ASTChain.java:222)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301)
at ognl.Ognl.setValue(Ognl.java:737)
at
com.opensymphony.xwork2.ognl.OgnlUtil$1.execute(OgnlUtil.java:287)
at
com.opensymphony.xwork2.ognl.OgnlUtil$1.execute(OgnlUtil.java:282)
at
com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute(OgnlUtil.java:340)
at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:282)
at
com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:185)
at
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:172)
at
com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:150)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:309)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:227)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
at
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)
at
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Any Ideas ?
Nope :( I was digging around but I don't see anything special. Can you
prepare a demo app or post more data?
Just note that the exception is logged in InstantiatingNullHandler
when it tries to create an object which is null and on which you want
set a value
Ok, it has to do with the acceptParamNames in ParametersInterceptor
I'll have the following config for my action:
<interceptor-ref name="params">
<param name="acceptParamNames">orderTimeID</param>
</interceptor-ref>
In my action I have a property named "orderinfo".
In 2.3.16.3 the ParametersInterceptor only set "orderTimeID".
Calls to "orderinfo" were blocked. This is what I was expecting, a pure
white list approach, block everything which is not "orderTimeID".
In 2.3.18 the ParametersInterceptor tried to set orderinfo. Only when
explicitly excluding it, everything worked as before.
<interceptor-ref name="params">
<param name="acceptParamNames">orderTimeID</param>
<param name="excludeParams">ordertime\..*</param>
</interceptor-ref>
Regards
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org