FacesContext.getCurrentInstance() is null

Posted on 2010-11-19
Last Modified: 2012-05-10
I have developed a JSF portlet and in ManagedBean I am trying to get FacesContext for exception handling. But I am getting FacesContext.getCurrentInstance() is null. I am attaching web.xml portion below. ANy help would be appreciated.
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-name>Faces Servlet</servlet-name>

Open in new window

Question by:vsudip
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 10

Accepted Solution

Hegemon earned 500 total points
ID: 34173103
Make sure the request is made using /faces in the URL

Author Comment

ID: 34178186
I have weblogic portal application & placed JSF portlet in this. So how should I get the FacesContext ?
LVL 10

Expert Comment

ID: 34179308
See my previous question - is the request being made using "/faces" in the URL when you attempt to retrieve FacesContext ?

Author Comment

ID: 34179393
No..... I do not think so..... I am executing my portal file on server (for ex:  htttp://......../xyz.portal). Is there any other way to fetch the portlet detail so that FacesContext won't be null or any change in web.xml required ?
LVL 10

Assisted Solution

Hegemon earned 500 total points
ID: 34179414
FacesContext will only be active if the request it received is a Faces Request. For a request to be a Faces Request, it should be passed through FacesServlet - in your configuration, it should start with "/faces" but you can also add other mapping, i.e. *.xhtml

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse with Angularjs2.0 3 74
Why my table column Id is not passed to java object? 4 46
ejb wildfly example 2 111
batch vs regular insert in spring DAO 2 50
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question