facebook

Running jaas problem using myEclipse

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #250690 Reply

    jadeite1000
    Member

    To Whom It May Concern:

    I was able to run the following code in dos prompt:

    java -Djava.security.auth.login.config=jaas.config JaasTest

    When I tried to run the JaasTest.java in myEclipse 4.1.1 I right click on JaasTest.java and choose Debug as\Debug..

    I clicked on the Arguments tab and type the following:
    -Djava.security.auth.login.config=jaas.config

    When I clicked debug and step into the code, I get the following exception:
    jaas.config(No such file or directory).

    The JaasTest.java file is in the same directory as the jaas.config file.
    Here are the code for JaasTest.java:
    /* Java imports */
    import java.io.*;
    import java.util.*;

    /* JAAS imports */
    import java.security.*;
    import javax.security.auth.*;
    import javax.security.auth.login.*;

    /**
    * <p>
    * JaasTest uses JAAS and our custom RdbmsLoginModule
    * and ConsoleCallbackHandler. Prompts and reads from the
    * command line console line for username/password and
    * then authenticates using a JDBC database.
    *
    * @author Paul Feuer and John Musser
    * @version 1.0
    */

    public class JaasTest {

    public static void main(String[] args) {

    boolean loginSuccess = false;
    Subject subject = null;

    try {
    ConsoleCallbackHandler cbh = new ConsoleCallbackHandler();

    LoginContext lc = new LoginContext(“Example”, cbh);

    try {
    lc.login();
    loginSuccess = true;

    subject = lc.getSubject();

    Iterator it = subject.getPrincipals().iterator();
    while (it.hasNext())
    System.out.println(“Authenticated: ” + it.next().toString());

    it = subject.getPublicCredentials(Properties.class).iterator();
    while (it.hasNext())
    ((Properties)it.next()).list(System.out);

    lc.logout();
    } catch (LoginException lex) {
    System.out.println(lex.getClass().getName() + “: ” + lex.getMessage());
    }

    } catch (Exception ex) {
    System.out.println(ex.getClass().getName() + “: ” + ex.getMessage());
    }

    System.exit(0);
    }
    }

    Yours,

    Desperate.

    #250766

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    You may need to adjust your working directory, I don’t see from your code where you are loading the jaas.config file, but you should be able to get it with getResourceAsStream from the class in the same package.

    #250792

    Haris Peco
    Member

    or set jaas.config in workspace root – workspace root is working directory when you run/debug eclipse application

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Running jaas problem using myEclipse

You must be logged in to post in the forum log in