Results 1 to 5 of 5

Thread: Login sends me to random JavaScript page?

  1. #1
    Join Date
    Jul 2007
    Posts
    16

    Default Login sends me to random JavaScript page?

    Hey all, an odd one.

    Every time I log in the first time into my app, I want to go to index.jsp. Sadly, it usually takes me to a random JavaScript page that index.jsp uses. I usually have to press back and then log in to make it work. Once logged in, it works great.

    Any ideas?

    Thanks in advance,
    -Lally

  2. #2
    Join Date
    Jul 2007
    Posts
    16

    Default Spring Bean lookup in an Acegi UserDetailsService, AuthenticationProvider

    This seems to look like a filter-order issue. My login ends up trying to look up a bean, which calls this static method:
    Code:
    	public static WebApplicationContext getContext() {
    		try {
    			return WebApplicationContextUtils.getWebApplicationContext(ServletActionContext.getServletContext());
    		} catch (Throwable t) {
    			log.error("Couldn't get a WebApplicationContext", t);
    			return null;
    		}
    	}
    Unfortunately, I get an exception:
    Code:
    java.lang.IllegalArgumentException: ServletContext must not be null
    	at org.springframework.util.Assert.notNull(Assert.java:113)
    	at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:54)
    	at edu.vt.iddl.meval.util.SpringUtils.getContext(SpringUtils.java:31)
    	at edu.vt.iddl.meval.util.SpringUtils.getBean(SpringUtils.java:44)
    	at edu.vt.iddl.meval.util.Bean.get(Bean.java:18)
    	at edu.vt.iddl.meval.auth.EdAuthDelegate.canonicalize(EdAuthDelegate.java:60)
    	at edu.vt.iddl.meval.auth.EdAuthDelegate.affiliations(EdAuthDelegate.java:89)
    	at edu.vt.iddl.meval.auth.AuthDelegateProvider.authenticate(AuthDelegateProvider.java:106)
    	at org.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
        ...
    It looks like the ServletActionContext doesn't get initialized until the Struts 2 filter stack is loaded, but that's after the Acegi stuff. Unfortunately, my delegate that looks up the username/password/userdetails is called from Acegi, but doesn't have the ServletActionContext data set up.

    Any ideas how else I could get the WebApplicationContext for the current thread? The bean that I'm looking up is a single instance that doesn't change throughout the run of the app.

    Thanks in advance,

    -Lally

  3. #3
    Join Date
    Jul 2007
    Posts
    16

    Default

    Nope, that wasn't it. I fixed that exception. Now no errors are logged :-(.

    Well, I suppose nobody here has any ideas. That's ok. It's just time for me to roll up my sleeves and trace through some source code .

    I'll let y'all know what's going on, in case anyone else hits into this later.

  4. #4
    Join Date
    Jun 2007
    Posts
    3

    Default

    hey, have you already fixed this problem. I have the same problem too.

  5. #5
    Join Date
    Jul 2007
    Posts
    16

    Default OK, Found it

    The problem was that the dependent pages, /struts/** (e.g. CSS sheets, javascript, etc.) fell into the default requirement of needing a user logged in.

    I added this line:
    /struts/**=ROLE_ANONYMOUS,ROLE_USER

    And it seems to work fine now.

    HTH anyone else who has this weird one!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •