trying to build new jsf plugin - getting "SEVERE: Unable to obtain InjectionProvider"
Been trying to build a jsf2 plugin from scratch - published one never seems to work with grails 2 framework.
I using GGTS 3.3 latest build, and groovy 2.1 compiler option
I am doing this a plugin and getting a deployment error like this
in order to get here I have been slowly building the doWithXML closure up like this (based on simple example I did with jsf and spring only - no grails
first in buildConfig.groovy I have added the following dependencies
I have copied my faces-config to the plugin WEB-INF from the jsf-spring integration project like this
lastly I have edited the doWithXMl closure like this
which when I run the plugin produces a web.xml like this
which I think looks ok - as I am using embedded tomcat I leave the listener
<listener-class>com.sun.faces.config.ConfigureListener</listener-class> in the web.xml
all seems to go fine till I it trys to initialise the WebApplicationContext where it throws this error
I don't get this error when I do a manual dynamic web project and include the 3.2.4 spring libraries and morjarr 2.2 - that was working happily
however when running as grails plugin I get this missing injectionProvider error
what am I missing under grails - is this a jar I have to include for tomcat or what ?
cant seem to track down whats really dfifferent from my had crafted dynamic web project
would appreciate any helpful pointers here
Been trying to build a jsf2 plugin from scratch - published one never seems to work with grails 2 framework.
I using GGTS 3.3 latest build, and groovy 2.1 compiler option
I am doing this a plugin and getting a deployment error like this
Code:
...
INFO: Initializing Spring root WebApplicationContext
Aug 22, 2013 3:30:04 PM javax.faces.FactoryFinder$FactoryManager copyInjectionProviderFromFacesContext
SEVERE: Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?
Aug 22, 2013 3:30:04 PM javax.faces.FactoryFinder$FactoryManager getFactory
SEVERE: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory. Attempting to find backup.
Aug 22, 2013 3:30:04 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
in order to get here I have been slowly building the doWithXML closure up like this (based on simple example I did with jsf and spring only - no grails
first in buildConfig.groovy I have added the following dependencies
Code:
...
grails.servlet.version = "3.0"
...
dependencies {
compile "javax.inject:javax.inject:1"
compile "com.sun.faces:jsf-api:$grails.jsf.version" //jsf
compile "com.sun.faces:jsf-impl:$grails.jsf.version" //jsf
compile "com.sun.faces:jsf-api:$grails.jsf.version" //jsf
compile "javax.servlet:javax.servlet-api:3.0.1" //not sure its needed
compile "javax.servlet.jsp:javax.servlet.jsp-api:2.2.1"
compile "org.glassfish.web:el-impl:2.2"
compile "com.sun.el:el-ri:1.0" // required for tomcat
...
I have copied my faces-config to the plugin WEB-INF from the jsf-spring integration project like this
Code:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<!-- add spring bean resolver for faces -->
<application>
<el-resolver>
org.springframework.web.jsf.el.SpringBeanFacesELResolver
</el-resolver>
</application>
</faces-config>
lastly I have edited the doWithXMl closure like this
Code:
def doWithWebDescriptor = { xml ->
// TODO Implement additions to web.xml (optional), this event occurs before
def contextParams = xml.'context-param'[0]
contextParams + {
'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.STATE_SAVING_METHOD')
'param-value' ('client')
}
'context-param' {
'param-name' ('javax.faces.FACELETS_REFRESH_PERIOD')
'param-value' ('1')
}
}
def servletsList = xml.servlet
def servlets = servletsList[servletsList.size() -1]
// add 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'('*.xhtml')
}
}
def listenersList = xml.'listener'
def lastListener = listenersList[listenersList.size() - 1]
lastListener + {
listener { //setup the faces config listener
'listener-class'('com.sun.faces.config.ConfigureListener')
}
/* listener { //effectivellt the same as GrailsContextLoaderListener set as default
'listener-class'('org.springframework.web.context.ContextLoaderListener')
} */
listener {
'listener-class'('org.springframework.web.context.request.RequestContextListener')
}
}
println xml
}
which when I run the plugin produces a web.xml like this
Code:
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" metadata-complete="true" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>/JsfPlugin-development-null</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>JsfPlugin-development-null</param-value>
</context-param>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class>
</filter>
<filter>
<filter-name>charEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>characterEncodingFilter</param-value>
</init-param>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
<listener>
<listener-class>org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<servlet>
<servlet-name>H2Console</servlet-name>
<servlet-class>org.h2.server.web.WebServlet</servlet-class>
<init-param>
<param-name>-webAllowOthers</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>H2Console</servlet-name>
<url-pattern>/dbconsole/*</url-pattern>
</servlet-mapping>
<!-- Grails dispatcher servlet -->
<servlet>
<servlet-name>grails</servlet-name>
<servlet-class>org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<!-- The Groovy Server Pages servlet -->
<servlet>
<servlet-name>gsp</servlet-name>
<servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class>
<init-param>
<description>Allows developers to view the intermediate source code, when they pass a showSource argument in the URL.</description>
<param-name>showSource</param-name>
<param-value>1</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>gsp</servlet-name>
<url-pattern>*.gsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<!-- 30 minutes -->
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<!--
The order of the welcome pages is important. JBoss deployment will
break if index.gsp is first in the list.
-->
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.gsp</welcome-file>
</welcome-file-list>
</web-app>
which I think looks ok - as I am using embedded tomcat I leave the listener
<listener-class>com.sun.faces.config.ConfigureListener</listener-class> in the web.xml
all seems to go fine till I it trys to initialise the WebApplicationContext where it throws this error
Code:
Aug 22, 2013 3:29:58 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Aug 22, 2013 3:29:58 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Aug 22, 2013 3:29:58 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.39
Aug 22, 2013 3:29:59 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Aug 22, 2013 3:29:59 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Aug 22, 2013 3:30:04 PM javax.faces.FactoryFinder$FactoryManager copyInjectionProviderFromFacesContext
[B]SEVERE: Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?
Aug 22, 2013 3:30:04 PM javax.faces.FactoryFinder$FactoryManager getFactory
SEVERE: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory. Attempting to find backup.[/B]Aug 22, 2013 3:30:04 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:350)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5407)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Aug 22, 2013 3:30:04 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /JsfPlugin threw load() exception
java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:350)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5407)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Aug 22, 2013 3:30:04 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'grails'
Aug 22, 2013 3:30:04 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
| Server running. Browse to http://localhost:8080/JsfPlugin
I don't get this error when I do a manual dynamic web project and include the 3.2.4 spring libraries and morjarr 2.2 - that was working happily
however when running as grails plugin I get this missing injectionProvider error
what am I missing under grails - is this a jar I have to include for tomcat or what ?
cant seem to track down whats really dfifferent from my had crafted dynamic web project
would appreciate any helpful pointers here