Jboss' JBOSS 015228:无法加载属性'在启动时

时间:2015-04-16 14:18:44

标签: java xml oracle jboss

我正在尝试使用基于表单的身份验证在Jboss EAP 6.3中使用Oracle 11g。 但无论输入是什么,登录都会失败。

我在standalone.xml中配置了一个安全域:

        <security-domain name="employee-rooster" cache-type="default">
            <authentication>
                <login-module code="Database" flag="required">
                    <module-option name="dsJndiName" value="java:jboss/datasources/OracleDS"/>
                    <module-option name="principalsQuery" value="SELECT PASSWORD FROM USERS WHERE USERNAME = ?"/>
                    <module-option name="rolesQuery" value="SELECT R.NAME, 'Roles' FROM USERS_ROLES UR INNER JOIN ROLES R ON R.ID = UR.ROLE_ID INNER JOIN USERS U ON U.ID = UR.USER_ID WHERE U.USERNAME = ?"/>
                </login-module>
            </authentication>
            <authorization>
                <policy-module code="admin" flag="required"/>
            </authorization>
            <audit>
                <provider-module code="LogAuditProvider"/>
            </audit>
        </security-domain>

配置应用程序web.xml:

<web-app>
    <security-constraint>
    <display-name>auth</display-name>
    <web-resource-collection>
    <web-resource-name>Secure Content</web-resource-name>
    <url-pattern>/register.do/this_is-it</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>admin</role-name>
    </auth-constraint>
    </security-constraint>

    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>employee-rooster</realm-name>
        <form-login-config>
            <form-login-page>/loginForm.jsp</form-login-page>
            <form-error-page>/loginError.jsp</form-error-page>
        </form-login-config>

    </login-config>
    <security-role>
        <role-name>admin</role-name>
    </security-role>
</web-app>

配置应用程序jboss-web.xml:

<jboss-web>
    <security-domain>employee-rooster</security-domain>
    <use-jboss-authorization>true</use-jboss-authorization>
</jboss-web>

并在import.sql中为我的表添加了一些值:

CREATE TABLE USERS (ID INT, USERNAME VARCHAR(32), PASSWORD VARCHAR(32));
CREATE TABLE ROLES (ID INT, NAME VARCHAR(20));
CREATE TABLE USERS_ROLES (USER_ID INT, ROLE_ID INT);

INSERT INTO USERS (ID, USERNAME, PASSWORD) VALUES (1, 'admin', 'admin');
INSERT INTO ROLES (ID, NAME) VALUES (1, 'admin');
INSERT INTO USERS_ROLES (USER_ID, ROLE_ID) VALUES (1,1);

INSERT INTO USERS (ID, USERNAME, PASSWORD) VALUES (2, 'guest', 'guest');
INSERT INTO ROLES (ID, NAME) VALUES (2, 'guest');
INSERT INTO USERS_ROLES (USER_ID, ROLE_ID) VALUES (2,2);

但是当我部署应用程序时,我收到此错误:

JBAS014777:   Services which failed to start:      service jboss.server.controll
er.management.security_realm.employee-rooster.properties_authentication: org.jbo
ss.msc.service.StartException in service jboss.server.controller.management.secu
rity_realm.employee-rooster.properties_authentication: JBAS015228: Unable to loa
d properties

登录总是失败,我怀疑这就是原因。 是什么导致了这个错误?

1 个答案:

答案 0 :(得分:0)

standalone.xml <security-realms>下,我有了这个:

    <security-realm name="employee-rooster">
        <authentication>
            <properties path="employee-rooster.properties"/>
        </authentication>
    </security-realm>

我删除了部件,错误消失了。令人尴尬,但我忘记了这段代码。