Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic exception on use groovy-based code: java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class java.util.Iterator (java.util.LinkedHashMap and java.util.Iterator are in module java.base of loader 'bootstrap') at org.codehaus.groovy.runtime.dgm$834.invoke(Unknown Source) #185

Open
Hubbitus opened this issue Nov 10, 2020 · 7 comments

Comments

@Hubbitus
Copy link

Hubbitus commented Nov 10, 2020

From https://gitlab.com/unidata-community/addressmaster/-/issues/5

Really it looks very strange to me and project very well work in container. But running in gretty I got very strange stacktrace:

SEVERE: Exception sending context initialized event to listener instance of class [com.taskdata.addressmaster.server.JulToSlf4jConfigurerInContextLoaderListener]
java.lang.ExceptionInInitializerError
        at com.taskdata.addressmaster.server.JulToSlf4jConfigurerInContextLoaderListener.contextInitialized(JulToSlf4jConfigurerInContextLoaderListener.java:46)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4690)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5151)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:468)
        at org.apache.catalina.startup.Tomcat$start$1.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
        at org.akhikhl.gretty.TomcatServerManager.startServer(TomcatServerManager.groovy:52)
        at org.akhikhl.gretty.ServerManager$startServer$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
        at org.akhikhl.gretty.Runner.run(Runner.groovy:129)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:190)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:70)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
        at org.akhikhl.gretty.Runner.main(Runner.groovy:54)
Caused by: java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class java.util.Iterator (java.util.LinkedHashMap and java.util.Iterator are in module java.base of loader 'bootstrap')
        at org.codehaus.groovy.runtime.dgm$834.invoke(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:247)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
        at info.hubbitus.utils.bench.ProgressLogger.<clinit>(ProgressLogger.groovy:98)
        ... 46 more

Step to reproduce

For easy reproduce and do not require start databases I have prepared branch #5-gretty-bug-reproduce, just checkout it and as usual run:

./gradlew farmRunDebug
@aindlq
Copy link

aindlq commented Nov 11, 2020

can you try, as a workaround, to define your farm config explicitly?

@Hubbitus
Copy link
Author

Sorry, what you meant under "define your farm config explicitly"?

That already explicitly defined.

@aindlq
Copy link

aindlq commented Nov 13, 2020

What you linked to is generic gretty config.

Multiple web-apps feature works out-of-the-box in configureless mode, although it is fully configurable/customizable.

https://gretty-gradle-plugin.github.io/gretty-doc/Multiple-web-apps-introduction.html

My guess is something is wrong with configureless mode. Can you try define farm explicitly as documented here - https://gretty-gradle-plugin.github.io/gretty-doc/Farm-web-app-list.html

@Hubbitus
Copy link
Author

Are you speak about something like https://gitlab.com/unidata-community/addressmaster/-/merge_requests/4/diffs?commit_id=8c5a87f499f5dccc52543b88dc29fbbf78ae0afb#a5feec40b7a05be26caacdbfc454d31ce0825448_124_126 ?

I think it is not change way I need run it (./gradlew farmRunDebug)?
Then it looks like change nothing.

@aindlq
Copy link

aindlq commented Nov 14, 2020

Hm, apparently you have only one webapp, right? So maybe I'm missing something, but then why are you using farm* tasks if you have only one webapp?

@Hubbitus
Copy link
Author

./gradlew appRunDebug changes nothing if you speak about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants