找不到工厂的备份



我目前正在使用以下堆栈:jboss7.1.3, javaee-api和jsf 2.1.19。并且无法绕过此错误:

Unexpected exception when attempting to tear down the Mojarra runtime: java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory.

这很奇怪,因为当我不考虑战争时,问题不会显示出来。细化war意味着在maven war插件中添加以下配置:

<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项目。但问题是,我有一个基类的方法签名是由2个模块使用,并抛出此错误:

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

我的想法是有一个类加载器的2个模块,在lib文件夹。因此,两个模块都将使用父优先加载。

还是我的方法完全错了?任何建议吗?

基本上我所做的是删除jsf依赖并坚持使用javae -api。这个解决方案对我很有效。如果jsf*.jar和javaee6-api jar处于依赖关系中,会产生一些难以调试的错误。

最新更新