Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-956

DefinitionException when iterateing over instance of org.apache.webbeans.inject.instance.InstanceImpl

Bulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment Visibility
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.5
    • None
    • None

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            struberg Mark Struberg
            MarkusFrisch Markus Frisch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment