users@glassfish.java.net

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

From: Siraj Ghaffar <Siraj.Ghaffar_at_Sun.COM>
Date: Thu, 11 Mar 2010 09:30:50 -0500

Glad to see this working for you. More inline..

glassfish_at_javadesktop.org wrote:
> 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.
>
>
If you specify a configFile then it should be a valid domain.xml. A
default domain.xml for embedded is already bundled, and if you want to
use that, you need not specify a configFile - it would be used
automatically.
> 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.
>
>
That is correct - the default domain.xml points to a keyfile which
does not exist if a temp directory is being used. This is a bug.
Normally, the temp stuff comes into play when you do not point to an
existing instance - a common use case for embedded. When you are using
the embedded EJB APIs, the temp directory is used because of issue
https://glassfish.dev.java.net/issues/show_bug.cgi?id=9566

The embedded EJB API does not set the instanceRoot.
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>