WELD-001519为抽象类'xxx'创建InjectionTarget实现。不可能产生这种类型的实例 [英] WELD-001519 An InjectionTarget implementation is created for an abstract class 'xxx'. It will not be possible to produce instances of this type

查看:141
本文介绍了WELD-001519为抽象类'xxx'创建InjectionTarget实现。不可能产生这种类型的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


  • GlassFish Server 4.0

  • Mojarra 2.2.4

  • PrimeFaces 4.0 final

  • PrimeFaces Extension 1.1.0

  • OmniFaces 1.6.3



添加完OmniFaces后,服务器终端上会显示以下警告信息:

 警告:WELD-001519为抽象类org.omnifaces.eventlistener.DefaultServletContextListener创建InjectionTarget实现。不可能产生这种类型的实例! 
警告:WELD-001519为抽象类org.omnifaces.filter.HttpFilter创建了一个InjectionTarget实现。不可能产生这种类型的实例!

//警告:类'javax.ejb.PostActivate'找不到,基于它的拦截未启用
//警告:类'javax.ejb.PrePassivate'未找到,拦截基于它没有启用
INFO:初始化Mojarra 2.2.4(20131003-1354 https://svn.java.net/svn/mojarra~svn/tags/2.2.4@12574)上下文'/ Project -war'

警告:WELD-001529为类org.omnifaces.application.OmniApplicationFactory创建了一个InjectionTarget实现,该类没有任何适当的构造函数。
警告:WELD-001529为类org.primefaces.context.PrimeFacesContextFactory创建了一个InjectionTarget实现,该类没有任何适当的构造函数。
WARNING:WELD-001529为类org.omnifaces.context.OmniPartialViewContextFactory创建了一个InjectionTarget实现,该类没有任何适当的构造函数。
警告:WELD-001529为类Org.primefaces.context.PrimePartialViewContextFactory创建了一个InjectionTarget实现,该类没有任何适当的构造函数。

INFO:在PrimeFaces 4.0上运行
INFO:在PrimeFaces Extensions上运行null
INFO:使用OmniFaces版本null

INFO:加载应用程序[Project# Project-war.war]在[Project-war]
INFO:项目已成功部署在22,734毫秒。

给定环境中的OmniFaces有问题吗?

Class.forName(className).newInstance()。

记录中的这种干扰已被报告为焊接问题1547 ,因此WARNING级别降低到Weld 2.1.1 / 2.2.0以来的DEBUG级别。



值得注意的是,还有另一个bug,最有可能与GlassFish类加载有关。 OmniFaces有一个 VetoAnnotatedTypeExtension ,它应该排除所有这些OmniFaces类被不必要地扫描为CDI托管的bean。当在Tomcat 7和JBoss 6/7/8中使用Weld时,此工作正常。即这些警告完全不出现在OmniFaces类中。


I'm running an application in the following environment.

  • GlassFish Server 4.0
  • Mojarra 2.2.4
  • PrimeFaces 4.0 final
  • PrimeFaces Extension 1.1.0
  • OmniFaces 1.6.3

After adding OmniFaces, the following warnings appear on the server terminal.

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.

Is there any problem with OmniFaces in the given environment?

解决方案

Nope, those are just warnings, not errors. Weld is just not able to create injection targets for abstract classes or classes which does not have a default constructor. Injection targets need to be able to do Class.forName(className).newInstance() without any trouble.

This disturbance in logging is already reported as Weld issue 1547 and hereby the WARNING level is lowered to DEBUG level since Weld 2.1.1 / 2.2.0.

Noted should be that there's another bug, most likely related to GlassFish classloading. OmniFaces has namely a VetoAnnotatedTypeExtension which should exclude all those OmniFaces classes from unnecessarily being scanned as CDI managed beans. This works fine when Weld is used in Tomcat 7 and JBoss 6/7/8. I.e. those warnings doesn't appear at all for OmniFaces classes.

这篇关于WELD-001519为抽象类'xxx'创建InjectionTarget实现。不可能产生这种类型的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆