users@glassfish.java.net

[gf-users] Re: v4 Programatic login

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Thu, 22 May 2014 06:51:51 -0400

Date: Thu, 22 May 2014 09:58:05 +0200
From: tomaz.majerhold_at_arnes.si
To: users_at_glassfish.java.net
Subject: [gf-users] v4 Programatic login


  

    
  
  
    Whay ProgrammaticLogin not working, I'm trying to port apliactions
    from GF v3.1.2 to GF v4

    

    1) GF :

    ----------

    
      
        
          
            Name:
          
          
            server
          
        
        
          
            Status:
          
          
            Running
          
        
        
          
            JVM:
          
          
            JVM Report
          
        
        
          
            Configuration:
          
          
            server-config
          
        
        
          
            Installation
                Directory:
          
          
            A:\IDE\glassfish-4.0_NetBeans8\Program
                Files\glassfish
          
        
        
          
            Installed
                Version:
          
          
            GlassFish Server Open Source
                Edition 4.0 (build 89)
          
        
        
          
            Secure
                Administration:
          
          
            Not Enabled
          
        
        
          
            Debug:
          
          
            Not Enabled
          
        
        
          
            Up Time:
          
          
            34 Minutes 13 Seconds
          
        
        
          
            HTTP Port(s):
          
          
            4848,8080,8181
          
        
        
          
            IIOP Port(s)
          
          
            3820,3920,3700
          
        
      
    
    

    2) In server.policy I enabled

    // EJB securety

    grant codeBase "file:${com.sun.aas.installRoot}/modules/-" {

     permission com.sun.appserv.security.ProgrammaticLoginPermission

     "login";

     };

     

     // EJB securety

    grant codeBase "file:${com.sun.aas.installRoot}/modules/-" {

     permission com.sun.appserv.security.ProgrammaticLogin

     "login";

     };

    

    in modules directory I have security.jar, security-ee.jar,
    security-ee-l10n.jar, security-l10n.jar, security-services.jar

    

    

    3) But when I start my web application ProgramaticLogin was NOT in
    classpath(No class, so strange ...)

    

    4) Ok put dependecy in my web apliaction

    <!-- EJB -->

            <dependency>

                <groupId>org.glassfish.security</groupId>

                <artifactId>security</artifactId>

                <version>3.2-b06</version>
<!--Im not sure why Habitat getHabitat() method was pulled from 3.2-b06 ? -->
<!-- getHabitat is definitely in SecurityServicesUtil.java in org.glassfish.security:security:3.1.1 version -->
http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.security/security/3.1.1/com/sun/enterprise/security/SecurityServicesUtil.java?av=f
<!-- HTH -->
<!-- MG -->



                <type>jar</type>

            </dependency>

            <dependency>

                <groupId>javax</groupId>

                <artifactId>javaee-web-api</artifactId>

                <version>7.0</version>

                <scope>provided</scope>

            </dependency>

            <dependency>

                <groupId>org.glassfish</groupId>

                <artifactId>javax.ejb</artifactId>

                <version>3.1.1</version>

                <scope>provided</scope>

            </dependency>

    

    But then I get even stranger error, I coulden find solution on
    internet, the error is:

    

    ava.lang.NoSuchMethodError:
com.sun.enterprise.security.SecurityServicesUtil.getHabitat()Lorg/jvnet/hk2/component/Habitat;

        at
com.sun.appserv.security.ProgrammaticLogin.resolveWebProgrammaticLogin(ProgrammaticLogin.java:517)

        at
com.sun.appserv.security.ProgrammaticLogin.<init>(ProgrammaticLogin.java:116)

        at
si.arnes.apis.wc.api.EjbLookupConnector.login(EjbLookupConnector.java:44)

    

    

    

    So what I'm doing wrong?

    

    Regards, Tomaž Majerhold

    

    

    

    

    
                                               



ok_small.gif
(image/gif attachment: ok_small.gif)