• Post Reply Bookmark Topic Watch Topic
  • New Topic

getting SEVERE:Unable to obtain InjectionProvider from init time FacesContext from tomcat and grails

 
william Woodman
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
been trying to slowly build my own grails jsf plugin - current one doesn't seem toi work with latest grails builds.

doing this from first principles and I have a working JSF-spring project that I had crafted using eclipse dynamic web project and maven to handle dependencies.


I then went back to grails plugin and started to build it up slowly - however I am having error I don't see the hand crafted dyn web project

under grails you don't have a web.xml to edit its generated for you - but you can instrument how the file is generated

the error I am getting for embedded tomcat looks like this



what I have done so far is edit the buildConfig script like this


I have copied my faces-config from the jsf spring project into grails plugin looking like this



and in the plugin descriptor I have edited the doWithWeb closure like this



all of which gives me this dynamically generated web.xml - which I think looks ok



however when I run this plugin I get the error about the InjectionProvider for the embedded tomcat.



I don't get this with the hand crafted jsf/spring sample project - what am I missing for grails is it a jar etc, or is it that the packaging process for the plugin isn't copying certain dependencies into the plugin war.

If I cant get this working the rest I intend to do falls right here - help appreciated at this point

 
william Woodman
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh man - finally after about of year of trying to fix this embedded tomcat problem in grails I think I have found an answer

the clue is embedded half way down this post cross ref link

its something to do with the fact that grails dynamically generates the web.xml for the tomcat build and the web.xml is not in your project directly. Somehow this means that it doesn't quite startup the faces config correctly - don't ask me why

the fix is to add this contextParam into the generated web.xml in the doWithXml closure in the plugin file using the groovy dsl format




this seems to fire the missing faces config - and bingo your plugin starts to work and the javax.faces factory messages etc disappear and it all starts working



Man am I a happy jag - one years of pain gone in three lines of config !


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!