启动Wildfly时,我收到以下警告:
WELD-000411:Observer方法[BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType)接收所有带注释类型的事件。考虑使用@WithAnnotations限制事件或使用带边界的泛型类型。
知道可能导致这种情况的原因是什么?这是启动日志:
F:\wildfly-8.1.0.CR2\bin\standalone.bat
[2014-05-30 08:31:55,733] Artifact Enterp:war exploded: Server is not connected. Deploy is not available.
Detected server admin port: 9990
Detected server http port: 8080
Calling "F:\wildfly-8.1.0.CR2\bin\standalone.conf.bat"
"JAVA_OPTS already set in environment; overriding default settings with values: -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:50542,suspend=y,server=n "
Setting JAVA property to "F:\Java\jdk1.8.0_05\bin\java"
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: "F:\wildfly-8.1.0.CR2"
JAVA: "F:\Java\jdk1.8.0_05\bin\java"
JAVA_OPTS: "-Dprogram.name=standalone.bat -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:50542,suspend=y,server=n "
===============================================================================
Connected to the target VM, address: '127.0.0.1:50542', transport: 'socket'
20:31:56,715 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
20:31:57,133 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
20:31:57,281 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.1.0.CR2 "Kenny" starting
20:31:59,625 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
20:31:59,661 INFO [org.xnio] (MSC service thread 1-5) XNIO version 3.2.2.Final
20:31:59,678 INFO [org.xnio.nio] (MSC service thread 1-5) XNIO NIO Implementation Version 3.2.2.Final
20:31:59,769 INFO [org.jboss.remoting] (MSC service thread 1-5) JBoss Remoting version 4.0.3.Final
20:31:59,804 INFO [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
20:31:59,839 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
20:31:59,848 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.0.10.Final starting
20:31:59,867 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017502: Undertow 1.0.10.Final starting
20:31:59,869 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
20:31:59,889 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
20:31:59,926 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
20:31:59,916 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.21.Beta1
20:32:00,031 INFO [org.jboss.as.connector.logging] (MSC service thread 1-6) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.5.Final)
20:32:00,156 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
20:32:00,248 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = h2
20:32:00,284 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.1)
20:32:00,289 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010417: Started Driver service with driver-name = postgresql
20:32:00,294 INFO [org.jboss.as.naming] (MSC service thread 1-6) JBAS011802: Starting Naming Service
20:32:00,332 INFO [org.jboss.as.mail.extension] (MSC service thread 1-6) JBAS015400: Bound mail session [java:/Mail]
20:32:00,675 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path F:\wildfly-8.1.0.CR2/welcome-content
20:32:00,750 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017525: Started server default-server.
20:32:00,796 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017531: Host default-host starting
20:32:01,322 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080
20:32:01,669 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) JBAS015012: Started FileSystemDeploymentService for directory F:\wildfly-8.1.0.CR2\standalone\deployments
20:32:01,925 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
20:32:01,946 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/PostgresDatabaseDS]
20:32:02,025 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017519: Undertow HTTPS listener default-https listening on /127.0.0.1:8443
20:32:02,630 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final
20:32:02,921 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
20:32:03,063 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
20:32:03,065 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.CR2 "Kenny" started in 6726ms - Started 195 of 245 services (83 services are lazy, passive or on-demand)
Connected to server
[2014-05-30 08:32:03,410] Artifact Enterp:war exploded: Artifact is being deployed, please wait...
20:32:03,699 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "Enterp.war" (runtime-name: "Enterp.war")
20:32:04,946 INFO [org.jboss.as.jpa] (MSC service thread 1-8) JBAS011401: Read persistence.xml for primary
20:32:05,325 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 11) JBAS011409: Starting Persistence Unit (phase 1 of 2) Service 'Enterp.war#primary'
20:32:05,344 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 11) HHH000204: Processing PersistenceUnitInfo [
name: primary
...]
20:32:05,463 INFO [org.hibernate.Version] (ServerService Thread Pool -- 11) HHH000412: Hibernate Core {4.3.5.Final}
20:32:05,466 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 11) HHH000206: hibernate.properties not found
20:32:05,469 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 11) HHH000021: Bytecode provider name : javassist
20:32:07,308 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016002: Processing weld deployment Enterp.war
20:32:07,404 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-8) HV000001: Hibernate Validator 5.1.0.Final
20:32:08,772 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016005: Starting Services for CDI deployment: Enterp.war
20:32:08,821 INFO [org.jboss.weld.Version] (MSC service thread 1-8) WELD-000900: 2.1.2 (Final)
20:32:09,433 INFO [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016008: Starting weld service for deployment Enterp.war
20:32:09,697 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 11) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service 'Enterp.war#primary'
20:32:09,837 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 11) HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
20:32:10,150 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 11) HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
20:32:10,168 INFO [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 11) HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
20:32:10,564 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 11) HHH000397: Using ASTQueryTranslatorFactory
20:32:12,346 WARN [org.jboss.weld.Event] (MSC service thread 1-6) WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
答案 0 :(得分:6)
默认情况下,支持CDI的容器会尝试将/WEB-INF/lib
中的JAR中的每个类注册为CDI托管bean。在较旧的Java EE 6容器使用的旧版CDI中,存在一些错误,即CDI实现甚至尝试在没有默认构造函数的情况下注册枚举,抽象类和/或类,从而导致部署异常(WebLogic),运行时异常(WebSphere)和/或大量令人困惑的警告(GlassFish / TomEE)。
为了解决这个问题,OmniFaces增加了一个VetoAnnotatedTypeExtension
,它应该&#34;否决&#34; org.omnifaces
包中的任何类,org.omnifaces.cdi
或org.omnifaces.showcase
子包中的不被注册为CDI托管bean。这是通过ProcessAnnotatedType#veto()
发生的。
在WildFly中使用的Weld 2.x中,当您在所有类上使用ProcessAnnotatedType
时,会出现新的警告类型。但是,在这种特定情况下,它只是扫描每个类的唯一目的,因为需要排除注册为CDI托管bean的类显然没有明确注册为CDI托管bean(为此您否则可能会使用警告信息中建议的更具体的T
或@WithAnnotations
。
理论上,此特定情况下的解决方案是在<weld:include>
中使用<weld:exclude>
或beans.xml
而不是Extension
。但是,这不是标准的CDI解决方案,因为这是特定于焊接的,因此不能与其他CDI实现(如OpenWebBeans或CanDI)一起使用。我们无法为其他CDI实现找到类似的机制,所以我们选择Extension
。毕竟,这只是&#34;只是&#34;警告,而不是错误。一切都应该继续像预期的那样工作。