folks desperate for some help
i'm a closet grails user - and i was trying to get JSF working with grails. the JSF2 plugin doesnt work at all under 2.0
tried a different tack and built myself a plugin and tried to use mojarra, and cut and pasted webflow 2.3.1. sample stuff into my plugin
this fails completely in embedded tomcat 7 dev mode see this posted on grails forum
http://grails.1312388.n4.nabble.com/...td4568248.html
i get an error like this
however when i generate a seperate WAR built in grails and deploy to tomcat 7 my static and facelet page renders of (saw something about problems with mojarra outsid of a WAR)Code:| Error 2012-04-18 17:02:39,390 [pool-6-thread-1] ERROR [localhost].[/aGflow] - StandardWrapper.Throwable java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1008) at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:343) at javax.faces.webapp.FacesServlet.init(FacesServlet.java:302) ...
so in desperation i tried MyFaces instead and got further - but still doesnt work
so here goes. In my buildConfig i have this
in my doWithWebDescriptor closure in the plugin i add the webflow/faces bits into the web.xml as per the 2.3.1 documentationCode:repositories { grailsCentral() mavenRepo "http://tomcat.apache.org/dev/dist/m2-repository" // uncomment the below to enable remote dependency resolution // from public Maven repositories //mavenCentral() //mavenLocal() //mavenRepo "http://snapshots.repository.codehaus.org" //mavenRepo "http://repository.codehaus.org" //mavenRepo "http://download.java.net/maven/2/" //mavenRepo "http://repository.jboss.com/maven2/" } dependencies { // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. // runtime 'mysql:mysql-connector-java:5.1.5' compile 'org.springframework.webflow:spring-webflow:2.3.1.RELEASE', 'org.springframework.webflow:spring-faces:2.3.1.RELEASE', //'org.springframework.security:spring-security-core:3.1.0.RELEASE', 'org.springframework:spring-webmvc:3.1.1.RELEASE', 'org.apache.myfaces.core:myfaces-api:2.1.7', 'org.apache.myfaces.core:myfaces-impl:2.1.7' }
If i run this in standalone tomcat it works and my /app/home facelets page is renderedCode:static def doWithWebDescriptor (def xml) { /** * Spring web root context */ def envParams = xml.'context-param'[0] /* grails already sets this for us envParams + { 'context-param' { 'param-name'('contextConfigLocation') 'param-value'('/WEB-INF/applicationContext.xml') } } */ def listenersList = xml.'listener' def listeners = listenersList[listenersList.size() - 1] listeners + { listener { 'listener-class'('org.apache.myfaces.webapp.StartupServletContextListener') } } /** * JSF2 Implementation * */ envParams + { 'context-param' { 'param-name'('javax.faces.DEFAULT_SUFFIX') 'param-value'('.xhtml') } 'context-param' { 'param-name'('javax.faces.PROJECT_STAGE') 'param-value'('Development') } 'context-param' { 'param-name'('javax.faces.FACELETS_REFRESH_PERIOD') 'param-value'('1') } } println "add faces servlet" def servletsList = xml.servlet def servlets = servletsList[servletsList.size() -1] // load the Faces servlet servlets + { servlet { 'servlet-name'('Faces Servlet') 'servlet-class'('javax.faces.webapp.FacesServlet') 'load-on-startup'('1') } } def mappingsList = xml.'servlet-mapping' def mappings = mappingsList[mappingsList.size() - 1] mappings + { 'servlet-mapping' { 'servlet-name'('Faces Servlet') 'url-pattern'('*.faces') } } /** * MVC Implementation * */ println "add MVC servlet" servletsList = xml.servlet servlets = servletsList[servletsList.size() -1] // load the Faces servlet servlets + { servlet { 'servlet-name' ('springmvc') 'servlet-class' ( 'org.springframework.web.servlet.DispatcherServlet') 'init-param' { 'param-name' ('contextConfigLocation' ) 'param-value' ('/WEB-INF/spring/appServlet/servlet-context.xml' ) } 'load-on-statup' ('1') } } mappingsList = xml.'servlet-mapping' mappings = mappingsList[mappingsList.size() - 1] mappings + { 'servlet-mapping' { 'servlet-name'('springmvc') 'url-pattern'('/app/*') } } println "final web.xml config looks like :" println renderFormattedXML (xml) return xml }
if i run this in embedded tomcat mode it fails
details in reply post below - the first time i posted this said it was too long - so here goes for part 2


Reply With Quote
