struts-default.xml has incorrect bean values for Velocity view
--------------------------------------------------------------
Key: WW-2391
URL: https://issues.apache.org/struts/browse/WW-2391
Project: Struts 2
Issue Type: Bug
Components: XML Configuration
Affects Versions: 2.0.11
Environment: Velocity 1.5
Reporter: Richard T. Feak
Using Struts2 version 2.0.11, and velocity 1.5...
If you create an action with a VelocityResult, there is an error when
instantiating the VelocityResult due to the bean configuration in the
struts-default.xml. This is what the error looks like:
No mapping found for dependency
[type=org.apache.struts2.views.velocity.VelocityManager, name='default'] in
public void
org.apache.struts2.dispatcher.VelocityResult.setVelocityManager(org.apache.struts2.views.velocity.VelocityManager)
Adding a bean in your custom struts.xml like this:
<bean class="org.apache.struts2.views.velocity.VelocityManager" name="default"
optional="true" />
seems to address the issue.
Looking at the struts-default.xml there appears to be a mapping for this
already there, but the name attribute on the bean is marked as "struts". I
don't know if this is the source of the issue or not, but there does seem to be
a mismatch and creating the same bean with a different name does resolve the
issue.
Later investigation with the application revealed that this is *not*
necessarily a repeatable bug. I removed the bean entry from my custom
struts.xml and the problem didn't resurface. I had to pull the original
exception message from an older log. This would indicate to me that there me be
some sort of load/configuration time timing issue that makes this somewhat
indeterminate. Also note, there are a number of instances of this issue out on
various forums on the web with no answers which makes me think it is hard to
reproduce.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.