I have two web applications (web-module1.war & web-module2.war) and I want to use a web fragment (web-core.jar) for common servlet declaration like FacesServlet.
When I declare FacesServlet in web.xml no problem, but when I move this declaration to web-fragment.xml I get this error :
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>
I don't have this problem with other servlet/filter declaration !
The web-fragment.xml is in web-core.jar's META-INF folder as well as the faces-config.xml.
The web-core.jar is declared as a maven dependency (I can find it in the WEB-INF/lib).
This is web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" metadata-complete="false"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<absolute-ordering>
<name>core_web_fragment</name>
</absolute-ordering>
</web-app>
And web-fragment.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-fragment metadata-complete="true" version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd">
<name>core_web_fragment</name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-*.xml</param-value>
</context-param>
<!-- /Spring Config -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<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>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>inscription.xhtml</welcome-file>
</welcome-file-list>
</web-fragment>
I'm using Tomcat7
If you are using Apache Myfaces JSF implementation this is a known bug
So u should change it ( use MOJARRA for example)
Related
I am in the process of migrating Struts 2+Jsf 2.x web application from WEB -LOGIC 10.3.3.0 to 12.1.3.0.
I am encountering an error while accessing the pages ,as per my understanding if a JSF tag encounters with a value which is reading from the properties file it is encountering the Issue.And in the same pages I am able to read the struts messages.
I have created a POC with the same jars which my application is using to check the JSF is rendering properly or not.the POC is working fine.
and I placed the POC created page in to my application and tried to access again the same error encounterd.
when I comment the Struts filter in My application ,newly created pages worked fine.
I have tried to upgrade the Struts2jsf plugin.jar to newer versions .
I have removed the jsf-api,jsf -impl,JSTL from the APPINF\LIB.
changed the faces-config xsd to 2.0
but no luck..
Below is the error stack :
java.lang.stackOverflowError.
at java.util.HasMap$treeNode.GetTreeNode(HashMap.java:1873)
at java.util.HasMap.getNode(HashMap.java:573)
at java.util.HashMap.get(HashMap.java:556)
at ognl.ognlRuntime.getParameterTypes(ognlRuntime.java)
at ognl.ognlRuntime.findParameterTypes(ognlRuntime.java)
at ognl.OgnlRuntime.getGetMethod(ognlRuntime.java)
at ognl.ognlRuntime.hasGetMethod(ognlRuntime.java)
....
at org.apache.struts2.jsf.strutsVariableResolver.resolvervariable(StrutsVaraibaleResolver :78)
at com.sun.faces.el.variabelResolverImpl.resolvervariabel(VariableResolverImpl.java:80))
at org.apache.struts2.jsf.strutsVariableResolver.resolvervariable(StrutsVaraibaleResolver :78)
at com.sun.faces.el.variabelResolverImpl.resolvervariabel(VariableResolverImpl.java:80))
at org.apache.struts2.jsf.strutsVariableResolver.resolvervariable(StrutsVaraibaleResolver :78)
at com.sun.faces.el.variabelResolverImpl.resolvervariabel(VariableResolverImpl.java:80))
at org.apache.struts2.jsf.strutsVariableResolver.resolvervariable(StrutsVaraibaleResolver :78)
at com.sun.faces.el.variabelResolverImpl.resolvervariabel(VariableResolverImpl.java:80))
java.lang.ClassCastException:java.lang.StackOverflowerror cannot be cast to java.lang.Excetption
java.lang.ClassCastException:java.lang.StackOverflowerror cannot be cast to java.lang.Excetption
at jsp_servlet._error._jspService(_error.java)
at weblogic.servlet.jsp.Jspbase.service(JsPBase.java)
**
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-Value>classpath:/applicationContext-resources.xml
classpath:/applicationContext-dao.xml
classpath:/applicationContext-service.xml
/WEB-INF/applicationContext.xml
/WEB-INF/applicationContext-Struts.xml
/WEB-INF/Secuirty.xml
</param-Value>
</context-param>
<context-param>
<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLE</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet>
<servlet-name>faces</servlet-name/>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class/>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>JSPSupportServlet</servlet-name>
<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
</servlet>
<filter>
<filter-name>struts-prepare</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
</filter>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphone.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter>
<display-name>richfaces</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh </filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD </dispatcher>
<dispatcher>INCLUDE </dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts </filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>richfaces</filter-name>
<url-pattern>*.html</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh </filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
faces-config.xml :
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2"
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<resource-bundle>
<base-name>message</base-name>
<var>msg</var>
</resource-bundle>
</application>
I have added additionally to the faces config below handler which worked me to display the login page
<view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler>
while navigating to any page above error encountering.
Below are the list of jars presented :
activation-1.1.jar
antlr-2.7.6.jar
aopaliance-1.0.jar
asm3.3.jar
aspectjrt-1.6.6.jar
aspectjweaver-1.6.6.jar
axiom-api-1.2.5.jar
cglib-2.2.jar
commons-beanutils-1.7.0.jar
commons-Codec-1.5.jar
Commons-collections-3.2.jar
commons-digester-1.8.jar
commons-el.jar
commons-fileupload-1.2.1.jar
commons-io-1.4.jar
commons-lang-2.4.jar
commong-logging-1.1.1.jar
commons-pool-1.2.jar
commons-vfs-1.0.jar
compass-2.1.3.jar
jsf-facelets 1.1.15B1.jar
richfaces-impl 3.3.jar
richfaces-ui 3.3Final.jar
standard.jar
jstl.jar
jsf-api2.0.2.jar
jsf-impl 2.0.2.jar
log4j-1.2.13 jar
ognl2.7.3.jar
sitemesh-2.4.2.jar
richfaces-api-3.3.3.Final.jar
richfaces-imple-jsf2-3.3.3.Final.jar
richfaces-ui-3.3.3.Final.jar
slf4j-api.jar
slf4j-log4j12.jar
hibernate-core.jar
hibernate-search.jar
hibernate-commons-annotations.jar
hibernate-annotations.jar
standard1.1.2.jar
struts2-corre-2.1.8.jar
struts2-jsf-plugin-2.1.8.1
wsdl4j-1.6.2.jar
xml-apis-1.0.b2.jar
xml-resolver-1.2.jar
xmlbeans-2.4.0.jar
xmlSchema-core 2.0.jar
xwork-core2.1.6.jar
etc...
eg code causing the errors :
hello.jsp
<%# taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%# taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<head>
<title>JSF Example</title>
<head>
<body>
<h2>JSF Example - </h2>
<h:form>
<h:inputText value="#{msg.testmessage}"></h:inputText>
</h:form>
<body>
</html>
I am struggling a lot what went wrong.and the application is running fine in wls 10.3.3.0.
appreciated your help.
Regards,
Ganesh Karanam
I'm using Vaadin 7.3.2 in OSGI, all vaadin bundles are active. When server is off, there is no session expired notification in page. so could you help me please...
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="vaadin-portal" version="2.5">
<display-name>Vaadin Web Application</display-name>
<context-param>
<description>Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
<servlet>
<servlet-name>Portal Vaadin App</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<init-param>
<description>Vaadin UI</description>
<param-name>UI</param-name>
<param-value>com.example.MainUI</param-value>
</init-param>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Portal Vaadin App</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
I´ve a Maven Web Application with JSF2, Primefaces, Spring, and Hibernate.
So I recently migrated my web application from Glassfish 3 to Weblogic 12c.
When it run on Glassfish it worked fine but after migrating my application after some problems with the aspect libraries I managed to deploy it. But after running my application I found a bug. When my xhtml runs and loads data from my managed bean constructor it gets the data and renders it as expected, but if I fire an ajax event it gets the expected data but it doesn´t render the data and I get the next exception:
<11/01/2014 07:56:27 PM CST> <Error> <javax.enterprise.resource.webcontainer.jsf.application> <BEA-000000> <Error Rendering View[/pages/dashboard.xhtml]
java.lang.IllegalStateException: WebXml is not initialized yet. Please use #init(ServletContext) method to manually initialize it.
at org.omnifaces.config.WebXml.checkInitialized(WebXml.java:313)
at org.omnifaces.config.WebXml.getFormLoginPage(WebXml.java:294)
at org.omnifaces.context.OmniPartialViewContext$OmniPartialResponseWriter.startDocument(OmniPartialViewContext.java:253)
at org.primefaces.context.PrimePartialResponseWriter.startDocument(PrimePartialResponseWriter.java:134)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:287)
Truncated. see log file for complete stacktrace
>
<11/01/2014 07:56:27 PM CST> <Error> <HTTP> <BEA-101020> <[ServletContext#11936366[app:geotrack1-1.0-SNAPSHOT module:geotrack1-1.0-SNAPSHOT.war path:null spec-version:3.0]] Servlet failed with an Exception
java.lang.IllegalStateException: WebXml is not initialized yet. Please use #init(ServletContext) method to manually initialize it.
at org.omnifaces.config.WebXml.checkInitialized(WebXml.java:313)
at org.omnifaces.config.WebXml.getFormLoginPage(WebXml.java:294)
at org.omnifaces.context.OmniPartialViewContext$OmniPartialResponseWriter.startDocument(OmniPartialViewContext.java:253)
at org.primefaces.context.PrimePartialResponseWriter.startDocument(PrimePartialResponseWriter.java:134)
at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:201)
Truncated. see log file for complete stacktrace
>
<11/01/2014 07:56:27 PM CST> <Notice> <Diagnostics> <BEA-320068> <Watch "UncheckedException" in module "Module-FMWDFW" with severity "Notice" on server "AdminServer" has triggered at 11/01/2014 07:56:27 PM CST. Notification details:
WatchRuleType: Log
WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'WL-101020') OR (MSGID = 'WL-101017') OR (MSGID = 'WL-000802') OR (MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
WatchData: DATE = 11/01/2014 07:56:27 PM CST SERVER = AdminServer MESSAGE = [ServletContext#11936366[app:geotrack1-1.0-SNAPSHOT module:geotrack1-1.0-SNAPSHOT.war path:null spec-version:3.0]] Servlet failed with an Exception
Does anyone knows what´s happening??
Here is my web.xml
<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<!-- Spring Context Configuration' s Path definition -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- The Bootstrap listener to start up and shut down Spring's root WebApplicationContext. It is registered to Servlet Container -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- JSF Servlet is defined to container -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Mapping with servlet and url for the http requests. -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<!-- Configuracion de Quartz -->
<listener>
<listener-class>org.quartz.ee.servlet.QuartzInitializerListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>
15
</session-timeout>
</session-config>
</web-app>
In my weblogic.xml I´ve:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
<jsp-descriptor>
<keepgenerated>true</keepgenerated>
<debug>true</debug>
</jsp-descriptor>
<context-root>/geotrack1</context-root>
</weblogic-web-app>
I hope someone knows what´s happening.
Thanks in advace.
It's already reported as issue 273 at 29 october 2013 and fixed for 1.7, which has just been released:
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>1.7</version>
</dependency>
To fix it I change in my pom from omnifaces 1.6.3 to ominifaces 1.5
I created my project on netbeans and checked spring mvc framework and hibernate.
This created a web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
</web-app>
However, whenever I add
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
I'm able to deploy it on tomcat but not able to run it :(
I get this error:
FAIL - Deployed application at context path /project but context failed to start
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
Anyone has suggestions to fix it?
I'm trying to use Netbeans to make a web application using facelets. I want to use Icefaces as my widgets. I get the following error message
Warning: This page calls for XML namespace http://www.icefaces.org/icefaces/components declared with prefix ace but no taglibrary exists for that namespace.
and the control fails to appear. I have a most simple file
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:ice="http://www.icesoft.com/icefaces/component"
>
<head>
<title>Shalom Elias</title>
</head>
<body>
<h:form id="form">
Shalom
<ace:dateTimeEntry id="date1" value="#{backing.date1}" renderAsPopup="true"/>
</h:form>
</body>
</html>
The web.xml looks like
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<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>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<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>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>welcome.jsf</welcome-file>
</welcome-file-list>
I think the taglibrary should be in icefaces-compat.jar which is available on what should be the class path. BTW, I used ace:, but ice: has exactly the same problem. Unfortunately, as a new user, I can't upload a snapshot of my directory structure but the jar files are located under web/WEB-INF/classes, which looks logical to me.
The question is: what is missing???
Thanks,
Ilan
Put the icefaces jar file in:
WEB-INF/lib
instead of WEB-INF/classes folder.
Put the icefaces-ace.jar file in:
WEB-INF/lib
instead of WEB-INF/ classes folder.
And enjoy!