在JAR中找不到命名的JSF对象(Maven结构,Wildfly)

时间:2015-03-30 07:27:36

标签: maven jsf-2 jboss wildfly wildfly-8

我正在从Glassfish 3.1.1切换到Wildfly 8.2.0,我有一个像这样的Maven结构(但有更多的应用程序):

Main (POM project)
 |-Web (POM project)
 |  |-Mobile (Web application)
 |  |-WWW (Web application)
 |-EJB (POM project)
 |  |-Data (EJB module)
 |-Util (POM project)
 |  |-JSFcomponents (Java application)
 |-EAR (POM project)
    |-WebEar (EAR project)

WebEar依赖于Mobile,WWW,Data和JSFcomponents。当我部署WebEar时,除了JSFcomponents项目中的1个JSF组件外,一切都有效。当我打开其中一个Web应用程序时,我得到一个例外。

javax.servlet.ServletException: Expression Error: Named Object: dk.industrysupply.jsf.CookieConsent not found.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)
dk.industrysupply.mobile.filter.FacesFilter.doFilter(FacesFilter.java:175)
io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
dk.industrysupply.mobile.filter.ThreadFilter.doFilter(ThreadFilter.java:37)
io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261)
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247)
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76)
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166)
io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)

该项目中的其他JSF组件工作正常。它们之间的区别在于CookieConsent使用注释,而其他组件在faces-config.xml中配置。

CookieConsentComponent

@FacesComponent(value = "dk.industrysupply.jsf.CookieConsent")
public class CookieConsentComponent extends UIComponentBase {

CookieConsentRenderer

@FacesRenderer(componentFamily = "dk.industrysupply.jsf.CookieConsent",
rendererType = "dk.industrysupply.jsf.CookieConsent")
public class CookieConsentRenderer extends Renderer {

标签库

<tag>
    <tag-name>cookieConsent</tag-name>
    <component>
        <component-type>dk.industrysupply.jsf.CookieConsent</component-type>
        <renderer-type>dk.industrysupply.jsf.CookieConsent</renderer-type>
    </component>
    <attribute>
        <name>id</name>
        <required>false</required>
        <type>java.lang.String</type>
    </attribute>
    <attribute>
        <name>value</name>
        <required>true</required>
        <type>java.lang.String</type>
    </attribute>
</tag>

由于该项目在Glassfish上运行良好,并且它在Wildfly上工作正常,如果我在Web应用程序中删除使用CookieConsent组件,我觉得Wildfly中的项目结构存在某种问题。但是现在已经把这个问题弄乱了几个小时,我开始没有想法了。需要一些帮助...

1 个答案:

答案 0 :(得分:0)

JSFcomponent被标记为在Mobile和WWW中提供。它由WebEar提供。这减小了WebEar的大小,因为JSFcomponent只包含在已编译的EAR文件中一次。此设置将EAR的大小从130 mb减少到40 mb,并将部署时间从2:15减少到1:05。

现在我已经改变了Mobile和WWW,所以他们每个人都提供自己的JSF组件,现在它可以在Wildfly上运行。糟糕的是EAR的大小已经增长,因为JSFcomponent被多次包含。这很烦人,因为其他设置在Glassfish上运行良好。但是,它仍然是一个可以接受的解决方案。