8 Replies Latest reply on Apr 12, 2002 12:12 PM by dwbrown2002

    jaas/howto-Example

    Matthias Lakämper Newbie


      This examle didn´t work directly because there are some little Problems in
      the build.xml-File.

      I start ant directly in the jaas/howto - Directory.

      For example the basedir was not correct set


      i have changed it to


      Example2

      i have changed it to



      i have changed it to


      and some points more...

      here is the complete build.xml-File

      --------------------------------------------------------
      <?xml version="1.0" encoding="UTF-8" ?>
      <!-- An Ant build file for the JAAS tutorial code
      -->



      <!-- Override with your JBoss server dist location -->
      <!-- -->

      <!-- Override with your web server servlet jar location -->
      <!-- -->











































      <!-- ### Example 1 targets -->
      <!-- Tutorial ejb jar1 -->























      <!-- Tutorial web app war -->













      <!-- Create the tutorial ear that uses the properties based security info -->












      <!-- ### Example 2 targets -->
      <!-- Tutorial ejb jar2 -->



















      <!-- Tutorial web app war -->













      <!-- Create the tutorial ear that uses the properties based security info -->












      <!-- Create the tutorial ears -->






      <!-- Build the DatabaseServerLoginModule tables -->










      <!-- Run all example 1 test cases -->




      <!-- Run the example 1 test cases individually -->












      <!-- Run all example 2 test cases -->




      <!-- Run the example 2 test cases individually -->
























































      ---------------------------

      regards Matthias

        • 1. Re: jaas/howto-Example
          Brian Huang Newbie

          Dear Matthias,

          I tried the build.xml file without any problems. However, you may set the basedir to a full path.
          For example, basedir="/home/jboss/project/jaas"
          The rest of build.xml is correct.

          Best Regards,

          Brian

          • 2. Re: jaas/howto-Example
            Matthias Lakämper Newbie

            Hi Brian,

            thank you for your answer,

            the mentioned problems i have on a NT-System.

            1: File-Structure

            In the original Download-File is no src-Level, but in the build.xml-Script you see:



            The Download-Structure is as follows:

            x:\JBoss\examples\org\jboss\docs\jaas\howto

            2: Build-Error

            During build i see the following error:

            -------------------------------------------
            [delete] Deleting directory D:\JBoss\examples\build\WEB-INF
            [mkdir] Created dir: D:\JBoss\examples\build\WEB-INF\classes\org\jboss\docs\jaas\howto
            [copy] Could not find file D:\JBoss\examples\web.xml to copy.

            LD FAILED

            JBoss\examples\org\jboss\docs\jaas\howto\build.xml:92: Could not find file D:\JBoss\examples\web.xml to copy.
            -------------------------------------------

            I have changed the line:



            to the following:



            This solves the Problem.

            Did you test the make-File on WinNT ?

            Regards Matthias

            • 3. Re: jaas/howto-Example
              Erdal Newbie

              Hi Matthias,
              I hava the same Problem, I work with a Win2000-Machine, too.
              I become the following Exception, when I run the Example.

              [java] Created LoginContext
              [java] java.lang.ClassNotFoundException: org.apache.log4j.Priority

              Can you send me your Exception, without your changes.
              So I can show, if I hava the same problem, and must
              change the build.xml too

              best regards
              Erd

              • 4. Re: jaas/howto-Example
                Matthias Lakämper Newbie

                Hi Erd,

                i didn't have runtime-Problems. My problem was, to build the example. After changing the build-File the example works fine.

                I have started the example with Jboss-2.4.3 or JBoss-2.4.3_Tomcat-3.2.3.

                Your Exception gives a hint on apache:

                ----[java] java.lang.ClassNotFoundException: org.apache.log4j.Priority ---

                it seems that you start the example directly
                from apache. I don´t have experiences with that.

                regards Matthias


                • 5. Re: jaas/howto-Example
                  Aaron Tang Newbie

                  Hi Folks,

                  I have a similar situation to Erd.I use JBoss
                  2.4.4 Tomcat 4.0.1 on win2k.I can build the jaas_howto
                  example correctly, but when i run the test with command
                  "ant example1-test0", i got the error message(attached
                  file log.txt)
                  And i can't understand how org.jboss.security.ClientLoginModule works, because i
                  can't its source file in the ${jboss.dist}/src directory.
                  My another confusion is that when will be roles.properties
                  and user.properties used to authorize?

                  thanks!

                  • 6. Re: jaas/howto-Example
                    Aaron Tang Newbie

                    the log.txt:)
                    Buildfile: build.xml

                    example1-test0:

                    validate:

                    fail_if_not_valid:

                    init:
                    [echo] Using jboss.dist=d:\tangliang\easyinfo\jdhome/jboss
                    [echo] Using classpath=D:\tangliang\easyinfo\jdhome\jboss\client\jboss-j2ee.jar;D:\tangliang\easyinfo\jdhome\jboss\client\jaas.jar;D:\tangliang\easyinfo\jdhome\jboss\client\jbosssx-client.jar;D:\tangliang\easyinfo\jdhome\jboss\client\jboss-client.jar;D:\tangliang\easyinfo\jdhome\jboss\client\jnp-client.jar;D:\tangliang\easyinfo\jdhome\tomcat\common\lib\servlet.jar;D:\tangliang\jboss\jaas\build\classes

                    compile:

                    client-test0:
                    [java] +++ Running SessionClient with username=java, password=echoman, example=example1
                    [java] Created LoginContext
                    [java] Login failed
                    [java] javax.security.auth.login.LoginException: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
                    [java] at java.lang.ClassLoader.defineClass0(Native Method)
                    [java] at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
                    [java] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
                    [java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
                    [java] at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
                    [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
                    [java] at java.security.AccessController.doPrivileged(Native Method)
                    [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
                    [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                    [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
                    [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
                    [java] at org.jboss.security.Logger.initLog4j(Logger.java:293)
                    [java] at org.jboss.security.Logger.getLogger(Logger.java:80)
                    [java] at org.jboss.security.Logger.getLogger(Logger.java:74)
                    [java] at org.jboss.security.ClientLoginModule.initialize(ClientLoginModule.java:78)
                    [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    [java] at java.lang.reflect.Method.invoke(Method.java:324)
                    [java] at javax.security.auth.login.LoginContext.invoke(LoginContext.java:651)
                    [java] at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
                    [java] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:599)
                    [java] at java.security.AccessController.doPrivileged(Native Method)
                    [java] at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:596)
                    [java] at javax.security.auth.login.LoginContext.login(LoginContext.java:523)
                    [java] at org.jboss.docs.jaas.howto.SessionClient.main(SessionClient.java:66)
                    [java]
                    [java] at javax.security.auth.login.LoginContext.invoke(LoginContext.java:719)
                    [java] at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
                    [java] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:599)
                    [java] at java.security.AccessController.doPrivileged(Native Method)
                    [java] at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:596)
                    [java] at javax.security.auth.login.LoginContext.login(LoginContext.java:523)
                    [java] at org.jboss.docs.jaas.howto.SessionClient.main(SessionClient.java:66)
                    [java] Found PublicSession home
                    [java] java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
                    [java] java.rmi.RemoteException: checkSecurityAssociation; nested exception is:
                    [java] java.lang.SecurityException: Insufficient method permissions, principal=null, method=create, requiredRoles=[Coder, Echo], principalRoles=[]
                    [java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
                    [java] at sun.rmi.transport.Transport$1.run(Transport.java:148)
                    [java] at java.security.AccessController.doPrivileged(Native Method)
                    [java] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
                    [java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
                    [java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
                    [java] at java.lang.Thread.run(Thread.java:536)
                    [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
                    [java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
                    [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
                    [java] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invokeHome(Unknown Source)
                    [java] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:258)
                    [java] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
                    [java] at $Proxy0.create(Unknown Source)
                    [java] at org.jboss.docs.jaas.howto.SessionClient.main(SessionClient.java:79)
                    [java] Caused by: java.rmi.RemoteException: checkSecurityAssociation; nested exception is:
                    [java] java.lang.SecurityException: Insufficient method permissions, principal=null, method=create, requiredRoles=[Coder, Echo], principalRoles=[]
                    [java] at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.java:216)
                    [java] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:91)
                    [java] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:103)
                    [java] at org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:268)
                    [java] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:387)
                    [java] at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
                    [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    [java] at java.lang.reflect.Method.invoke(Method.java:324)
                    [java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
                    [java] at sun.rmi.transport.Transport$1.run(Transport.java:148)
                    [java] at java.security.AccessController.doPrivileged(Native Method)
                    [java] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
                    [java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
                    [java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
                    [java] at java.lang.Thread.run(Thread.java:536)
                    [java] Caused by: java.lang.SecurityException: Insufficient method permissions, principal=null, method=create, requiredRoles=[Coder, Echo], principalRoles=[]
                    [java] at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.java:215)
                    [java] ... 14 more
                    [java] Found PrivateSession home
                    [java] Failed to create PrivateSession as expected

                    BUILD SUCCESSFUL

                    Total time: 10 seconds

                    • 7. Re: jaas/howto-Example
                      Aaron Tang Newbie

                      cookmanA:
                      I have tested on JBoss-2.4.3_Tomcat-3.2.3 bundle.
                      All things run well.

                      cookmanB:
                      It's a time-waste working to download a later version of
                      j-t bundle, but fortunately you made it at last.

                      cookmanA:
                      oh , my god

                      • 8. Re: jaas/howto-Example
                        dwbrown2002 Newbie

                        Hello Mathias, i got the example to work ok but have not been able to add more users or roles to the (dot).properties files. any and all feedback would be appreciated. thanx, 0-fer.