users@glassfish.java.net

Re: How do logon or set principle/roles/groups when using Embedded API

From: <glassfish_at_javadesktop.org>
Date: Thu, 11 Mar 2010 00:16:21 PST

Hurray, I got it to work. I just happened to notice under "Test Libraries" netbeans had sought fit to add glassfish-embedded-static-shell.jar on it's own. It was a built in thing that you cannot remove like the other libraries. I think it added it when I created the EJB v3 project.

As a result, it had both glassfish-embedded-static-shell.jar and glassfish-embedded-web.jar and I think it was running both to some extent, which is why I got all those "already set" exceptions, and what I think messed up the programmable login.

I created a regular Java Application project that just had the test class, and linked it to my bean project, and made sure to adjust archiveStr for the embedded server to find the jar built in the bean project. I added glassfish-embedded-web.jar and it worked the way specified in the Feb 10, 2010 5:43 AM post, I did not need to deal with EmbeddedFileSystem.

Observations:
If I did use EmbeddedFileSystem and I specified a configurationFile, then there had to already be a domain.xml file there, it would not create a default one. So this probably meant pointing to my existing glassfish install or trying to craft a domain.xml. If I did not set configurationFile it worked fine.

I may be wrong on this, or this might already be obvious, but it seems like the method using the Embedded API (javax.ejb.embeddable.EJBContainer) does not work because, while it bases the configuration on your existing install, it creates a blank keystore, so there are no users, and no way it seems to add users because you cannot do getCommandInvocation/create-file-user trick. It seems like it should use/copy the keystore from the existing server config, at least then you could setup some users ahead of time.

The Nithya blog you pointed to was very helpful.

Thank you one in all for your excellent help!
[Message sent by forum member 'markkr2' (mark_at_the-kruegers.name)]

http://forums.java.net/jive/thread.jspa?messageID=391175