关于JBOSS中配置JAAS(相当着急)
我前不久配过一次利用FORM验证,而且成功了,但是今天再配置的时候出现问题,总报异常
环境JBOSS 4.2.3GA mysql4.1
页面:<form method="POST" action="j_security_check">
用户名: <input type="text" name="j_username"/>
<br />
密码: <input type="password" name="j_password"/>
<br />
<input type="submit" value="登录"/>
</form>
在JBOSS中配置了MYSQL数据源,并且也设置了安全域
如下:
JBOSS-WEB.XML
<jboss-web>
<security-domain>mySecurity</security-domain>
</jboss-web>
安全域
<application-policy name = "mySecurity">
<authentication>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag = "required">
<module-option name = "unauthenticatedIdentity">AnonymousUser</module-option>
<module-option name = "dsJndiName">java:/MySqlDS</module-option>
<module-option name = "principalsQuery">SELECT PASSWD FROM JMS_USERS WHERE USERID=?</module-option>
<module-option name = "rolesQuery">SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?</module-option>
</login-module>
</authentication>
</application-policy>
数据源配置:
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/jbossdb</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>x</user-name>
<password>y</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- should only be used on drivers after 3.22.1 with "ping" support
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
-->
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<new-connection-sql>select * from jbossdb</new-connection-sql>
<!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
对应的表也设置正确.
但是在输入用户密码验证的时候报错
14:19:56,054 ERROR [JBossSecurityMgrRealm] Error during authenticate
javax.naming.NamingException: Could not dereference object [Root exception is ja
vax.naming.CommunicationException: Receive timed out [Root exception is java.net
.SocketTimeoutException: Receive timed out]]
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1215)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:758)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBos
sSecurityMgrRealm.java:488)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(Form
Authenticator.java:257)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:416)
我也不知道为什么,以前都没有出现,着急,请BANQ和高手解决下!!!!!!!!!!先谢谢了!