Skip to main content

Glassfish embedded 3.1.1 login configuration not set

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
4 replies [Last post]
dansg
Offline
Joined: 2011-11-30

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

</p>
<p>com.sun.enterprise.security.auth.login.common.LoginException: Login failed: Anmeldekonfiguration kann nicht gefunden werden.<br />
    at com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:394)<br />
    at com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:240)<br />
    at com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:153)<br />
    at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:512)<br />
    at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:453)<br />
    at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:168)<br />
    at com.sun.web.security.RealmAdapter.invokeAuthenticateDelegate(RealmAdapter.java:1326)<br />
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:551)<br />
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:623)<br />
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)<br />
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)<br />
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)<br />
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)<br />
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)<br />
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)<br />
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)<br />
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)<br />
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)<br />
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)<br />
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)<br />
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)<br />
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)<br />
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)<br />
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)<br />
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)<br />
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)<br />
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)<br />
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)<br />
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)<br />
    at java.lang.Thread.run(Thread.java:662)<br />
Caused by: java.lang.SecurityException: Anmeldekonfiguration kann nicht gefunden werden.<br />
    at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:93)<br />
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br />
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)<br />
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)<br />
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)<br />
    at java.lang.Class.newInstance0(Class.java:355)<br />
    at java.lang.Class.newInstance(Class.java:308)<br />
    at javax.security.auth.login.Configuration$3.run(Configuration.java:247)<br />
    at java.security.AccessController.doPrivileged(Native Method)<br />
    at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:242)<br />
    at javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)<br />
    at java.security.AccessController.doPrivileged(Native Method)<br />
    at javax.security.auth.login.LoginContext.init(LoginContext.java:234)<br />
    at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)<br />
    at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)<br />
    at com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:381)<br />
    ... 29 more<br />
Caused by: java.io.IOException: Anmeldekonfiguration kann nicht gefunden werden.<br />
    at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)<br />
    at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:91)</p>
<p>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Bhavanishankar ...
Offline
Joined: 2011-04-06

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@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
>
>

<br />
><br />
> com.sun.enterprise.security.auth.login.common.LoginException: Login<br />
> failed:<br />
> Anmeldekonfiguration kann nicht gefunden werden.<br />
>     at<br />
> com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:394)<br />
><br />
>     at<br />
> com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:240)<br />
><br />
>     at<br />
> com.sun.enterprise.security.auth.login.LoginContextDriver.login(LoginContextDriver.java:153)<br />
><br />
>     at<br />
> com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:512)<br />
>     at<br />
> com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:453)<br />
>     at<br />
> org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:168)<br />
><br />
>     at<br />
> com.sun.web.security.RealmAdapter.invokeAuthenticateDelegate(RealmAdapter.java:1326)<br />
><br />
>     at<br />
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:551)<br />
><br />
>     at<br />
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:623)<br />
><br />
>     at<br />
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)<br />
><br />
>     at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)<br />
>     at<br />
> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)<br />
><br />
>     at<br />
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)<br />
><br />
>     at<br />
> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)<br />
><br />
>     at<br />
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)<br />
><br />
>     at<br />
> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)<br />
><br />
>     at<br />
> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)<br />
>     at<br />
> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)<br />
>     at<br />
> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)<br />
>     at<br />
> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)<br />
><br />
>     at<br />
> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)<br />
><br />
>     at<br />
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)<br />
><br />
>     at<br />
> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)<br />
><br />
>     at<br />
> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)<br />
>     at<br />
> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)<br />
><br />
>     at<br />
> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)<br />
><br />
>     at com.sun.grizzly.ContextTask.run(ContextTask.java:71)<br />
>     at<br />
> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)<br />
><br />
>     at<br />
> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)<br />
><br />
>     at java.lang.Thread.run(Thread.java:662)<br />
> Caused by: java.lang.SecurityException: Anmeldekonfiguration kann nicht<br />
> gefunden werden.<br />
>     at com.sun.security.auth.login.ConfigFile.(ConfigFile.java:93)<br />
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native<br />
> Method)<br />
>     at<br />
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)<br />
><br />
>     at<br />
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)<br />
><br />
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)<br />
>     at java.lang.Class.newInstance0(Class.java:355)<br />
>     at java.lang.Class.newInstance(Class.java:308)<br />
>     at<br />
> javax.security.auth.login.Configuration$3.run(Configuration.java:247)<br />
>     at java.security.AccessController.doPrivileged(Native Method)<br />
>     at<br />
> javax.security.auth.login.Configuration.getConfiguration(Configuration.java:242)<br />
><br />
>     at<br />
> javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)<br />
>     at java.security.AccessController.doPrivileged(Native Method)<br />
>     at javax.security.auth.login.LoginContext.init(LoginContext.java:234)<br />
>     at<br />
> javax.security.auth.login.LoginContext.(LoginContext.java:367)<br />
>     at<br />
> javax.security.auth.login.LoginContext.(LoginContext.java:444)<br />
>     at<br />
> com.sun.enterprise.security.auth.login.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:381)<br />
><br />
>     ... 29 more<br />
> Caused by: java.io.IOException: Anmeldekonfiguration kann nicht gefunden<br />
> werden.<br />
>     at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:250)<br />
>     at com.sun.security.auth.login.ConfigFile.(ConfigFile.java:91)<br />
><br />
> 

>
>
> --
>
> [Message sent by forum member 'dansg']
>
> View Post: http://forums.java.net/node/869190
>
>

dansg
Offline
Joined: 2011-11-30

Hi Bhavani,

thank you for your reply. I tried your suggestion and it works. (i did not now how to get the instance root )

But my question is, why gf embedded did not use the embedded login.conf instead of throwing an exception when no property is set?

best regards,

Daniel

Bhavanishankar ...
Offline
Joined: 2011-04-06

Hi Daniel,

Only reason is, changing the system properties might be a bit risky
because it affects the entire JVM, affecting the application/software
that embeds GlassFish. Since you have come up with the suggestion,
please go ahead and raise a request in Issue Tracker
. We will look into fixing it or
at least documenting it.

Thanks,

Bhavani

On 12/01/2011 01:36 PM, forums@java.net wrote:
> Hi Bhavani,
>
> thank you for your reply. I tried your suggestion and it works. (i did
> not
> now how to get the instance root )
>
> But my question is, why gf embedded did not use the embedded login.conf
> instead of throwing an exception when no property is set?
>
> best regards,
>
> Daniel
>
>
>
>
> --
>
> [Message sent by forum member 'dansg']
>
> View Post: http://forums.java.net/node/869190
>
>

dansg
Offline
Joined: 2011-11-30

Hi Bhavani,

i've created an issue for this: http://java.net/jira/browse/GLASSFISH-17909

best regards

Daniel