Question

I have an application that I'm trying to migrate from seam 2.1 to 2.3, and deploy to Jboss 7.1.1. I have managed to resolve many issues that I faced while doing so. The issue that I'm here to ask about is pertaining to coexistence of seam 2.3 and the built-in Weld module in Jboss.

Are there issues with deploying a seam 2.3 application with the Weld module that's an implicit dependency in Jboss 7.1? In my jboss logs I'm seeing the following message "Starting weld service for deployment" which tells me that Weld is being triggered. This is expected according to the Jboss class loading documentation.

The reason that I'm investigating this is that although my application seems to deploy correctly, I'm getting the following exception when I try to access any of its pages:

01:36:51,605 SEVERE [javax.faces.webapp] (http--127.0.0.1-8080-5) org.jboss.weld.context.NonexistentConversationException caught during beforePhase() processing of RESTORE_VIEW 1 : UIComponent-ClientId=, Message=WELD-000321 No conversation found to restore for id 1
01:36:51,606 SEVERE [javax.faces.webapp] (http--127.0.0.1-8080-5) WELD-000321 No conversation found to restore for id 1: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
    at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:221) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
    at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:108) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
    at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
    at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
    at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:357) [tomahawk21-1.1.14.jar:1.1.14]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

Which makes me wonder, as to how does Weld play with seam 2.3 DI, and if that's causing the exception.

I tried a number of things to disable the JBoss module but the closest I got to doing so is by having this in my jboss-deployment-structure.xml:

   <exclusions>
     <module name="org.jboss.as.weld"/> 
   </exclusions>

That resulted in this stack trace when trying to deploy my app.

ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myapp]] (MSC service thread 1-1) Error configuring application listener of class org.jboss.as.weld.webtier.jsp.JspInitializationListener: java.lang.ClassNotFoundException: org.jboss.as.weld.webtier.jsp.JspInitializationListener from [Module "deployment.myapp.ear.myapp-web.war:main" from Service Module Loader]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
        at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3342) [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(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]

Which indicates that some other part of Jboss, perhaps, depends on Weld for its operation. So my other question is, what is the best way to get rid of Weld and relay on Seam's DI functionality instead?

This seems like a reasonable question to ask, that I thought it would be easy to find an answer to, but so far all my attempts at finding one have failed.

Was it helpful?

Solution

Thanks for all your help :)

It turns out that I had mistakenly added a beans.xml file to my WEB-INF/beans.xml which was causing an implicit jboss weld dependency to be added. The second issue that I think could have caused weld to be activated at deployment is a dependency on cdi-api that the jboss maven project archetype has added. I figured this out by deploying the seam 2.3 booking example and observing that weld doesn't show in the logs and comparing the poms between it and my project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top