当启动Wildfly时,我得到以下警告:
WELD-000411: Observer method [backdannotatedmethod] public org.omnifaces.VetoAnnotatedTypeExtension。processAnnotatedType(@ observectprocessannotatedtype)接收所有注释类型的事件。考虑使用@WithAnnotations或带边界的泛型类型来限制事件。
你知道是什么原因造成的吗?下面是启动日志:
F:wildfly-8.1.0.CR2binstandalone.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.CR2binstandalone.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:Javajdk1.8.0_05binjava"
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: "F:wildfly-8.1.0.CR2"
JAVA: "F:Javajdk1.8.0_05binjava"
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.CR2standalonedeployments
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.
默认情况下,支持CDI的容器尝试将/WEB-INF/lib
中的jar中的每个类注册为CDI管理的bean。在旧的Java EE 6容器使用的旧CDI版本中,存在一些bug,其中CDI实现甚至试图注册枚举、抽象类和/或没有默认构造函数的类,从而导致部署异常(WebLogic)、运行时异常(WebSphere)和/或大量令人困惑的警告(GlassFish/TomEE)。
为了解决这个问题,OmniFaces添加了一个VetoAnnotatedTypeExtension
,它应该"否决"org.omnifaces
包中的任何类,这些类在org.omnifaces.cdi
或org.omnifaces.showcase
子包中不是,不能被注册为CDI管理bean。这通过ProcessAnnotatedType#veto()
实现。
In Weld 2。在WildFly中使用的x,显然有一种新的警告类型,当您在所有类上使用ProcessAnnotatedType
时会发生。然而,在这个特定的情况下,扫描每个单独的类只是整个目的,因为需要排除被注册为CDI托管bean的类显然没有显式地注册为CDI托管bean(对此,您可以使用更具体的T
或@WithAnnotations
,如警告消息中所建议的)。
理论上,在这种特殊情况下的解决方案是在beans.xml
中使用<weld:include>
或<weld:exclude>
而不是Extension
。然而,这不是一个标准的CDI解决方案,因为这是特定于weld的,因此不能与其他CDI实现(如OpenWebBeans或CanDI)一起工作。我们无法为其他CDI实现找到类似的机制,所以我们选择了Extension
。毕竟,这"只是"一个警告,而不是一个错误。