• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

new to forum need some help with Myfaces(and mjorra) and grails 2.03

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
been a closet grails developer and i was trying to have a crack with primefaces and JSF through grails

had a ton of problems

1. JSF2 plugin deosnt work under grails 2 and hasnt been touched for 2 years now.
2. Tried deconstructing but didnt get very far
3. decided to have a go rolling my own plugin using spring faces and weblow (grails is essentially spring under the covers) and webflow has a primefaces demo you can get.

did the standalone spring webflow/faces - maven example and it seemend to work (no grails)

then tried to do a very simple plugin and i'm had no end of difficulties. essentially my plugin works if a i generate as a war and deploy on tomcat outside of STS - but when i run in STS in embedded tomcat mode it just wont work

i get a couple of variations of related errors along the lines



how did i get here -

1. i edited BuildConfig to get the v3 headers and add my depdencies like so



this adds the jars to the ivy cache for me

then in a grails project you dont get a web.xml - grails generates one on the fly somehow - but you can interact with it.

2. in the plugin descriptor doWithWeb descriptor i add the spring weblow dispatcher servlet and the faces servlet

heres my helper class - called from the closure



in order so i could see if i can get to the code and have a look - this versions just hase my own - then extend wrapper on the apache servlet config listener and the faces servlet

the generated web.xml from my closure looks like this - so this is grails and my additions




i have a quick rummage in the do with do with aplication context - just to get some variables printed - ths is what i dumped out the log. i can read the applicationContext bean file as its in the WEB-INF directory as you can see - but theres no web.xml file its all handled on the fly by grails



then i get my error

| Error 2012-04-23 18:09:50,165 [pool-6-thread-1] ERROR [localhost].[/aflowMyfacesPlugin] - StandardWrapper.Throwable
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:286)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:206)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:116)
at org.apache.myfaces.webapp.MyFacesServlet.init(MyFacesServlet.java:100)
at com.softwood.web.WillsMyfacesServlet.init(WillsMyfacesServlet.groovy)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)


I have also seen an error saying it cant find any servlet mappings sometimes when i run it.


as i said - if i generate as awar and put into tomcat v7 manually outside of STSgraile/embedded tomcat - i can get my simple /index.gsp, and my /app/home (this is s imple facelet .xhtml file nicked from the spring web flow sample it works and renders to browser.

when i run the same code in embedded dev model - it fails as shown

I have noted that grails does stuff in the backgorund in the .grails\2.0.3\projects\aflowMyfacesPlugin directory - when you do a run-app it generates a web.xml.tmp file - but it doesnt have my servlets added it in from the closure - its just the grails default form.

if a generate a WAR - file that goes into your workspace/plugin/target dir does have web.xml with my edits in it - and as i said this will run under tomcat ok - no errors

lastly in run-app embedded mode if you try and access the facelets page /app/home i get an error like this




I dont know what all that factory stuff is but i dont have it - this opnly happens in embedded mode.


My suspicion is that the missing web.xml in the STS/dev mode screws up and it cant find the faces servlet/servlet mappings and fails to initialise


i'm really stumped - i want to use STS in dev mode - is the natural way to work - but this failure to init faces is critical really and i dont know where to go next . had this on the grails forum but no response to all my threads on this

anyone here know what this faces set of issues is really tell me ??

yours in desperation
 
william Woodman
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
heres the other message i occasionaly get on embedded mode - wich makes be believe that wrong web.xml gets picked without my additions

23-Apr-2012 22:05:44 org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
WARNING: No mappings of FacesServlet found. Abort initializing MyFaces.


| Error 2012-04-23 22:05:44,467 [pool-6-thread-1] ERROR [localhost].[/aflowMyfacesPlugin] - StandardWrapper.Throwable
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:286)
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic