4 Replies Latest reply on Mar 12, 2004 8:03 AM by alisson

    Configuring login_config.xml

    alisson

      I have configured everything in my application to add security with JAAS but when my application-policy (in login_config.xml) is configured the JBoss present this message during run. Anybody knows what is happening? Any application-policy defined by me causes this error, even if I copy the "other" application-policy and rename it to "anything" Is it any JBoss configuration error?

      11:05:48,218 WARN [XMLLoginConfigImpl] Failed to load config: file:/C:/JBoss/server/teste/conf/login-config.xml
      org.jboss.security.auth.login.ParseException: Encountered "<?xml" at line 1, column 1.
      Was expecting one of:

      ...

      at org.jboss.security.auth.login.SunConfigParser.generateParseException(SunConfigParser.java:389)
      at org.jboss.security.auth.login.SunConfigParser.jj_consume_token(SunConfigParser.java:327)
      at org.jboss.security.auth.login.SunConfigParser.config(SunConfigParser.java:98)
      at org.jboss.security.auth.login.SunConfigParser.parse(SunConfigParser.java:57)
      at org.jboss.security.auth.login.SunConfigParser.doParse(SunConfigParser.java:79)
      at org.jboss.security.auth.login.XMLLoginConfigImpl.loadSunConfig(XMLLoginConfigImpl.java:271)
      at org.jboss.security.auth.login.XMLLoginConfigImpl.loadConfig(XMLLoginConfigImpl.java:255)
      at org.jboss.security.auth.login.XMLLoginConfigImpl.loadConfig(XMLLoginConfigImpl.java:231)
      at org.jboss.security.auth.login.XMLLoginConfig.startService(XMLLoginConfig.java:152)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:966)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:392)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy5.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:597)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:365)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:272)
      at org.jboss.Main.boot(Main.java:150)
      at org.jboss.Main$1.run(Main.java:388)
      at java.lang.Thread.run(Thread.java:536)

        • 1. Re: Configuring login_config.xml
          starksm64

          The login-config.xml file has an error in it that will be logged to the server.log at debug level. The exception here results when the file is parsed as a sun text file format due to the previous xml error. Check the server.log for the xml format problem.

          • 2. Re: Configuring login_config.xml
            alisson

            Hi,
            My server.log has present this message, but I don't know what to do now. Can you help me?

            2004-03-11 08:59:23,812 DEBUG [org.jboss.security.auth.login.XMLLoginConfigImpl] Try loading config as XML, url=file:/C:/JBoss/server/teste/conf/login-config.xml
            2004-03-11 08:59:23,906 DEBUG [org.jboss.security.auth.login.XMLLoginConfigImpl] Try loading config as Sun format, url=file:/C:/JBoss/server/teste/conf/login-config.xml
            2004-03-11 08:59:23,937 WARN [org.jboss.security.auth.login.XMLLoginConfigImpl] Failed to load config: file:/C:/JBoss/server/teste/conf/login-config.xml

            • 3. Re: Configuring login_config.xml

              What does your login-config.xml look like?

              • 4. Re: Configuring login_config.xml
                alisson

                I´ve solved this problem. It was just the text format that was incompatible. I think it is because I've copy-paste examples from the Web.

                Now i am having another problem, I can't authenticate my users, the login and password are correct, but the user is not authenticated. When I get request.getRemoteUser() it returns null.

                Is it problem in my login-config sql statements (see them below)?

                <application-policy name = "testeSec">

                <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
                flag = "required">
                <module-option name="dsJndiName">java:/AcademicoDB</module-option>
                <module-option name="principalsQuery">select passwd from users where username=?</module-option>
                <module-option name="rolesQuery">select userRoles, roleGroup from userroles where username=?</module-option>
                </login-module>

                </application-policy>