luminus-framework / lein-uberwar

plugin for packaging uberwars
Eclipse Public License 1.0
5 stars 3 forks source link

ServletContextListener error #6

Open bigfoote opened 3 years ago

bigfoote commented 3 years ago

creating a brand new luminus app with +war and even +servlet, calling "lein uberwar" and then copying the .war into Tomcat's /webapps folder results in the following error:

23-Mar-2021 13:30:45.082 SEVERE [Catalina-utility-1] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class [luminus_war_servlet_test.listener]
    java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2470)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:866)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1370)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1224)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:540)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:521)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:151)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4589)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5126)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:743)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1026)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1993)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        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:118)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:827)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:477)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1750)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:316)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1151)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1353)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1335)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContextListener
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1401)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1224)
        ... 38 more
23-Mar-2021 13:30:45.082 SEVERE [Catalina-utility-1] org.apache.catalina.core.StandardContext.listenerStart Skipped installing application listeners due to previous error(s)
yogthos commented 3 years ago

may be related to this issue https://github.com/luminus-framework/luminus/issues/280 there's currently a bug with how the handler is configured for the war

bigfoote commented 3 years ago

Upon further testing, this seems to only be a problem with Tomcat 10, as it doesn't come up on multiple machines running Tomcat 9.

yogthos commented 3 years ago

I'll try test out with tomcat 10 when I get a chance. Odd that the ServletContextListener wouldn't be available though, seems like a key thing for a servlet container.

timotheosh commented 3 years ago

This looks related to this issue: https://stackoverflow.com/questions/66711660/tomcat-10-x-throws-java-lang-noclassdeffounderror-on-javax-servlet-servletreques If so, you just can't use Clojure with Jakarta EE 9, just yet. There is a namespace change (from javax to jakarta). That makes us stuck with Tomcat 9 for now.