Dear Kumar,
As can you see we wrote a simple client as possible (one login, one lookup and call the sless.hello four times)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
LoginContext loginContext = new LoginContext("default",callbackHandler);
System.out.println("Before Login !!!");
// -- 1
loginContext.login();
try {
__System.out.println("After Login !!!");
// ---- 2
__sless = (StatelessSession)initialContext.lookup("java:global/HelloApp/HelloApp-ejb/StatelessSessionBean");
__for (int c=0; c<4; c++) {
// --------- 3
____System.out.println("StatelessSession bean says : " + sless.hello());
__}
} finally {
__loginContext.logout();
}
on the server side a simple stateless EJB too (it has some logging information with System.out.println)
---------------------------------------------------------------------------------------------------------------------------------------------------
@Stateless public class StatelessSessionBean implements StatelessSession {
___at_RolesAllowed("programmers")
__public String hello() {
____System.out.println("In HelloBean(Stateless)::hello()["+
______sessionContext.getCallerPrincipal().getClass().getName()+"]("+
______sessionContext.getCallerPrincipal().getName()+")");
____return "hello, world!\n";
__}
}
and we wrote and deployed a customLoginModule for logging reason, we put into the "authenticate" method this
System.out.println("AUTHENTICATE: <"+_currentRealm.getName()+">("+_username+")["+getPasswordChar().toString()+"]");
and we put into the "commit" method this
System.out.println("COMMIT: <"+_currentRealm.getName()+">("+_username+")["+getPasswordChar().toString()+"]");
When we deployed the server and started the client everything seems to be good from client side, we got the "StatelessSession bean says : hello, world!" four times we was happy.
But the server side we saw into the server.log that the CustomLoginModule was called four times, not once!!!
-----------------------------------------------------------------------------------------------------------------------------------
We attached our application, application's document, the server.log and the server configs.
The CustomLoginModule logging starting with "AUTHENTICATE" and ending with "CUSTOM PRINCIPAL".
The EJB logging start from "---\n""INTERCEPTOR" to "INTERCEPTOR""\n---".
You can see into the server.log the CustomLogin log before all EJB log, it is our problem.
Attila.
The client side log:
--------------------
2010.05.26. 10:29:01 com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
Start Application Client
StatelessJavaClientAuthenticator programmer
StatelessJavaClientAuthenticator hello
Before Login !!!
NameCallback: (programmer)
PasswordCallback: (hello)
After Login !!!
@EJB sets the 'StatelessSession' to null !
NameCallback: (programmer)
PasswordCallback: (hello)
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
StatelessSession bean says : hello, world!
Stop Application Client
Server side log:
----------------
CUSTOM LOGIN LOG
[#|2010-05-26T10:28:58.657+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|AUTHENTICATE: <helloRealm>(boss)[boss]|#]
[#|2010-05-26T10:28:58.664+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|COMMIT: <helloRealm>(boss)[boss]|#]
[#|2010-05-26T10:28:58.665+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|CUSTOM PRINCIPAL: <helloRealm>(boss)[boss]|#]
EJB LOG
[#|2010-05-26T10:28:58.721+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|-----------|#]
[#|2010-05-26T10:28:58.722+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|INTERCEPTOR|#]
[#|2010-05-26T10:28:58.722+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|Before: public java.lang.String enterprise.hello_stateless_ejb.StatelessSessionBean.hello()|#]
[#|2010-05-26T10:28:58.728+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|In HelloBean(Stateless)::hello()[org.glassfish.security.common.PrincipalImpl](boss)|#]
[#|2010-05-26T10:28:58.728+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|SUBJECT|#]
[#|2010-05-26T10:28:58.731+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|PRINCIPALS|#]
[#|2010-05-26T10:28:58.731+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|com.sun.enterprise.security.auth.login.CTJDBCLoginModuleUser|#]
[#|2010-05-26T10:28:58.732+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|SUPER|#]
[#|2010-05-26T10:28:58.732+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|boss|#]
[#|2010-05-26T10:28:58.732+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|SUPER (1)|#]
[#|2010-05-26T10:28:58.732+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|org.glassfish.security.common.Group|#]
[#|2010-05-26T10:28:58.733+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|PUBLIC_CREDENTIALS|#]
[#|2010-05-26T10:28:58.733+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|PRIVATE_CREDENTIALS|#]
[#|2010-05-26T10:28:58.734+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|com.sun.enterprise.security.auth.login.common.PasswordCredential|#]
[#|2010-05-26T10:28:58.734+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|After: public java.lang.String enterprise.hello_stateless_ejb.StatelessSessionBean.hello()|#]
[#|2010-05-26T10:28:58.734+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|INTERCEPTOR|#]
[#|2010-05-26T10:28:58.734+0200|INFO|glassfishv3.0|null|_ThreadID=28;_ThreadName=Thread-1;|-----------|#]
[Message sent by forum member 'aszomor']
http://forums.java.net/jive/thread.jspa?messageID=473173