Skip to main content

Form autheitcation

21 replies [Last post]
guiomie
Offline
Joined: 2010-08-23

Form authentication doesnt seem to work well on my glassfish server. The webpages in the protected folder are not accessible, but the unidentified user isnt redirected to the login page, it just stays blank. If i go directly to my login.jsp, nothing happens after the submit button is pressed. I have the No active context error in my log in netbeans.

https://glassfish.dev.java.net/issues/show_bug.cgi?id=11504 this issue seems related, but I cant find any clues or fixes to my problem.

Thank you. I can post additionnal info, but the source code is pretty much has any tutorials about form authentication via jdbc with a mysql database,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
swchan2
Offline
Joined: 2005-03-29

Similar issue has been fixed before. Can you provide a simple test case to illustrate this error? (Note that you may like to use file realm to illustrate this first.)

guiomie
Offline
Joined: 2010-08-23

When I try to access protected pages I get this in my server log:

[Web-Security] hasResource isGranted: true

So, from this I conclude access is always granted, perhaps there is a misssing option I forgot in glassfish to enable or disable?

fsousa
Offline
Joined: 2008-06-30

> I see those exceptions:
>
> org.jboss.weld.context.ContextNotActiveException:
> WELD-001303 No active contexts for scope type
> javax.enterprise.context.RequestScoped
> at

I'm having this king of exception all the time with FORM login. This is happening when I login after a logout.
I'm currently using the glassfish 3.0.1-b22 under linux 64bit. I'm getting the same exception with 3.1-b18.

CasMeiron

Hi,

I also get those annoying messages but I just ignore them, seems useless (I
do not have any beans on request scope anyway) and my app still works as
expected.
-------------------------------
Paulo Reis

On Fri, Sep 3, 2010 at 7:46 AM, wrote:

> > I see those exceptions:
> >
> > org.jboss.weld.context.ContextNotActiveException:
> > WELD-001303 No active contexts for scope type
> > javax.enterprise.context.RequestScoped
> > at
>
> I'm having this king of exception all the time with FORM login. This is
> happening when I login after a logout.
> I'm currently using the glassfish 3.0.1-b22 under linux 64bit. I'm getting
> the same exception with 3.1-b18.
> [Message sent by forum member 'fsousa']
>
> http://forums.java.net/jive/thread.jspa?messageID=481793
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>
[att1.html]

ajvok
Offline
Joined: 2010-02-26

I am also seeing this issue with GlassFish Server Open Source Edition 3.0.1 (build 22).
Using form based login, the login works OK, but the log shows an exception for every logon.
Issue #11504 is marked as resolved, but not as as far as I can see.
How to reopen the issue?
Thanks.

org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:679)
at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:138)
at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:100)
at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
...

Shing Wai Chan

The exception is related to use of weld:

org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active
contexts for scope type javax.enterprise.context.RequestScoped

which is only a symptom. There may be a different issue behind it. See
the description of the issue.
Issue 11504 is about jsf login page.
Issue 12642 is related to usage with JSR 196,
https://glassfish.dev.java.net/issues/show_bug.cgi?id=12642, which is
fixed in 3.1_b12.

Are you in the latter case?
If you are not in the above two scenario, then we need to isolated the
scenario, file a new issue and attached a test case there.

Shing Wai Chan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Shing Wai Chan

I have identified an issue. It will happen CDI, jsf, form-based login
with HttpSessionListener. I will file an issue and am working on the fix.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

ajvok
Offline
Joined: 2010-02-26

Thank you for looking at this.
I don't think I'm in the later case - no Facelets involved.
I created a simple demo of the issue & will upload if you need it, but from your last message it sounds like you are on the trail.
Thanks.

Shing Wai Chan

I have created the issue
https://glassfish.dev.java.net/issues/show_bug.cgi?id=13974
I also identified the scenario. The fix is coming.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

ballking
Offline
Joined: 2010-10-13

The count is very useful to me! Copy it.

_________________
[url=http://www.carinadresses.com/formal-dresses/ball-gown.html] ball gown [/url]

Mumuney Abdlquadri

ppl will not hlp u if u dont provide at least snippet of what u r doing.

On Mon, Aug 23, 2010 at 10:33 PM, wrote:
> Form authentication doesnt seem to work well on my glassfish server. The webpages in the protected folder are not accessible, but the unidentified user isnt redirected to the login page, it just stays blank. If i go directly to my login.jsp, nothing happens after the submit button is pressed. I have the No active context error in my log in netbeans.
>
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=11504 this issue seems related, but I cant find any clues or fixes to my problem.
>
> Thank you. I can post additionnal info, but the source code is pretty much has any tutorials about form authentication via jdbc with a mysql database,
> [Message sent by forum member 'guiomie']
>
> http://forums.java.net/jive/thread.jspa?messageID=480848
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

guiomie
Offline
Joined: 2010-08-23

Sometime the page are protected, sometime they aren't. When I press the submit button for login nothing happens. Here is some of my code:

I have a jdbc called jdbc/userPool and a connection pool named userPool. Also there is a jdbcRealm called exerciseReal. I also have a servlet with urlpattern coded in it.

web.xml





30



header and footer
/WEB-INF/view/*
/WEB-INF/jspf/header.jspf
/WEB-INF/jspf/footer.jspf



ADMIN



USER


Connection a ma db exercise
jdbc/exercise
javax.sql.DataSource
Container
Shareable


User Constraint

Secured Pages

/WEB-INF/view/*
/myAgenda
/myFeed
/myLog
/viewAgenda
/viewLog
/viewProfile
POST
GET



USER



FORM
exerciseReal

/myFeed /badlogin.jsp

my sun-web.xml




/Exercise

USER
USER


ADMIN
ADMIN


Keep a copy of the generated servlet class' java code.

and

swchan2
Offline
Joined: 2005-03-29

Do you see any exceptions or errors in the server.log?
Is the connection pool setting correct?

guiomie
Offline
Joined: 2010-08-23

My connection pools are ok I think.
It is a javax.sql.Datasource with class name com.mysql.jdbc.jdbc2.optional.MysqlDatasource

I see those exceptions:

org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:679)
at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:138)
at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:100)
at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
at org.jboss.weld.servlet.HttpSessionManager_$$_javassist_28.setSession(HttpSessionManager_$$_javassist_28.java)
at org.jboss.weld.servlet.ServletLifecycle.restoreSessionContext(ServletLifecycle.java:148)
at org.jboss.weld.servlet.ServletLifecycle.beginSession(ServletLifecycle.java:71)
at org.jboss.weld.servlet.WeldListener.sessionCreated(WeldListener.java:126)
at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:411)
at org.apache.catalina.session.StandardSession.setId(StandardSession.java:391)
at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:803)
at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:326)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2868)
at org.apache.catalina.connector.Request.getSession(Request.java:2566)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:919)
at org.apache.catalina.authenticator.AuthenticatorBase.getSession(AuthenticatorBase.java:859)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:233)
at com.sun.web.security.RealmAdapter.invokeAuthenticateDelegate(RealmAdapter.java:1187)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:619)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:615)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)

swchan2
Offline
Joined: 2005-03-29

I remember that there was related issue in this area.
Can you download the latest build and try it again?
Thanks.

guiomie
Offline
Joined: 2010-08-23

Would downgrading to v2 resolve this issue?

swchan2
Offline
Joined: 2005-03-29

The issue mentioned below has been fixed. What error do you have in exception log? Which version of GlassFish are you using?

guiomie
Offline
Joined: 2010-08-23

I am using GlassFish Server Open Source Edition 3.0.1 (build 22)

Here is the error in my log:

INFO: Exercise was successfully deployed in 2 761 milliseconds.
INFO: PWC2787: Session event listener threw exception
org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:679)
at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:138)
at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:100)
at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
at org.jboss.weld.servlet.HttpSessionManager_$$_javassist_26.setSession(HttpSessionManager_$$_javassist_26.java)
at org.jboss.weld.servlet.ServletLifecycle.restoreSessionContext(ServletLifecycle.java:148)
at org.jboss.weld.servlet.ServletLifecycle.beginSession(ServletLifecycle.java:71)
at org.jboss.weld.servlet.WeldListener.sessionCreated(WeldListener.java:126)
at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:411)
at org.apache.catalina.session.StandardSession.setId(StandardSession.java:391)
at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:803)
at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:326)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2868)
at org.apache.catalina.connector.Request.getSession(Request.java:2566)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:919)
at org.apache.catalina.authenticator.AuthenticatorBase.getSession(AuthenticatorBase.java:859)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:233)
at com.sun.web.security.RealmAdapter.invokeAuthenticateDelegate(RealmAdapter.java:1187)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:619)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:615)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)

GRAVE: PWC6117: File "C:\Users\Guillaume\Documents\NetBeansProjects\Exercise\build\web\WEB-INF\view\index_old.jsp.jsp" not found
ATTENTION: Internal error flushing the buffer in release()

Thanks,

swchan2
Offline
Joined: 2005-03-29

Do you have the file index_old.jsp.jsp? Do you enable CDI?

guiomie
Offline
Joined: 2010-08-23

From what I understand CDI is enbled if the beans.xml is existant, so yes I have CDI enabled.

I have a file index_old.jsp, i changed it for index_old.jsp.jsp and now the missing file was index_old.jsp ....really wierd.

guiomie
Offline
Joined: 2010-08-23

In my index_old.jsp i had an include, that was an url pattern. So I deleted this include and simply putted the text "You are logged in". I still have the no redirection problem when i submit my id and password. But If i type one of the protected url pattern, they dont show the .jsp they are linked to, but the
/index_old.jsp. This is really messed up. I feel like switching back to php.