Hi guys,
I have a problem that has kept frustrating me over some time now. I have the following situation:
I deploy a .sar file to my JBoss AS (4.0.5GA) containing an MBean that makes use of JBoss JAAS Security by calling
LoginContext lc = new LoginContext("myJaas");
lc.login();
The JAAS application policy is configured in my
conf/login-config.xml like this:
<application-policy name="myJaas">
<authentication>
<login-module code="mypackage.MyLoginModule" flag="required" />
</authentication>
</application-policy>
Other than that, I have nothing changed in the default configuration of my JBoss. I am using the 'default' instance.
When the MBean calls the snippet above I receive the following error:
javax.security.auth.login.LoginException: unable to find LoginModule class: myPackage.MyLoginModule
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:808)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
I am pretty sure it is a class loading problem because I
CAN load the class fine the when I put the jar containing myPackage.MyLoginModule an the classpath using JBOSS_CLASSPATH system variable.
Every other attempt to put this jar in the lib-dir of JBoss or the default instance has failed. Likewise, the same error occurs when I package the jar along with my sar-File.
What am I missing? Is it even possible to use the JBoss JAAS config from an MBean? Do you have any other ideas how I can use JAAS from an MBean?
Thank you
Martin