我在以下环境中运行应用程序。

  • GlassFish Server 4.0
  • Mojarra 2.2.4
  • PrimeFaces 4.0最终版
  • PrimeFaces扩展1.1.0
  • OmniFaces 1.6.3

  • 添加OmniFaces后,服务器终端上将出现以下警告。
    WARNING:   WELD-001519 An InjectionTarget implementation is created for an abstract class org.omnifaces.eventlistener.DefaultServletContextListener. It will not be possible to produce instances of this type!
    WARNING:   WELD-001519 An InjectionTarget implementation is created for an abstract class org.omnifaces.filter.HttpFilter. It will not be possible to produce instances of this type!
    
    //WARNING:   Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled
    //WARNING:   Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled
    INFO:   Initializing Mojarra 2.2.4 ( 20131003-1354 https://svn.java.net/svn/mojarra~svn/tags/2.2.4@12574) for context '/Project-war'
    
    WARNING:   WELD-001529 An InjectionTarget implementation is created for a class org.omnifaces.application.OmniApplicationFactory which does not have any appropriate constructor.
    WARNING:   WELD-001529 An InjectionTarget implementation is created for a class org.primefaces.context.PrimeFacesContextFactory which does not have any appropriate constructor.
    WARNING:   WELD-001529 An InjectionTarget implementation is created for a class org.omnifaces.context.OmniPartialViewContextFactory which does not have any appropriate constructor.
    WARNING:   WELD-001529 An InjectionTarget implementation is created for a class org.primefaces.context.PrimePartialViewContextFactory which does not have any appropriate constructor.
    
    INFO:   Running on PrimeFaces 4.0
    INFO:   Running on PrimeFaces Extensions null
    INFO:   Using OmniFaces version null
    
    INFO:   Loading application [Project#Project-war.war] at [Project-war]
    INFO:   Project was successfully deployed in 22,734 milliseconds.
    

    在给定的环境中OmniFaces是否有任何问题?

    最佳答案

    不,那只是警告,不是错误。 Weld不能为抽象类或没有默认构造函数的类创建注入(inject)目标。注入(inject)目标需要能够执行Class.forName(className).newInstance()而没有任何麻烦。

    记录中的这种干扰已报告为Weld issue 1547,因此自 Weld 2.1.1/2.2.0起,警告级别降低至调试级别。

    应该指出的是,还有另一个错误,最有可能与GlassFish类加载有关。 OmniFaces有一个 VetoAnnotatedTypeExtension ,它应将所有那些OmniFaces类排除在不必要的情况下而作为CDI管理的bean进行扫描。当在Tomcat 7和JBoss 6/7/8中使用Weld时,这可以很好地工作。 IE。 OmniFaces类根本不会显示这些警告。

    关于jsf - WELD-001519为抽象类 'xxx'创建了InjectionTarget实现。不可能产生这种类型的实例,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20372439/

    10-09 13:43