Hi,
You need to use com.sun.appserv.security.ProgrammaticLogin for this as shown below.
ProgrammaticLogin pl = new ProgrammaticLogin();
pl.login( "_system", "systempassword");
before calling the ejb method in your init and service methods. You also need to create a file realm user called "_system" either through admin gui or asadmin create-file-user command.
You need to add appserv-ext.jar from the glassfish/lib directory to your project classpath .
Let us know if this works for you.
[Message sent by forum member 'raharsha' (raharsha)]
http://forums.java.net/jive/thread.jspa?messageID=236205