0

I've probably completely missed something foundational here coming from a classic ASP world, but I'm completely new to JSF and Java. I can't seem to be able to append a query string to my initial page request without it generating an error.

If I type http://localhost:8080/fooBean in my browser there's no error, however, if I use http://localhost:8080/fooBean/index.xhtml?param1=value&param2=value2 it generates the following error:

WELD-001303 No active contexts for scope type javax.enterprise.context.SessionScope

@Named(value = "fooBean")
@SessionScoped
public class fooBean implements Serializable {
    ...
}

Any help or clarification would be greatly appreciated.

Thank you.

Aritz
  • 30,971
  • 16
  • 136
  • 217
Trebor
  • 793
  • 3
  • 11
  • 37
  • 3
    No sure if it can cause problems, but in Java you should always start a class name by a uppercase ie : fooBean > FooBean. – Alexandre Lavoie Dec 13 '13 at 04:48
  • 1
    Are you referencing 'fooBean' as an expression? Is there a #{fooBesn} in your code somewhere? Also what is /fooBean in your URL mapped to? Normally an @Named does not automatically map a bean to a URL pattern (I assume this is just the name of your app). Can you show the index.xhtml code? – Mike Braun Dec 13 '13 at 09:56
  • 1
    Also, in your `web.xml` are you mapping `FacesServlet`? What Container are you using? – John Ament Dec 13 '13 at 11:46
  • John, I'm sorry, I feel really overwhelmed by all of the new Java terminology. I'm not sure what to look for to know what "Container" I'm using. Are you referring to the /faces/* component? – Trebor Dec 13 '13 at 16:48
  • Index.xhtml - Facelet Title #{fooBean.makeWebServiceCall()} #{fooBean.responseToUser} – Trebor Dec 13 '13 at 16:56
  • Okay, I found the problem to the error message. Thanks to all of your suggestions. My class was spelled FooBean but my @Named(value=fooBean). That triggered an error. After changing the case to match, the original error went away. Now I have a new error "WELD-000321 No conversation found to restore for id YQa==" which is one of my parameters in my query string, i.e., id=YQ==. – Trebor Dec 13 '13 at 17:07
  • I solved the last issue as well. Apparently CDI injects a CID parameter into the request object which was in conflict with one of my own parameters. Thank you all. – Trebor Dec 13 '13 at 18:44

0 Answers0