1 Reply Latest reply on Sep 11, 2016 12:10 PM by Rajitha Gunawardhane

    UseJBossWebLoader in JBoss 7 ?

    Pierre De Paepe Newbie

      Hello,

       

      Trying to upgrade my seam application from JBoss 6 to 7, i'm encountering ClassPath problems on evrything related to my dynamic richfaces/a4j code.

       

      To bypass this on JBoss 4, i active the directive

       

      <attribute name="UseJBossWebLoader">true</attribute>

       

      on server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml file

       

      On JBoss 5 & 6, i follow the step 1 of this document.

       

      http://community.jboss.org/wiki/useJBossWebClassLoaderinJBoss5

       

      But on JBoss 7,  i don't understand how doing this.

       

      Version tested are: jboss-as-7.0.2.Final, seam-2.2.2.Final, richfaces 3.3.3.Final

       

      My problematic code can be summarize by a simple (confirmationPanel)

       

      HtmlAjaxCommandLink confirmedLink = (HtmlAjaxCommandLink)application.createComponent(HtmlAjaxCommandLink.COMPONENT_TYPE);

       

      I tried, the following jboss-deployment-structure.xml configuration:

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

        <deployment>

                <dependencies>

                    <module name="javax.faces.api" slot="1.2" export="true"/>

                    <module name="com.sun.jsf-impl" slot="1.2" export="true"/>

                    <module name="org.apache.commons.logging" export="true"/>

                    <module name="org.dom4j" export="true"/>

                    <module name="org.apache.commons.collections" export="true"/>

                  </dependencies>

                  <exclusions>

                        <module name="javax.faces.api" slot="main"/>

                        <module name="com.sun.jsf-impl" slot="main"/>

                  </exclusions>

        </deployment>

        <sub-deployment name="war.war">

              <exclusions>

                <module name="javax.faces.api" slot="main"/>

                <module name="com.sun.jsf-impl" slot="main"/>

              </exclusions>

              <dependencies>

                <module name="javax.faces.api" slot="1.2"/>

                <module name="com.sun.jsf-impl" slot="1.2"/>

              </dependencies>

        </sub-deployment>

      </jboss-deployment-structure>

       

      But it throws

       

      11:03:46,926 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cxt-annonym]] (MSC service thread 1-2) Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.jboss.seam.servlet.SeamListener: java.lang.RuntimeException: Could not create Component: confirmationPanel

           at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1202) [jboss-seam.jar:]

           at org.jboss.seam.init.Initialization.installComponents(Initialization.java:1118) [jboss-seam.jar:]

           at org.jboss.seam.init.Initialization.init(Initialization.java:737) [jboss-seam.jar:]

           at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36) [jboss-seam.jar:]

           at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

           at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

           at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]

           at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)

           at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_29]

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_29]

           at java.lang.Thread.run(Thread.java:662) [:1.6.0_29]

      Caused by: java.lang.NoClassDefFoundError: org/ajax4jsf/component/html/HtmlAjaxCommandLink

           at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_29]

           at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [:1.6.0_29]

           at java.lang.Class.privateGetPublicMethods(Class.java:2547) [:1.6.0_29]

           at java.lang.Class.getMethods(Class.java:1410) [:1.6.0_29]

           at org.jboss.seam.Component.hasAnnotation(Component.java:1161) [jboss-seam.jar:]

           at org.jboss.seam.Component.<init>(Component.java:221) [jboss-seam.jar:]

           at org.jboss.seam.Component.<init>(Component.java:208) [jboss-seam.jar:]

           at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1186) [jboss-seam.jar:]

           ... 11 more

      Caused by: java.lang.ClassNotFoundException: org.ajax4jsf.component.html.HtmlAjaxCommandLink from [Module "deployment.ear.ear.jar.jar:main" from Service Module Loader]

           at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)

           at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)

           at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)

           at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)

           at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)

           ... 19 more

       

       

      I tried to exclude JSF

       

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

        <deployment>

                <dependencies>

                    <module name="org.apache.commons.logging" export="true"/>

                    <module name="org.dom4j" export="true"/>

                    <module name="org.apache.commons.collections" export="true"/>

                  </dependencies>

                  <exclusions>

                        <module name="javax.faces.api"/>

                        <module name="com.sun.jsf-impl"/>

                  </exclusions>

        </deployment>

        <sub-deployment name="war.war">

              <exclusions>

                <module name="javax.faces.api"/>

                <module name="com.sun.jsf-impl"/>

              </exclusions>

        </sub-deployment>

      </jboss-deployment-structure>

       

      and declare on my web.xml

       

        <context-param>

            <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>

            <param-value>true</param-value>

        </context-param>

       

      include jsf-impl.jar in my war.war

       

      but it throws then

       

      11:28:53,729 WARN  [org.jboss.modules] (MSC service thread 1-6) Failed to define class javax.faces.context.FacesContext in Module "deployment.ear.ear:main" from Service Module Loader: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/context/FacesContext"

              at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_29]

              at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [:1.6.0_29]

              at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [:1.6.0_29]

              at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [:1.6.0_29]

              at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397) [jboss-modules.jar:1.0.2.GA]

              at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261) [jboss-modules.jar:1.0.2.GA]

              at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76) [jboss-modules.jar:1.0.2.GA]

              at org.jboss.modules.Module.loadModuleClass(Module.java:590) [jboss-modules.jar:1.0.2.GA]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183) [jboss-modules.jar:1.0.2.GA]

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361) [jboss-modules.jar:1.0.2.GA]

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333) [jboss-modules.jar:1.0.2.GA]

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310) [jboss-modules.jar:1.0.2.GA]

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103) [jboss-modules.jar:1.0.2.GA]

              at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_29]

              at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [:1.6.0_29]

              at java.lang.Class.getDeclaredMethods(Class.java:1791) [:1.6.0_29]

              at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]

              at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]

              at org.jboss.as.ee.component.EEModuleClassConfiguration.getClassMethods(EEModuleClassConfiguration.java:145)

              at org.jboss.as.ee.component.ComponentDescription$DefaultFirstConfigurator.configure(ComponentDescription.java:769)

              at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:72)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_29]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_29]

              at java.lang.Thread.run(Thread.java:662) [:1.6.0_29]

       

      What i am missing to simply dynamically build rich web interfaces from Java code.

       

      Many thanks for any help on this.