Hi
I am trying to test my ejbs via JUnit and my Application server is JBoss.
My ejbs are secured using JAAS and I am using Eclipse to develop
the project.
This is the code I am using to login.
MyCallbackHandler callback = new MyCallbackHandler(user,pass.toCharArray());
LoginContext loginContext = new LoginContext("MySecurity",callback);
loginContext.login();
The problem is that when I define the
-Djava.security.auth.login.config=auth.conf in VM parameters in Eclipse
and I run the test I come up with the following exception :
warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError:
Exception in constructor: testEjbCreateRemove
(java.lang.SecurityException: auth.conf (No such file or directory)
at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:97)
The auth.conf file is in the src directory of the project and the JUnit
class is in a package called tests. I have tried to move the auth.conf
file in the tests directory but I get the same error.
I cant understand why the file cannot be located as all the src and the
subdirectories should be in the classpath.
Petros
Petros Petrou - 26 Apr 2004 02:27 GMT
OK I sorted it out.
Something funny with the classpath. it was looking one directory above src.
> Hi
>
[quoted text clipped - 27 lines]
>
> Petros