2

Here is my struts.xml file

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>

<constant name="struts.devMode" value="true" /> 
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />  

<package name="Authentiate" extends="struts-default">

<global-results>

<result name="error">/error.jsp</result>

</global-results>

<action name="loginAuthenticate*" class="com.authenticate.actions.LoginAuthenticate" method="{1}">

<result name="success">/welcome.jsp</result>
<result name="error">/error.jsp</result>
<result name="redirectRegister" type="redirect">/registration.jsp</result>

</action>

</package>

I haven't used velocity templates but I am getting the following error.

java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=org.apache.struts2.views.velocity.VelocityManager, name='default'] in public void org.apache.struts2.osgi.OsgiConfigurationProvider.setVelocityManager(org.apache.struts2.views.velocity.VelocityManager). - Class: com.opensymphony.xwork2.inject.ContainerBuilder
Roman C
  • 49,761
  • 33
  • 66
  • 176
pavan
  • 334
  • 6
  • 20

2 Answers2

0

First of all try to point result type explicitly using default type dispatcher:

<result name="success" type="dispatcher">/welcome.jsp</result>
<result name="error" type="dispatcher">/error.jsp</result>
<result name="redirectRegister" type="redirect">/registration.jsp</result>

If this doesn't help, it looks like there are some struts dependencies that can't be resolved. According to this bug at apache's bugtracker you should add VelocityManager bean to your struts.xml:

<bean class="org.apache.struts2.views.velocity.VelocityManager" name="default" optional="true" />
Maxim Kolesnikov
  • 5,075
  • 6
  • 38
  • 68
0

This is really weird error. Fixed by removing spring-struts jar from dependencies.

Velocity is not necessary to add as a dependency if you are not using velocity templates in your results. By default Struts2 uses Freemarker templates.

Errors may not seen if your server not utilizing JMX, but if you run in JMX enabled appserver like JBOSS it might raise.

Roman C
  • 49,761
  • 33
  • 66
  • 176