0

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.

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>

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

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?

4

1 回答 1

0

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.

于 2013-04-17T02:17:06.257 回答