users@glassfish.java.net

Re: Glassfish embedded 3.1.1 login configuration not set

From: Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
Date: Wed, 30 Nov 2011 20:56:30 +0530

Hi,

I am not sure whether embedded glassfish can make the decision to
override the user's environment settings.

But you can try to do it in your program itself, like this:

{code}

         GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish();

         System.setProperty("java.security.auth.login.config",
System.getProperty("com.sun.aas.instanceRoot") + File.separator +
"config" + File.separator + "login.conf");

         glassfish.start();

{code}

Thanks,

Bhavani

On 11/30/2011 08:06 PM, forums_at_java.net wrote:
> Hello,
>
> i try to run a webapp which requires authentication on embedded
> glassfish.
>
> I've created the user vie CommandRunner (create-file-user --groups users
> --passwordfile c:\tmp\tstpwfile user)
>
> When i run my application and try to login in i get an exception.
>
> The login configuration file is located in {java.io.tmpdir}
> /gfembedXXXXXXXXXtmp/login.conf
>
> I figured out that com.sun.security.auth.login.ConfigFile tried to
> load the
> login.conf file from the location set in property
> "java.security.auth.login.config" or "~/.java.login.config"
>
> When i specify a login.conf via System.Property
> "java.security.auth.login.config"every thing works fine.
>
> The Problem is that i can not figured out the current gfembedXXXXXXXXXtmp
> directory to set this Property correct. (Tha embedded API does allow
> access
> to the installation.root )
>
> I think this is a bug and embedded glassfish should use the login.conf
> which
> is provided in the gfembedXXXXXXXXXtmp directory.
>
> Does somone else run into these issues ? Is there a workaround ?
>
> Best regards
>
> [code]
>
> com.sun.enterprise.security.auth.login.common.LoginException: Login
> failed:
> Anmeldekonfiguration kann nicht gefunden werden.
> at
> com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:394)
>
> at
> com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:240)
>
> at
> com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:153)
>
> at
> com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:512)
> at
> com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:453)
> at
> org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:168)
>
> at
> com.sun.web.security.RealmAdapter.invokeAuthenticateDelegate(RealmAdapter.java:1326)
>
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:551)
>
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:623)
>
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
>
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
> at
> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
>
> at
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
>
> at
> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
> at
> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
> at
> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
> at
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
>
> at
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
>
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
>
> at
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
>
> at
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
> at
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
>
> at
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
>
> at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
> at
> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
>
> at
> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
>
> at java.lang.Thread.run(Thread.java:662)
> Caused by: java.lang.SecurityException: Anmeldekonfiguration kann nicht
> gefunden werden.
> at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at java.lang.Class.newInstance0(Class.java:355)
> at java.lang.Class.newInstance(Class.java:308)
> at
> javax.security.auth.login.Configuration$3.run(Configuration.java:247)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> javax.security.auth.login.Configuration.getConfiguration(Configuration.java:242)
>
> at
> javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
> at
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
> at
> javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
> at
> com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:381)
>
> ... 29 more
> Caused by: java.io.IOException: Anmeldekonfiguration kann nicht gefunden
> werden.
> at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)
> at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)
>
> [/code]
>
>
> --
>
> [Message sent by forum member 'dansg']
>
> View Post: http://forums.java.net/node/869190
>
>