1

I am trying to create a basic JSF 2.0 + Facelet application, but getting this error:

 java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory

I am using following JARs:

  • jsf-impl-2.1.0
  • jsf-api-2.1.0
  • jstl-1.2
  • el-ri-1.2
  • Apache MyFaces 2.1.5
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Aashish
  • 31
  • 1
  • 1
  • 7

1 Answers1

0

I am using following JARs

  • jsf-impl-2.1.0
  • jsf-api-2.1.0
  • Apache MyFaces 2.1.5

You seem to be mixing Mojarra and MyFaces implementations. This is not right. Use the one or the other, not both. The jsf-impl and jsf-api JARs are from Mojarra. Remove either them, or the MyFaces one. Mixing them will result in conflicts in finding the right implementation factories, exactly as the exception message is trying to tell you.

Further,

  • el-ri-1.2

this is supposed to be already provided by Tomcat. You're not supposed to supply your own. Remove it altogether.

All with all, given this pretty major mistake, I have the impression that you're not reading a proper tutorial/resource while learning JSF. I recommend to verify if this isn't just your own "stupid mistake", or if the resource really incorrectly said it so. In the latter case, consider looking for another one.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • As you suggested i removed Apache MyFaces and el-ri jar. However now i am getting FacesFileNotFound Exception. In my deployment descriptor i have provided the servlet mapping as Faces Servlet *.faces – Aashish Feb 18 '13 at 11:12
  • Finally, JSF works! Your URL is only wrong, but that's a completely different problem :) This related question may help you to understand it better: http://stackoverflow.com/questions/3008395/jsf-facelets-sometimes-i-see-the-url-is-jsf-and-sometimes-xhtml-why/3008504#3008504 I recommend to just map the JSF servlet on `*.xhtml` and use `.xhtml` URLs all time. – BalusC Feb 18 '13 at 11:13
  • Hello Balus, i changed the servlet mapping now to Faces Servlet *.xhtml Still i am geting the same FacesFileNotFound Exception – Aashish Feb 18 '13 at 11:23
  • If you're confident that the URL is right, then the file is simply not in the right place. Or, if the file is actually in the right place, then the URL is still wrong ;) Again, this is completely unrelated to your initial question. Your initial problem has been answered and solved. JSF is now properly initialized and you don't get the factory exception anymore! For your new question/problem, just ask a new question if you still can't figure out what you did wrong. – BalusC Feb 18 '13 at 11:24