[wildfly-dev] Injecting ManagedExecutorService results in NPE

Stuart Douglas stuart.w.douglas at gmail.com
Wed Mar 23 08:36:59 EDT 2016


@Resource is not a CDI annotation, but it does take effect on CDI beans.

Stuart

On Wed, 23 Mar 2016 at 23:15 Eduardo Sant´Ana da Silva <
eduardo.santanadasilva at gmail.com> wrote:

> Weird, this was done on AS-2164
>
> Warn if CDI annotations present but no beans.xml
> https://issues.jboss.org/browse/AS7-2164
>
>
> 2016-03-23 9:06 GMT-03:00 Ingo Weiss <ingo at redhat.com>:
>
>> On 23/03/2016 11:52, Eduardo Sant´Ana da Silva wrote:
>> > Did you saw this message when deploying?
>> >
>> > :# Message: Deployment %s contains CDI annotations but no bean archive
>> > was not found. (No beans.xml nor class with bean defining annotations)
>> >
>> > 2016-03-23 4:24 GMT-03:00 Ingo Weiss <ingo at redhat.com
>> > <mailto:ingo at redhat.com>>:
>> >
>> >     On 22/03/2016 13:28, Stuart Douglas wrote:
>> >     > Where are you trying to use these?
>> >     >
>> >     > Stuart
>> >     >
>> >     > On Wed, 23 Mar 2016, 00:18 Ingo Weiss <ingo at redhat.com <mailto:
>> ingo at redhat.com>
>> >     > <mailto:ingo at redhat.com <mailto:ingo at redhat.com>>> wrote:
>> >     >
>> >     >     Hi,
>> >     >
>> >     >     I was testing injecting the default ManagedExecutorService on
>> >     WF10 and
>> >     >     it returns a NullPointerException if I don't do a lookup.
>> >     >
>> >     >     These result in a NPE:
>> >     >
>> >     >     @Resource
>> >     >     private ManagedExecutorService executorService;
>> >     >
>> >     >     @Resource(lookup =
>> "java:jboss/ee/concurrency/executor/default")
>> >     >     private ManagedExecutorService executorService;
>> >     >
>> >     >     But this works:
>> >     >
>> >     >     private ManagedExecutorService executorService =
>> >     >
>> >
>> InitialContext.doLookup("java:jboss/ee/concurrency/executor/default");
>> >     >
>> >     >     I didn't change any configurations on WF so far. Ideas?
>> >     >
>> >     >     Cheers
>> >     >     --
>> >     >     Ingo Weiss
>> >     >
>> >     >     _______________________________________________
>> >     >     wildfly-dev mailing list
>> >     >     wildfly-dev at lists.jboss.org <mailto:
>> wildfly-dev at lists.jboss.org>
>> >     <mailto:wildfly-dev at lists.jboss.org
>> >     <mailto:wildfly-dev at lists.jboss.org>>
>> >     >     https://lists.jboss.org/mailman/listinfo/wildfly-dev
>> >     >
>> >
>> >     Hi,
>> >
>> >     Disregard this. The issue is that I forgot to add beans.xml to
>> >     activate CDI.
>> >
>> >     Cheers
>> >     --
>> >     Ingo Weiss
>> >
>> >
>> >     _______________________________________________
>> >     wildfly-dev mailing list
>> >     wildfly-dev at lists.jboss.org <mailto:wildfly-dev at lists.jboss.org>
>> >     https://lists.jboss.org/mailman/listinfo/wildfly-dev
>> >
>> >
>> >
>> >
>> > --
>> > ___________________________
>> > Eduardo Sant'Ana da Silva - Ph.D.
>> > Researcher / IT Consultant
>> >
>>
>> Oi Eduardo,
>>
>> No.
>>
>> 12:05:51,405 INFO  [org.jboss.as.server.deployment] (MSC service thread
>> 1-4) WFLYSRV0027: Starting deployment of "async-jaxrs.war"
>> (runtime-name: "async-jaxrs.war")
>>
>> 12:05:51,473 INFO  [javax.enterprise.resource.webcontainer.jsf.config]
>> (ServerService Thread Pool -- 78) Initializing Mojarra 2.2.12-jbossorg-2
>> 20150729-1131 for context '/async-jaxrs'
>>
>> 12:05:51,580 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n]
>> (ServerService Thread Pool -- 78) RESTEASY002225: Deploying
>> javax.ws.rs.core.Application: class
>> cx.hoffmann.msa.async.JaxRSConfiguration
>>
>> 12:05:51,586 INFO  [org.wildfly.extension.undertow] (ServerService
>> Thread Pool -- 78) WFLYUT0021: Registered web context: /async-jaxrs
>>
>> 12:05:51,593 INFO  [org.jboss.as.server] (management-handler-thread - 7)
>> WFLYSRV0010: Deployed "async-jaxrs.war" (runtime-name : "async-jaxrs.war")
>>
>> That's probably why I was confused since I've seen the message you refer
>> to on EAP 6.
>> --
>> Ingo Weiss
>>
>>
>
>
> --
> ___________________________
> Eduardo Sant'Ana da Silva - Ph.D.
> Researcher / IT Consultant
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20160323/c7b45329/attachment.html 


More information about the wildfly-dev mailing list