找不到工厂javax.faces.application.ApplicationFactory的备份 [英] Could not find backup for factory javax.faces.application.ApplicationFactory
问题描述
我目前正在使用以下堆栈:jboss7.1.3,javaee-api和jsf 2.1.19.并且无法解决此错误:
I'm currently working on the following stack: jboss7.1.3, javaee-api and jsf 2.1.19. And can't get around this error:
Unexpected exception when attempting to tear down the Mojarra runtime: java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory.
这很奇怪,因为当我不打仗时,问题就不会显示出来.细化战争意味着向Maven战争插件添加以下配置:
It's weird because when I don't thin the war the problem would not show. Thinning the war means adding the following configuration to maven war plugin:
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib</classpathPrefix>
</manifest>
</archive>
</configuration>
我希望我所有的jar都在app/lib文件夹中,这样就不会出现LinkageError了.这是因为我的Web项目也依赖EJB项目.但是问题是我有一个带有方法签名的基类,这两个模块正在使用该方法并抛出此错误:
I want all my jars to be in the app/lib folder so that there will be no LinkageError. It's because my web project is also dependent on the EJB project. But the problem is I have a base class with a method signature that is being use by the 2 modules and is throwing this error:
java.lang.LinkageError: loader constraint violation: when resolving method "com.czetsuya.myApp.bean.MyManagedBean.getEntity()Lcom/czetsuya/myApp/model/MyEntity;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, com/czetsuya/myApp/util/view/composite/BackingBeanBasedCompositeComponent, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class, com/czetsuya/myApp/bean/MyManagedBean, have different Class objects for the type pship/model/MyEntity; used in the signature
我的想法是在lib文件夹中为2个模块提供1个类加载器.因此,两个模块都将使用父级优先加载.
My idea is to have 1 class loader for the 2 modules, in the lib folder. So both modules will use the parent-first loading.
还是我的方法是完全错误的?有什么建议吗?
Or my approach is totally wrong? Any suggestion?
推荐答案
基本上我删除了jsf依赖项并坚持使用javaee-api.这个解决方案对我有用.依赖jsf * .jar和javaee6-api jar会产生一些难以调试的错误.
Basically what I did was removed the jsf dependency and stick with javaee-api. This solution worked for me. Having jsf*.jar and javaee6-api jar in dependency produce several errors that are hard to debug.
这篇关于找不到工厂javax.faces.application.ApplicationFactory的备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!