tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Problem with OpenWebbeans when Iterating over javax.enterprise.inject.Instance<T>
Date Tue, 13 May 2014 14:53:17 GMT
not exactly,

basically difference is instance#get (fixed in 888) and
instance#iterator (to fix)


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-05-13 16:47 GMT+02:00 Xavier Dury <kalgon@hotmail.com>:
> I think it's this bug: https://issues.apache.org/jira/browse/OWB-888
>
>> From: rmannibucau@gmail.com
>> Date: Tue, 13 May 2014 16:40:41 +0200
>> Subject: Re: Problem with OpenWebbeans when Iterating over javax.enterprise.inject.Instance<T>
>> To: users@tomee.apache.org
>>
>> Hi
>>
>> this is an openwebbeans bug, you can open an issue
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-05-13 16:19 GMT+02:00 Markus F. Frisch <markus.frisch@nobiscum.de>:
>> > I get a DefinitionException when trying to iterate over an instance of org.apache.webbeans.inject.instance.InstanceImpl
in the current snapshot of TomEE+ (i.e. in own 1.2.4).
>> >
>> > What I am trying to do is:
>> >
>> > ————————8<————————>8————————
>> > @Stateless
>> > public class JobOperator {
>> >
>> >     @Inject
>> >     private Instance<MyBatchJob> batchJobs;
>> >
>> > …
>> >
>> >     private MyBatchJob findMatchingJob(String jobName) {
>> >         MyBatchJob batchJob = null;
>> >         for (MyBatchJob job : batchJobs) {
>> >             if (job.getName().equalsIgnoreCase(jobName)) {
>> >                 batchJob = job;
>> >                 break;
>> >             }
>> >         }
>> >         if (batchJob == null)
>> >             throw new RuntimeException("There ain’t no Job named '" + jobName
+ "'.");
>> >         return batchJob;
>> >     }
>> > ————————8<————————>8————————
>> > MyBatchJob is a common interface implemented by all my BatchJobs.
>> >
>> > When this code is running I get the following Exception:
>> >
>> > ————————8<————————>8————————
>> > org.apache.webbeans.exception.inject.DefinitionException: Unsupported type null
>> > at org.apache.webbeans.util.ClassUtil.getClazz(ClassUtil.java:950)
>> > at org.apache.webbeans.container.BeanManagerImpl.getEjbOrJmsProxyReference(BeanManagerImpl.java:804)
>> > at org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:740)
>> > at org.apache.webbeans.inject.instance.InstanceImpl.iterator(InstanceImpl.java:270)
>> > at de.nobiscum.rs7030.batch.boundary.JobOperator.findMatchingJob(JobOperator.java:162)
>> > ————————8<————————>8————————
>> >
>> > I took a look at org.apache.webbeans.inject.instance.InstanceImpl<T> and
found the following:
>> >
>> > ————————8<————————>8————————
>> >     public Iterator<T> iterator()
>> >     {
>> >         Set<Bean<?>> beans = resolveBeans();
>> >         List<T> instances = new ArrayList<T>();
>> >         parentCreationalContext.putInjectionPoint(injectionPoint);
>> >         try
>> >         {
>> >             for(Bean<?> bean : beans)
>> >             {
>> >                 T instance = (T) webBeansContext.getBeanManagerImpl().getReference(bean,null,
parentCreationalContext);
>> > ————————8<————————>8————————
>> >
>> > It looks like this function is passing null as the beanType to getReference()
which in gets handed down to ClassUtil.getClazz() which chokes on that.
>> >
>> > Am I doing something that is not supposed to work here? Or is this a bug? Should
I file a bug report.
>> >
>> > Thanks for your help,
>> > Markus Frisch
>> >
>> > --
>> > Markus Frisch
>> > [Prokurist / Authorized Representative]
>> > nobisCum Deutschland GmbH
>> >
>> > [T] +49 9302 / 987 97 - 2633
>> > [M] +49 173 / 91 88 058
>> > [@] Markus.Frisch@nobisCum.de<mailto:Markus.Frisch@nobisCum.de>
>> > [URL] http://www.nobisCum.de
>> >
>> > [Anschrift] Ostring 2-4, 97228 Rottendorf, Germany
>> > [Registergericht] Würzburg, HRB 5159
>> > [Geschäftsführer] Herbert Stieglitz, Hans-Peter Holl
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>

Mime
View raw message