`
nbaertuo
  • 浏览: 76134 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

Application was not properly initialized at startu

阅读更多

 

java代码如下

 

import java.util.HashMap;

import java.util.Map;

 

import javax.faces.webapp.FacesServlet;

 

import org.mortbay.jetty.Connector;

import org.mortbay.jetty.Server;

import org.mortbay.jetty.bio.SocketConnector;

import org.mortbay.jetty.servlet.Context;

import org.mortbay.jetty.servlet.DefaultServlet;

import org.mortbay.jetty.servlet.ServletHolder;

import org.springframework.web.context.ContextLoaderListener;

 

import com.sun.faces.config.ConfigureListener;

 

public class JettyStart {

 

    public static void main(String arg[]) {

 

Server server = new Server();

Connector connector = new SocketConnector();

connector.setPort(80);

server.addConnector(connector);

 

Map<String, String> initParams = new HashMap<String, String>();

initParams.put("contextConfigLocation", "/WEB-INF/web-application-config.xml");

initParams.put("javax.faces.DEFAULT_SUFFIX", ".xhtml");

initParams.put("facelets.DEVELOPMENT", "true");

initParams.put("facelets.REFRESH_PERIOD", "1");

initParams.put("com.sun.faces.expressionFactory", "org.jboss.el.ExpressionFactoryImpl");

 

ContextLoaderListener contextLoaderListener = new ContextLoaderListener();

 

ConfigureListener configureListener = new ConfigureListener();

 

 

 

Context context = new Context(server, "/jsf", Context.SESSIONS);

context.setInitParams(initParams);

context

.setResourceBase("E:/sources/spring/spring-webflow-2.0.5.RELEASE/projects/spring-webflow-samples/jsf-booking/src/main/webapp");

 

context.addEventListener(contextLoaderListener);

        

        //没有这个监听的话 就会报错Application was not properly initialized at startu

        context.addEventListener(configureListener);

 

ServletHolder holder = new ServletHolder(new FacesServlet());

context.addServlet(holder, "*.faces");

 

holder = new ServletHolder(new DefaultServlet());

context.addServlet(holder, "*.html");

 

try {

   server.start();

   server.join();

} catch (Exception e) {

   // TODO Auto-generated catch block

   e.printStackTrace();

}

 

    }

 

}


以上ConfigureListener configureListener = new ConfigureListener();这个监听是必须的,ConfigureListener 是jboss和spring对jsf的一个实现,在myface中实现为StartupServletContextListener这个类。

   如果不使用jetty手动加载的话,在web.xml中定义为

 

    <listener>

        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>

    </listener>

 

 

 

 

在没有添加ConfigureListener 监听的时候就会报下面的错误:

2009-05-05 23:28:37.062:/jsf:WARN:  unavailable

java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:725)

at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239)

at javax.faces.webapp.FacesServlet.init(FacesServlet.java:164)

at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:431)

at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:667)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)

at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)

at org.mortbay.jetty.Server.doStart(Server.java:222)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

at JettyStart.main(JettyStart.java:53)

2009-05-05 23:28:37.078::INFO:  Started SocketConnector@0.0.0.0:80

1
0
分享到:
评论

相关推荐

    解决Delphi DBX和MySQL连接的噩梦:DBX Error: Driver could not be properly initialized.

    (DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, ...),我找到了合适的libmysql.dll和dbxmys.dll组合,把下面这个libmysql.dll拷贝到XE的bin目录...

    在64位机器上使用plSQL连接Oracle的问题(SQLNet not properly installed)

    标题中的“在64位机器上使用plSQL连接Oracle的问题(SQLNet not properly installed)”提示了我们在64位操作系统中尝试使用plSQL Developer工具与Oracle数据库建立连接时遇到的一个常见问题,即SQLNet配置不正确。...

    swt资源释放问题

    SWT 资源释放问题详解 SWT(Standard Widget Toolkit)是一种基于 Java 的 GUI 工具包,提供了丰富的图形用户界面组件和事件处理机制。但是, SWT 中的资源释放问题是一件棘手的事情。如果不正确地释放资源,可能...

    delphi连接mysql数据库

    在IT行业中,Delphi是一种流行的面向对象的编程环境,它基于Pascal语言,而MySQL则是一种广泛使用的开源关系型数据库管理系统。将Delphi与MySQL结合使用,开发者可以创建高效、可靠的数据库应用程序。...

    Oracle 回收站功能,彻底删除表ORA-00933:SQL command not properly ended

    ORA-00933: SQL command not properly ended ``` 解决方法是确保SQL语句完整无误,并使用正确的语法进行删除操作。 #### 四、总结 Oracle的回收站功能为用户提供了一个方便的方式来管理数据库对象的删除与恢复,极...

    VisualRoute is not installed properly 解决办法

    visualroute 2010 在使用eclvr14c进行破解时,提示"VisualRoute is not installed properly ",经本人多次跟踪实践发现问题在缺少文件上: 检查安装完后在C:\Documents and Settings\Administrator\下是否有mswin32v16....

    windows resin-pro-3.1.3配置ssl所需dll

    resin-pro-3.1.3配置ssl ssleay32.dll ... com.caucho.config.ConfigException: SSL JNI was not properly initialized. Make sure the resinssl library is properly created and the SSL libraries

    【原创】python报错集

    我们的日常中使用python写程序时累积些常见的报错,熟悉报错种类能快速解决方法

    明宇报表插件/如意报表插件解决浏览器出现Ming-WebReport viewer has not been installed

    当用户遇到“Ming-WebReport viewer has not been installed properly.”的错误提示时,通常意味着报表查看器没有正确安装或者配置不完整,这会影响报表的正常显示和使用。本文将详细介绍如何解决这个问题。 首先,...

    Java中如何使用Draw2D和SWT绘图

    在Java编程中,Draw2D库是一个强大的工具,它允许开发者使用SWT(Standard Widget Toolkit)来创建复杂的图形用户界面,特别适用于绘制图形和图表。Draw2D是Eclipse项目的一部分,它提供了一套丰富的API,可以方便地...

    Android 错误解决

    ### Android错误解决:Conversion to Dalvik format failed: Unable to execute dex: Wrapper was not properly loaded first 在Android开发过程中,开发者可能会遇到多种类型的错误提示。其中,“Conversion to ...

    JCEPolicyJDK8.zip

    当环境为jdk1.8.0_191之前的版本时,使用jdk自带的AES256加密算法时会报异常Given final block not properly padded Input length must be multiple of 16 when decrypting with padded cipher,可通过将此附件解压...

    keeplived离线安装openssl-devel依赖包

    由于公司业务并发比较高需要高可用使用LVS keeplived。在linux系统centos6.5版本中安装keeplived时,需要... OpenSSL is not properly installed on your system. !!! !!! Can not include OpenSSL headers files. !!!

    Launch and wait application to end (8KB)

    标题“Launch and wait application to end (8KB)”指的是一个小型程序或者代码片段,其主要功能是启动一个应用程序并等待该程序执行结束。这个程序可能只有8KB大小,因此它可能是高度优化的,专注于核心功能,以...

    JLink_Windows_V648.zip

    DLL: For the MPC560xx devices, the ECC SRAM was not initialized after connect. Fixed. DLL: Hilscher NetX90 flash bank size, fixed. DLL: Infineon TLE98xx: Some J-Link LITEs could not connect establish ...

    曲线拟合工具CurveExpert 1.0

    + The help file was not terminated when CurveExpert was. Fixed. + The Window and Help menus were moved to more conventional positions on the menu bar. Nov. 4, 1995, v. 1.10: ================...

    unity3d 打包成webgl 错误解决办法

    "il2cpp.exe did not run properly!"这个错误提示表明在编译IL( Intermediate Language)代码到JavaScript和WebAssembly的过程中出现了问题。以下是解决此类问题的一些常见步骤: 1. **检查Unity版本**:确保你...

    解决delphi XE 访问Mysql时DBX Error的梦幻组合

    DBX Error: Driver could not be properly initialized. Client library may be missing, not installed properly, of the wrong version, or the driver maybe be missing from the system path...

    atikmdag-patcher1.4.12 ATI显卡补丁解决A卡安装驱动后显示叹号

    Dual-GPU cards such as the 7990 will not work properly at higher pixel clocks. Compatibility: Version 1.4.12 is compatible with Catalyst 11.9 to Adrenalin 22.4.1. It can be used with future versions ...

Global site tag (gtag.js) - Google Analytics