如何在Tomcat中调试领域功能? [英] How to debug realm feature in Tomcat?
问题描述
我已将server.xml主机部分中的域设置设置为以下内容:
I have set the realm setting in server.xml host section to something like this:
<Realm className="org.apache.catalina.realm.JDBCRealm" driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost:3306/test" connectionName="test" connectionPassword="test"
userTable="users" userNameCol="user_name" userCredCol="user_pass" userRoleTable="user_roles"
roleNameCol="user_role" />
同样在web.xml中:
Also in web.xml:
<security-role>
<role-name>ADMIN</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>critical</web-resource-name>
<url-pattern>/admin/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>ADMIN</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
我有数据库设置。但是当env熏制了login.jsp时,即使我输入了正确的密码,我也被重定向到error.jsp
And I have the databased set up. However when login.jsp is envoked, even I entered the right password I was redirected to error.jsp
我想知道是否有办法找到错误的过程中这个过程。我可以在Eclipse或任何其他可能解决问题的提示中执行此操作吗?
I want to know if there is a way to find what's wrong during the process. Can I do it in Eclipse or any other hints that may solve the problem?
推荐答案
从领域验证中获取调试信息步骤,请按照以下步骤操作。
To get the debug information form the Realm authentication steps, follow this procedure.
定义Realm时,请在定义中添加debug =9。
When you define your Realm, add debug="9" to the definition.
您还需要将其添加到logging.properties文件中:
You also need to add this to your logging.properties file:
org.apache.catalina.realm.level = ALL
org.apache.catalina.realm.useParentHandlers = true
org.apache.catalina.authenticator.level = ALL
org.apache.catalina.authenticator.useParentHandlers = true
您可能还需要添加此项,以防止缓冲日志。如果你这样做,请记得在完成调试后将其删除。
You may also need to add this, to prevent bufferring of the logs. If you do, remember to remove it after you've finished debugging.
1catalina.org.apache.juli.FileHandler.bufferSize = -1
现在,领域的调试日志应该最终出现在catalina.out文件中。
Now, the debug logs for the realms should end up in the catalina.out file.
这篇关于如何在Tomcat中调试领域功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!