2007年12月14日
严重: Unable to instantiate ExpressionFactory 'com.sun.el.ExpressionFactoryImpl'
2007-12-13 15:00:08 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class
com.sun.faces.config.ConfigureListener
java.lang.IllegalStateException: No application context active
at org.jboss.seam.Component.forName(Component.java:1799)
at org.jboss.seam.Component.getInstance(Component.java:1849)
at org.jboss.seam.Component.getInstance(Component.java:1844)
at org.jboss.seam.Component.getInstance(Component.java:1821)
at org.jboss.seam.Component.getInstance(Component.java:1816)
at org.jboss.seam.core.ResourceLoader.instance(ResourceLoader.java:97)
此错误是因为缺少 el-ri-1.0.jar 包导致
Posted in
JSF/myfaces |
0
Comment »
2007年12月14日
开发环境 JDK1.6 ,Tomcat6.0.14 eclipse3.3 tomcatPluginV321
------------------------------------------------------------------------
Seam2.0.0GA
Spring2.0.7
Hibernate3.2.5GA
JPA1.0
------------------------------------------------------------------------
hibernate
hibernate-3.2.5.jar
antlr-2.7.6.jar
cglib-nodep-2.1_3.jar
dom4j-1.6.1.jar
jta-spec1_0_1.jar
hibernate-entitymanager-3.3.1.GA.jar
hibernate-annotations-3.3.0.GA.jar
hibernate-commons-annotations-3.0.0.GA.jar
hibernate-search-3.0.0.GA.jar
hibernate-validator-3.0.0.GA.jar
lucene-core-2.2.0.jar
------------------------------------------------------------------------
JPA
persistence-api-1.0.jar
------------------------------------------------------------------------
Spring
spring-2.0.7.jar
------------------------------------------------------------------------
jboss seam2.0.0GA
javassist-3.4.ga.jar
jboss-seam-2.0.0.GA.jar
jboss-seam-ioc-2.0.0.GA.jar
jboss-seam-ui-2.0.0.GA.jar
jboss-archive-browsing-2.0.2.Alpha.jar
jboss-el-1.0.jar
jsf-api-1.2_06-b02-FCS.jar
jsf-impl-1.2_06-b02-FCS.jar
jsf-facelets-1.1.14.jar
el-api-1.0.jar
el-ri-1.0.jar
jsp-api-2.1.jar
jstl-1.1.2.jar
standard-1.1.2.jar
richfaces-api-3.1.2.GA.jar
richfaces-impl-3.1.2.GA.jar
richfaces-ui-3.1.2.GA.jar
------------------------------------------------------------------------
Apache commons
commons-logging-api-1.1.1.jar
commons-beanutils-1.7.0.jar
commons-collections-3.1.jar
commons-digester-1.8.jar
log4j-1.2.14.jar
Posted in
JSF/myfaces |
0
Comment »
2007年12月05日
修改myfaces使javax.faces.CONFIG_FILES可加载用通配符表示的xml
修改后可书写
<context-param>
<description/>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-configs/*-config.xml</param-value>
</context-param>
思想来源于spring的Resource[]配置,这样增加一个config配置后不用更改web.xml
如下实现
要修改的地方org.apache.myfaces.config.FacesConfigurator类的
feedContextSpecifiedConfig()方法
实现主要使用了spring类中的ServletContextResourcePatternResolver
传入一个通配符字符串然后得到一个Resource资源数组
private void feedContextSpecifiedConfig() throws IOException, SAXException{
String configFiles = _externalContext.getInitParameter(FacesServlet.CONFIG_FILES_ATTR);
if (configFiles != null)
{
StringTokenizer st = new StringTokenizer(configFiles, ",", false);
while (st.hasMoreTokens())
{
String systemId = st.nextToken().trim();
if (log.isWarnEnabled() && DEFAULT_FACES_CONFIG.equals(systemId))
log.warn(DEFAULT_FACES_CONFIG + " has been specified in the " + FacesServlet.CONFIG_FILES_ATTR
+ " context parameter of " + "the deployment descriptor. This should be removed, "
+ "as it will be loaded twice. See JSF spec 1.2, 10.1.3");
ServletContext _servletContext = (ServletContext) _externalContext.getContext();
ServletContextResourcePatternResolver servletContextResourcePatternResolver =
new ServletContextResourcePatternResolver(_servletContext);
Resource[] resources = servletContextResourcePatternResolver.getResources(systemId);
for(int i=0;i<resources.length;i++){
Resource resource = resources[i];
//InputStream stream = _externalContext.getResourceAsStream(systemId);
InputStream stream = resource.getInputStream();
if (stream == null)
{
log.error("Faces config resource " + systemId + " not found");
continue;
}
if (log.isInfoEnabled())
log.info("Reading config " + systemId);
getDispenser().feed(getUnmarshaller().getFacesConfig(stream, systemId));
stream.close();
}
}
}
}
Posted in
JSF/myfaces |
0
Comment »
2007年12月05日
private final ExternalContext _externalContext;
ServletContext _servletContext =
(ServletContext) _externalContext.getContext();
Posted in
JSF/myfaces |
0
Comment »
2007年12月04日
Error initializing MyFaces: java.net.ConnectException: Connection timed out: connect
myfaces1.2.0试图链接网络下载
URL http://java.sun.com/dtd/web-facesconfig_1_1.dtd
和URL http://java.sun.com/dtd/web-facesconfig_1_0.dtd
,但是网络连接不上
解决办法手动下载URL http://java.sun.com/dtd/web-facesconfig_1_1.dtd
和URL http://java.sun.com/dtd/web-facesconfig_1_0.dtd
并把dtd文件放入myfaces-impl-1.2.0.jar中的 org/apache/myfaces/resource/ 目录
参考
myfaces-impl-jar-does-not-include-faces-config-dtds-and-thus-won't-work-if-offline
Posted in
JSF/myfaces |
0
Comment »