我的麻烦是
IllegalStateException:应用程序在启动时未正确初始化,找不到Factory:javax.faces.application.ApplicationFactory
这是我的配置
catalina.policy里
grant codeBase "http://192.168.0.22:8080/test3/-" {
permission java.security.AllPermission;
};
的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"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!--
Servlets
-->
<servlet>
<servlet-name>facesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
的index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>My first Facelet</title>
</h:head>
<h:body>
<P>Hello Facelets</P>
<P><h:outputLabel value="YES, I AM FACELETS"/></P>
</h:body>
</html>
从API下载 http://javaserverfaces.java.net/download.html
jfs-api.jar
jfs-impl.jar
和NetBeans的另一个库
jstl.jar
树应用
test3
|
-- index.xhtml
|
-- WEB-INF
|
-- web.xml
|
-- lib
|
-- jfs-api.jar
|
-- jfs-impl.jar
|
-- jstl.jar
当我运行tomcat时
$ sh catalina.sh start -security
,错误是
May 7, 2013 9:00:10 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/test3] appears to have started a thread named [pool-4-thread-1] but has failed to stop it. This is very likely to create a memory leak.
May 7, 2013 9:00:10 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/test3] appears to have started a thread named [pool-4-thread-2] but has failed to stop it. This is very likely to create a memory leak.
May 7, 2013 9:00:10 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/test3] appears to have started a thread named [pool-4-thread-3] but has failed to stop it. This is very likely to create a memory leak.
May 7, 2013 9:00:13 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.0 (FCS b23) for context '/test3'
May 7, 2013 9:00:13 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 7, 2013 9:00:13 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/test3] startup failed due to previous errors
May 7, 2013 9:00:13 PM com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:104)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:305)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4245)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4886)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4750)
at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1276)
at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:625)
at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:276)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:170)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:276)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:250)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
将监听器放入web.xml时出现类似错误
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
错误:
May 7, 2013 9:25:54 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/test3] appears to have started a thread named [pool-8-thread-1] but has failed to stop it. This is very likely to create a memory leak.
May 7, 2013 9:25:54 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/test3] appears to have started a thread named [pool-8-thread-2] but has failed to stop it. This is very likely to create a memory leak.
May 7, 2013 9:25:54 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/test3] appears to have started a thread named [pool-8-thread-3] but has failed to stop it. This is very likely to create a memory leak.
May 7, 2013 9:25:54 PM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
May 7, 2013 9:25:54 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.0 (FCS b23) for context '/test3'
May 7, 2013 9:25:54 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 7, 2013 9:25:54 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/test3] startup failed due to previous errors
May 7, 2013 9:25:54 PM com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306)
我该怎么办? 任何想法,因为我没有它
感谢名单
答案 0 :(得分:0)
它发生在我身上,我增加了Tomcat JVM的堆大小,然后就可以了 默认情况下,最小内存为64m,最大内存为256m,我建议将其从512m增加到1024m。