jmix-projects / jmix-old

DEPRECATED. Use https://github.com/jmix-framework/jmix
16 stars 3 forks source link

ClassCastException when SuggestionField SearchExecutor is triggered #458

Closed glebfox closed 4 years ago

glebfox commented 4 years ago
  1. Define EntitySuggestionField(aka SuggestionPickerField):
<entitySuggestionField metaClass="sec_User">
    <actions>
        <action id="clear" type="entity_clear"/>
    </actions>
    <query entityClass="io.jmix.security.entity.User"
           escapeValueForLike="true"
           searchStringFormat="%$searchString%">
        select e from sec_User e where lower(e.name) like lower(:searchString) escape '\'
    </query>
</entitySuggestionField>
  1. Try to enter some text

AR:

java.lang.ClassCastException: org.springframework.security.authentication.AnonymousAuthenticationToken cannot be cast to org.springframework.security.core.context.SecurityContext
    at io.jmix.ui.executors.impl.WebBackgroundWorker$WebTaskExecutor.<init>(WebBackgroundWorker.java:171)
    at io.jmix.ui.executors.impl.WebBackgroundWorker$WebTaskExecutor.<init>(WebBackgroundWorker.java:144)
    at io.jmix.ui.executors.impl.WebBackgroundWorker.handle(WebBackgroundWorker.java:116)
    at io.jmix.ui.components.impl.WebEntitySuggestionField.searchSuggestions(WebEntitySuggestionField.java:120)
    at io.jmix.ui.components.impl.WebEntitySuggestionField.lambda$initComponent$0(WebEntitySuggestionField.java:85)
    at io.jmix.ui.widgets.JmixSuggestionField$1.searchSuggestions(JmixSuggestionField.java:65)
web-devel commented 4 years ago

not reproduced