java.lang.IllegalArgumentException: The entityClass (class org.optaplanner.examples.nurserostering.domain.ShiftAssignment) has a PlanningVariable annotated property (employee) that refers to a ValueRangeProvider annotated member (method getShiftAssignmentList on class org.optaplanner.examples.nurserostering.domain.NurseRoster) that returns a Collection with elements of type (class org.optaplanner.examples.nurserostering.domain.ShiftAssignment) which cannot be assigned to the PlanningVariable's type (class org.optaplanner.examples.nurserostering.domain.Employee).

JBoss Issue Tracker | Geoffrey De Smet | 1 year ago
  1. 0

    see http://stackoverflow.com/questions/34029457/optaplanner-classcastexception-at-comparatorselectionsorter better than getting this unhelpful exception: {code} Exception in thread "main" java.lang.ClassCastException: org.demo.DemoApp.domain.JobAssignment cannot be cast to org.demo.DemoApp.domain.Employee at org.demo.DemoApp.domain.solver.EmployeeStrengthComparator.compare(EmployeeStrengthComparator.java:12) at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) at java.util.TimSort.sort(TimSort.java:220) at java.util.Arrays.sort(Arrays.java:1512) at java.util.ArrayList.sort(ArrayList.java:1454) at java.util.Collections.sort(Collections.java:175) at org.optaplanner.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter.sort(ComparatorSelectionSorter.java:45) at org.optaplanner.core.impl.heuristic.selector.value.decorator.SortingValueSelector.constructCache(SortingValueSelector.java:43) at org.optaplanner.core.impl.heuristic.selector.common.SelectionCacheLifecycleBridge.phaseStarted(SelectionCacheLifecycleBridge.java:49) at org.optaplanner.core.impl.phase.event.PhaseLifecycleSupport.firePhaseStarted(PhaseLifecycleSupport.java:39) {code} or this one {code} java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.optaplanner.core.impl.domain.common.accessor.BeanPropertyMemberAccessor.executeSetter(BeanPropertyMemberAccessor.java:86) {code}

    JBoss Issue Tracker | 1 year ago | Geoffrey De Smet
    java.lang.IllegalArgumentException: The entityClass (class org.optaplanner.examples.nurserostering.domain.ShiftAssignment) has a PlanningVariable annotated property (employee) that refers to a ValueRangeProvider annotated member (method getShiftAssignmentList on class org.optaplanner.examples.nurserostering.domain.NurseRoster) that returns a Collection with elements of type (class org.optaplanner.examples.nurserostering.domain.ShiftAssignment) which cannot be assigned to the PlanningVariable's type (class org.optaplanner.examples.nurserostering.domain.Employee).
  2. 0

    see http://stackoverflow.com/questions/34029457/optaplanner-classcastexception-at-comparatorselectionsorter better than getting this unhelpful exception: {code} Exception in thread "main" java.lang.ClassCastException: org.demo.DemoApp.domain.JobAssignment cannot be cast to org.demo.DemoApp.domain.Employee at org.demo.DemoApp.domain.solver.EmployeeStrengthComparator.compare(EmployeeStrengthComparator.java:12) at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) at java.util.TimSort.sort(TimSort.java:220) at java.util.Arrays.sort(Arrays.java:1512) at java.util.ArrayList.sort(ArrayList.java:1454) at java.util.Collections.sort(Collections.java:175) at org.optaplanner.core.impl.heuristic.selector.common.decorator.ComparatorSelectionSorter.sort(ComparatorSelectionSorter.java:45) at org.optaplanner.core.impl.heuristic.selector.value.decorator.SortingValueSelector.constructCache(SortingValueSelector.java:43) at org.optaplanner.core.impl.heuristic.selector.common.SelectionCacheLifecycleBridge.phaseStarted(SelectionCacheLifecycleBridge.java:49) at org.optaplanner.core.impl.phase.event.PhaseLifecycleSupport.firePhaseStarted(PhaseLifecycleSupport.java:39) {code} or this one {code} java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.optaplanner.core.impl.domain.common.accessor.BeanPropertyMemberAccessor.executeSetter(BeanPropertyMemberAccessor.java:86) {code}

    JBoss Issue Tracker | 1 year ago | Geoffrey De Smet
    java.lang.IllegalArgumentException: The entityClass (class org.optaplanner.examples.nurserostering.domain.ShiftAssignment) has a PlanningVariable annotated property (employee) that refers to a ValueRangeProvider annotated member (method getShiftAssignmentList on class org.optaplanner.examples.nurserostering.domain.NurseRoster) that returns a Collection with elements of type (class org.optaplanner.examples.nurserostering.domain.ShiftAssignment) which cannot be assigned to the PlanningVariable's type (class org.optaplanner.examples.nurserostering.domain.Employee).
  3. 0

    OptaPlanner - A planning entity is an instance of an entitySubclass (class java.lang.Integer) that is not configured as a planning entity.

    Stack Overflow | 8 months ago | Xy.
    java.lang.IllegalArgumentException: A planning entity is an instance of an entitySubclass (class java.lang.Integer) that is not configured as a planning entity. If that class (Integer) (or superclass thereof) is not a entityClass ([class org.optaplanner.examples.nurserostering.domain.SkillRequirement, class org.optaplanner.examples.nurserostering.domain.ShiftAssignment]), check your Solution implementation's annotated methods. If it is, check your solver configuration.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Eclipse exported apk crashing

    Stack Overflow | 4 years ago | Sohayb Hassoun
    java.lang.ExceptionInInitializerError

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      The entityClass (class org.optaplanner.examples.nurserostering.domain.ShiftAssignment) has a PlanningVariable annotated property (employee) that refers to a ValueRangeProvider annotated member (method getShiftAssignmentList on class org.optaplanner.examples.nurserostering.domain.NurseRoster) that returns a Collection with elements of type (class org.optaplanner.examples.nurserostering.domain.ShiftAssignment) which cannot be assigned to the PlanningVariable's type (class org.optaplanner.examples.nurserostering.domain.Employee).

      at org.optaplanner.core.impl.domain.valuerange.descriptor.AbstractFromPropertyValueRangeDescriptor.processValueRangeProviderAnnotation()
    2. OptaPlanner core
      AbstractFromPropertyValueRangeDescriptor.processValueRangeProviderAnnotation
      1. org.optaplanner.core.impl.domain.valuerange.descriptor.AbstractFromPropertyValueRangeDescriptor.processValueRangeProviderAnnotation(AbstractFromPropertyValueRangeDescriptor.java:108)
      1 frame