You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Filippov, Andrey" <an...@t-systems.ru> on 2007/11/07 14:50:50 UTC

struts2 + jaas on jboss...

Hi everybody! 

I have this problem - I could not manage to configure it to work together. Does someone happen to know how to do it? I appriciate any kind of information!! 
Initially I used the following source: http://www.javaworld.com/javaforums/showthreaded.php?Cat=2&Number=2500&page=0
And I have the following:

jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<security-domain>java:/jaas/dbStrutsRealm</security-domain>
</jboss-web>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
snippet from login-config.xml

<application-policy name = "dbStrutsRealm">
   <authentication>
   <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
         flag = "required">
         <module-option name = "dsJndiName">java:/FilStrutsDS</module-option>
         <module-option name = "principalsQuery">
               select password from test_login where login_name=?
         </module-option>
         <module-option name = "rolesQuery">
               SELECT role_name, 'Roles' FROM user_in_roles INNER JOIN roles ON user_in_roles.role=roles.id where user_in_roles.user=? 
         </module-option>
         <module-option name = "debug">true</module-option>
   </login-module>
   </authentication>
</application-policy>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
snippet from web.xml
	<security-constraint>
	  <web-resource-collection>	
		<web-resource-name>
			action
		</web-resource-name>
		<description>
			Struts security test
		</description>
		<url-pattern>/Logout.action</url-pattern>
		<http-method>HEAD</http-method>
		<http-method>GET</http-method>
		<http-method>POST</http-method>
		<http-method>PUT</http-method>
		<http-method>DELETE</http-method>
	  </web-resource-collection>
	  <auth-constraint>
	  	<role-name>access</role-name>
	  </auth-constraint>
	  <user-data-constraint>
	  	<description>
			noo
		</description>
		<transport-guarantee>
			NONE
		</transport-guarantee>
	  </user-data-constraint>	
	</security-constraint>


	<login-config>
		<auth-method>FORM</auth-method>
		<realm-name>struts_test</realm-name>
		<form-login-config>
			<form-login-page>/Login.action</form-login-page>
			<form-error-page>/jsp/Login_error.jsp</form-error-page>
		</form-login-config>
	</login-config>
	
	<security-role>
		<description/>
		<role-name>access</role-name>
	</security-role>
	<security-role>
		<description/>
		<role-name>rejection</role-name>
	</security-role>
	<security-role>
		<description/>
		<role-name>misc</role-name>
	</security-role>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
snippet from struts.xml

<package name="login" namespace="/login" extends="struts-default" >
<result-types> 
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/> 
</result-types>
<action name="Login">
<result>/jsp/Login.jsp</result>
</action>
<action name="Login1" class="com.fil.struts.login.SessionLogin">
<result name="ERROR">/jsp/Login.jsp</result>
<result type="tiles" name="SUCCESS">success</result>
</action>
<action name="Logout" class="com.fil.struts.login.SessionLogout">
<result name="SUCCESS">/jsp/Login.jsp</result>
</action>
<!-- Add actions here -->
</package>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
snippet from login.jsp
<form name="logonForm" action="Login1.action" method="POST">
    	<table>
        <tr>
			<td colspan="2">
				Login
			</td>

		</tr>

  		<tr>
   			<td colspan="2">
         		<input type="text" name="j_username" SIZE=25/><br>
      			<input type="password" name="j_password" SIZE=25/><br>
      			<input type="submit" onclick="javascript:submitForm();" value="Login"/>	
   			</td>
  		</tr>
  		</table>     
    </form>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Finally, when I submit the mentioned in the login.jsp form I get the following message:

Struts Problem Report
Struts has detected an unhandled exception: 
Messages:	No result defined for action com.fil.struts.login.SessionLogin and result input 	
File:	file:/C:/jboss-4.0.5.GA/server/default/./tmp/deploy/tmp15883StrutsSessionLogIn-exp.war/WEB-INF/classes/struts.xml	
Line number:	25	
Column number:	65	

<action name="Login1" class="com.fil.struts.login.SessionLogin">
<result name="ERROR">/jsp/Login.jsp</result>
<result type="tiles" name="SUCCESS">success</result>

Stacktraces
No result defined for action com.fil.struts.login.SessionLogin and result input - action - file:/C:/jboss-4.0.5.GA/server/default/./tmp/deploy/tmp15883StrutsSessionLogIn-exp.war/WEB-INF/classes/struts.xml:25:65 
    com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:350)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
    com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
    com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)


What I am doing wrong? Please correct me!!
Thanx a lot.





Sincerely yours,
Andrey V. Filippov


Sincerely yours,
Andrey V. Filippov