1、打开jboss的standalone.xml,查看用户名和密码。
<datasourcejta="false" jndi-name="java:jboss/datasources/postgresDS"pool-name="postgresDS" enabled="true"use-ccm="false">
<connection-url>jdbc:postgresql://192.168.188.132:5432/postgres</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgres</driver>
<security>
<user-name>postgres</user-name>
<password>welcome1</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>2、产生密码文件:键入如下命令
java -cp/u01/app/jboss-eap-6.0/modules/org/picketbox/main/picketbox-4.0.14.Final-redhat-2.jar:/u01/app/jboss-eap-6.0/modules/org/jboss/logging/main/jboss-logging-3.1.2.GA-redhat-1.jar:$CLASSPATHorg.picketbox.datasource.security.SecureIdentityLoginModule welcome1
3、在standalone.xml的子系统secruity下加入标示2中的内容。
<security-domainname="PostgresDSRealm">
<authentication>
<login-modulecode="SecureIdentity" flag="required">
<module-option name="username" value="postgres"/>
<module-option name="password" value="3a71283f17004158df8592078de921bc"/>
<module-option name="managedConnectionFactoryName" value="jboss.jca:service=LocalTxCM,name=“postgresDS”
</login-module>
</authentication>
</security-domain>
…
</security-domains>
</subsystem>
4、在standalone.xml的子系统,修改security
修改步骤一的相应的节点
<security>
<security-domain>PostgresDSRealm</security-domain>
5、重启应用系统。
注意其中pool-name="postgresDS"和name=“postgresDS”相同,PostgresDSRealm两个设置的地方要一致。
如有问题可以联系q:843986029