org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types
cdi, jsf, omnifaces, wildfly
Solution
By default, CDI capable containers attempt to register every single class in JARs in `/WEB-INF/lib` as a CDI managed bean. In older CDI versions as used by older Java EE 6 containers, there were bugs whereby the CDI implementation even attempts to register enums, abstract classes and/or classes without a default constructor, resulting in deployment exceptions (WebLogic), runtime exceptions (WebSphere) and/or loads of confusing warnings (GlassFish/TomEE).
In order to solve that, OmniFaces added a `VetoAnnotatedTypeExtension` which should "veto" any class from `org.omnifaces` package which is not in either `org.omnifaces.cdi` or `org.omnifaces.showcase` subpackage from being registered as a CDI managed bean. This happens via `ProcessAnnotatedType#veto()`.
In Weld 2.x as used in WildFly, there's apparently a new type of warning which occurs when you use `ProcessAnnotatedType` on all classes. However, in this specific case, it's just the whole purpose to scan every single class, because classes which needs to be excluded from being registered as CDI managed beans are obviously not explicitly registered as a CDI managed bean (for which you could otherwise use a more specific `T` or `@WithAnnotations` as suggested in the warning message).
Theoretically, the solution in this specific case would be to use `<weld:include>` or `<weld:exclude>` in `beans.xml` instead of an `Extension`. However, this is not a standard CDI solution as this is Weld-specific and thus wouldn't work with other CDI implementations such as OpenWebBeans or CanDI. We couldn't figure a similar mechanism for other CDI implementations, so we went for the `Extension`. After all, this is "just" a warning, not an error. Everything should continue to work as intented.
Problem
I'm getting the following warning when starting up Wildfly: WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds. Any idea what might be causing this? Here's the startup log: ``` 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. ```