You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Thomas Andraschko (JIRA)" <ji...@apache.org> on 2015/02/24 17:41:05 UTC

[jira] [Comment Edited] (DELTASPIKE-838) SchedulerExtension: Multiple Job-Classes found with name

    [ https://issues.apache.org/jira/browse/DELTASPIKE-838?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14335059#comment-14335059 ] 

Thomas Andraschko edited comment on DELTASPIKE-838 at 2/24/15 4:40 PM:
-----------------------------------------------------------------------

+1, faced the same once with partial beans
also possible to change:
        if (scheduled != null && scheduled.onStartup())
        {
            this.foundManagedJobClasses.add(beanClass);
        }

to:
        if (scheduled != null && scheduled.onStartup() && !this.foundManagedJobClasses.contains(beanClass))
        {
            this.foundManagedJobClasses.add(beanClass);
        }


was (Author: tandraschko):
+1, faced the same once with partial beans
also possible to add change:
        if (scheduled != null && scheduled.onStartup())
        {
            this.foundManagedJobClasses.add(beanClass);
        }

to:
        if (scheduled != null && scheduled.onStartup() && !this.foundManagedJobClasses.contains(beanClass))
        {
            this.foundManagedJobClasses.add(beanClass);
        }

> SchedulerExtension: Multiple Job-Classes found with name
> --------------------------------------------------------
>
>                 Key: DELTASPIKE-838
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-838
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: Scheduler
>    Affects Versions: 1.2.1
>            Reporter: Christian Kaltepoth
>         Attachments: 0001-DELTASPIKE-838-Ensure-job-classes-are-processed-only.patch
>
>
> I just had a weird issue today. After adding a single {{@Scheduled}} to one of my beans, the application failed with this error during startup:
> {code}
> IllegalStateException: Multiple Job-Classes found with name MyBean
> {code}
> I debugged this a bit. It looks like Weld is sending multiple {{ProcessAnnotatedType}} events for the same type. I guess this is caused by the fact that the application I'm working on has two beans.xml files. One in {{src/main/resources/META-INF}} and one in {{src/main/webapp/WEB-INF}}. I know this setup is "not portable" according to the spec. However,  the application is working absolutely fine. Just the {{SchedulerExtension}} fails.
> We could work around such issues simply by changing the type of the {{foundManagedJobClasses}} field from {{List}} to {{Set}}. I think this should be fine and prevents errors in such scenarios.
> Thoughts?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)