2 Replies Latest reply: Apr 6, 2012 6:48 AM by Goutam Dutta RSS

Jboss7 Deployment Error (Cannot instantiate component of type org.ajax4jsf.LoadStyle)

Swen Vogel Newbie



Hi,


i would like to migrate a existing Seam2 application to Jboss7. For testing purposes i created a new Seam2 Eclipse project.
But on deployment i get the exception Cannot instantiate component of type org.ajax4jsf.LoadStyle (The full stack is listed at the end).



I used Seam 2.2.2.Final and jboss-as-web-7.0.2.Final and followed the article http://community.jboss.org/blogs/marek-novotny/2011/07/15/seam-2-jpa-example-on-jboss-as7.



Here are the steps:


1. created a new Seam WAR project in Eclipse with MySQL database


2. deleted  WEB-INF/jboss-web.xml


3. created file WEB-INF/jboss-deployment-structure.xml


<jboss-deployment-structure> 
   <deployment>
        <exclusions>
          <module name="javax.faces.api" slot="main"/>
          <module name="com.sun.jsf-impl" slot="main"/>
        </exclusions>
        <dependencies>
          <module name="org.apache.commons.logging" />
          <module name="org.apache.commons.collections" />
          <module name="org.apache.log4j" />
          <module name="org.dom4j" />
          <module name="javax.faces.api" slot="1.2"/>
          <module name="com.sun.jsf-impl" slot="1.2"/>
        </dependencies>
    </deployment>   
</jboss-deployment-structure>




4. copied libs from the Seam distribution to WEB-INF/lib


slf4j-api.jar

slf4j-log4j12.jar



hibernate-core.jar

hibernate-entitymanager.jar

hibernate-validator.jar 
hibernate-annotations.jar

hibernate-commons-annotations.jar

gwt-servlet.jar



5. copied MySQL connector to jboss-home/standalone/deployments


6. created datasource configuration over the Jboss7 administration console.


7. deployed the Project from Eclipse.



Any help is greatly appreciated.




Full stacktrace:



09:12:36,192 SCHWERWIEGEND [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8080-1) JSF1004: Cannot instantiate component of type org.ajax4jsf.LoadStyle
09:12:36,199 SCHWERWIEGEND [facelets.viewhandler] (http--127.0.0.1-8080-1) Error Rendering View[/home.xhtml]: javax.faces.FacesException: Expression Error: Object: org.ajax4jsf.LoadStyle wurde nicht gefunden.
     at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:571) [jsf-impl-1.2_15-jbossorg-1.jar:1.2_15.jbossorg-1-20110810-SNAPSHOT]
     at com.sun.facelets.tag.jsf.ComponentHandler.createComponent(ComponentHandler.java:243) [jsf-facelets.jar:]
     at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:139) [jsf-facelets.jar:]
     at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47) [jsf-facelets.jar:]
     at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109) [jsf-facelets.jar:]
     at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49) [jsf-facelets.jar:]
     at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47) [jsf-facelets.jar:]
     at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25) [jsf-facelets.jar:]
     at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248) [jsf-facelets.jar:]
     at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294) [jsf-facelets.jar:]
     at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273) [jsf-facelets.jar:]
     at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:140) [jsf-facelets.jar:]
     at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113) [jsf-facelets.jar:]
     at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49) [jsf-facelets.jar:]
     at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25) [jsf-facelets.jar:]
     at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95) [jsf-facelets.jar:]
     at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524) [jsf-facelets.jar:]
     at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567) [jsf-facelets.jar:]
     at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) [jsf-impl-1.2_15-jbossorg-1.jar:1.2_15.jbossorg-1-20110810-SNAPSHOT]
     at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) [jsf-impl-1.2_15-jbossorg-1.jar:1.2_15.jbossorg-1-20110810-SNAPSHOT]
     at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-1.2_15-jbossorg-1.jar:1.2_15.jbossorg-1-20110810-SNAPSHOT]
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) [jsf-api-1.2_15-jbossorg-1.jar:1.2_15.jbossorg-1-20110810-SNAPSHOT]
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam.jar:]
     at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam.jar:]
     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
     at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam.jar:]
     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
     at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:]
     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
     at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:]
     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
     at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl.jar:]
     at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl.jar:]
     at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl.jar:]
     at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl.jar:]
     at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [jboss-seam.jar:]
     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
     at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam.jar:]
     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
     at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) [jboss-seam.jar:]
     at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
     at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:]
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:388) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
     at java.lang.Thread.run(Thread.java:680) [:1.6.0_26]



  • 1. Re: Jboss7 Deployment Error (Cannot instantiate component of type org.ajax4jsf.LoadStyle)
    Swen Vogel Newbie

    It seems that the exception is not only related to org.ajax4jsf.LoadStyle when i uncomment



    <!--
    <a:loadStyle src="/stylesheet/theme.xcss"/>
    <a:loadStyle src="/stylesheet/theme.css"/>
    -->
    



    from template.xhtml the next exception is:



    Cannot instantiate component of type org.richfaces.ToolBar




    Maybe some kind of classloading problem with the richfaces libraries?!


    The following jars are present in WEB-INF/lib:


    richfaces-api.jar
    richfaces-impl.jar
    richfaces-ui.jar



  • 2. Re: Jboss7 Deployment Error (Cannot instantiate component of type org.ajax4jsf.LoadStyle)
    Goutam Dutta Newbie

    Aslo add javassist.jar to WEB-INF/lib and do the following:

     

    1.     Download richfaces-ui- 3.3.3-Final-bin.zip and replace/copy the following jars to WEB-INF/lib

    richfaces-ui-3.3.3.Final.jar

    richfaces-impl-jsf2-3.3.3.Final.jar

    richfaces-api-3.3.3.Final

     

    2.     Block the following in faces-config.xml

    <!-- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> -->

     

    3.     Add the following in faces-config.xml

    <application>     <view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler> </application>

    At the last send the request through Morzilla FireFox browser (does not work with IE)