我使用 JBoss AS 7.1.1 + CDI(焊接)+ JSF + Intellij IDEA。我创建了项目并下载了文件:
1. jsf-api.jar
2. jsf-impl.jar
3. jstl-1.1.0.jar
4. weld-servlet.jar
一切都很好,直到我开始使用 Weld(创建 beans.xml 并将 ManagedBeans 重命名为 Named)。在此之后,工件停止部署并出现错误:
“配置失败!WELD-001001 无法传递空表达式工厂”。
哪里有错?也许技术版本不兼容?我已经用 IDE Idea 下载了文件。
编辑:
[2012-12-19 02:17:27,111] Artifact war exploded: Artifact is being deployed, please wait... 14:17:27,314 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "war_exploded.war" 14:17:28,190 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015893: Encountered invalid class name 'com.sun.faces.vendor.Tomcat6InjectionProvider:org.apache.catalina.util.DefaultAnnotationProcessor' for service type 'com.sun.faces.spi.injectionprovider' 14:17:28,193 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015893: Encountered invalid class name 'com.sun.faces.vendor.Jetty6InjectionProvider:org.mortbay.jetty.plus.annotation.InjectionCollection' for service type 'com.sun.faces.spi.injectionprovider' 14:17:28,233 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002: Processing weld deployment war_exploded.war 14:17:28,258 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016005: Starting Services for CDI deployment: war_exploded.war 14:17:28,263 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016008: Starting weld service for deployment war_exploded.war 14:17:28,334 INFO [org.apache.catalina.core.StandardContext] (MSC service thread 1-1) The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored. 14:17:28,342 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/war_exploded' 14:17:28,429 WARNING [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1) JSF1067: Resource /META-INF/faces-config.xml specified by the javax.faces.CONFIG_FILES configuration option cannot be found. The resource will be ignored. 14:17:28,458 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1) Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! WELD-001001 Cannot pass null expressionFactory at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:376) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225) [jsf-impl-2.1.7-jbossorg-2.jar:] at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_03] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_03] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_03] Caused by: org.jboss.weld.exceptions.IllegalArgumentException: WELD-001001 Cannot pass null expressionFactory at org.jboss.weld.el.WeldExpressionFactory.<init>(WeldExpressionFactory.java:38) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31] at org.jboss.weld.manager.BeanManagerImpl.wrapExpressionFactory(BeanManagerImpl.java:995) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31] at org.jboss.as.weld.webtier.jsf.WeldApplication.getExpressionFactory(WeldApplication.java:91) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final] at org.jboss.weld.environment.servlet.jsf.WeldApplication.init(WeldApplication.java:79) [weld-servlet.jar:20120429-1045] at org.jboss.weld.environment.servlet.jsf.WeldApplication.delegate(WeldApplication.java:87) [weld-servlet.jar:20120429-1045] at org.jboss.weld.environment.servlet.jsf.ForwardingApplication.getActionListener(ForwardingApplication.java:168) [weld-servlet.jar:20120429-1045] at com.sun.faces.config.processor.ApplicationConfigProcessor.addActionListener(ApplicationConfigProcessor.java:459) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:290) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:222) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:361) [jsf-impl-2.1.7-jbossorg-2.jar:] ... 9 more
14:17:28,487 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/war_exploded]] (MSC service thread 1-1) Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! WELD-001001 Cannot pass null expressionFactory at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292) [jsf-impl-2.1.7-jbossorg-2.jar:] at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_03] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_03] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_03] Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! WELD-001001 Cannot pass null expressionFactory at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:376) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225) [jsf-impl-2.1.7-jbossorg-2.jar:] ... 8 more Caused by: org.jboss.weld.exceptions.IllegalArgumentException: WELD-001001 Cannot pass null expressionFactory at org.jboss.weld.el.WeldExpressionFactory.<init>(WeldExpressionFactory.java:38) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31] at org.jboss.weld.manager.BeanManagerImpl.wrapExpressionFactory(BeanManagerImpl.java:995) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31] at org.jboss.as.weld.webtier.jsf.WeldApplication.getExpressionFactory(WeldApplication.java:91) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final] at org.jboss.weld.environment.servlet.jsf.WeldApplication.init(WeldApplication.java:79) [weld-servlet.jar:20120429-1045] at org.jboss.weld.environment.servlet.jsf.WeldApplication.delegate(WeldApplication.java:87) [weld-servlet.jar:20120429-1045] at org.jboss.weld.environment.servlet.jsf.ForwardingApplication.getActionListener(ForwardingApplication.java:168) [weld-servlet.jar:20120429-1045] at com.sun.faces.config.processor.ApplicationConfigProcessor.addActionListener(ApplicationConfigProcessor.java:459) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:290) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:222) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:361) [jsf-impl-2.1.7-jbossorg-2.jar:] ... 9 more
14:17:28,519 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-1) Error listenerStart 14:17:28,520 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-1) Context [/war_exploded] startup failed due to previous errors 14:17:28,522 SEVERE [javax.faces] (MSC service thread 1-1) Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup. 14:17:28,524 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1) Unexpected exception when attempting to tear down the Mojarra runtime: java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory. at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1008) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:343) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final] at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:131) [jsf-impl-2.1.7-jbossorg-2.jar:] at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:328) [jsf-impl-2.1.7-jbossorg-2.jar:] at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3489) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3999) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3917) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_03] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_03] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_03]
14:17:28,540 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.web.deployment.default-host./war_exploded: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./war_exploded: JBAS018040: Failed to start context at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_03] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_03] at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_03]
14:17:28,750 INFO [org.jboss.as.server] (management-handler-thread - 20) JBAS015870: Deploy of deployment "war_exploded.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./war_exploded" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./war_exploded: JBAS018040: Failed to start context"}} 14:17:28,757 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016009: Stopping weld service for deployment war_exploded.war 14:17:28,780 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment war_exploded.war in 31ms 14:17:28,782 INFO [org.jboss.as.controller] (management-handler-thread - 20) JBAS014774: Service status report JBAS014777: Services which failed to start: service jboss.web.deployment.default-host./war_exploded: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./war_exploded: JBAS018040: Failed to start context
[2012-12-19 02:17:28,918] Artifact war exploded: Error during artifact deployment. See server log for details.