Have you tried setting metadata-complete="true" on the <web-app> of your 
web.xml? It's supposed to disable annotation scanning AFAICT (but I don't 
remember how the JettyLauncher configures Jetty so maybe it bypasses this 
attribute).

On Monday, March 6, 2023 at 4:14:03 PM UTC+1 mmo wrote:

> In my last email I forgot to mention:
>
> I had found this in the Jetty docs (
> https://www.eclipse.org/jetty/documentation/jetty-9/index.html#Other%20Configuration
> ):
>
>  
>
> …
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <Configure class="org.eclipse.jetty.webapp.WebAppContext">
>
>       <Call name="setAttribute">
>
>       <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
>
>             <Arg>.*/spring-[^/]*\.jar$</Arg>
>
>       </Call>
>
> </Configure>
>
> …
>
>  
>
> According to the description this argument is intended to allow 
> controlling which .jars on the classpath are being scanned for annotations 
> (in the example above only jars that start with "spring-"), but 
> unfortunately it had no effect in my case. The below error still appeared 
> and Jetty doesn’t start up…  ☹
>
>  
>
>  
>
>  
>
> *From:* Michael Moser <[email protected]> 
> *Sent:* Monday, March 6, 2023 3:43 PM
> *To:* [email protected]
> *Subject:* Can one prevent Jetty from scanning specific jars for 
> annotations?
>
>  
>
> Hi and sorry - this is only indirectly a GWT question but since it’s 
> heavily related with GWT someone might have already bumped into the same 
> issue.
>
> So I dare to ask it here – maybe someone in this group knows a work-around 
> (so please bear with me!):
>
>  
>
> For 4 of our 5 projects using GWT we are still using the “classic” GWT 2.8 
> setup, i.e. with the “classic” plugin where one starts Jetty for 
> development and debugging.
>
>  
>
> We recently had to upgrade a couple of POI libraries (an Apache library to 
> generate Office documents from Java) and a few of those new jars obviously 
> annotations that are not compatible with the Jetty-version used by the GWT 
> 2.8 plugin.
>
>  
>
> “Not compatible” meaning, that Jetty during startup fails to scan those 
> files for certain annotations in 
> AnnotationConfiguration.scanForAnnotations (full error stack-trace below).
>
>  
>
> With Tomcat I had a similar (or identical?) issue but Tomcat offers a 
> configuration option (in catalina.properties) to omit a list of jars from 
> being scanned for Servlet annotations like so: 
>
>  
>
> …
>
> # Additional JARs (over and above the default JARs listed above) to skip 
> when
>
> # scanning for Servlet 3.0 pluggability features. These features include 
> web
>
> # fragments, annotations, SCIs and classes that match @HandlesTypes. The 
> list
>
> # must be a comma separated list of JAR file names.
>
> # added by MMS: these contain an illegal byte tag (for Java 8) in their 
> constants pool:
>
> *org.apache.catalina.startup.ContextConfig.jarsToSkip*=\
>
> log4j-api-2.17.2.jar,\
>
> poi-5.2.3.jar,\
>
> poi-ooxml-5.2.3.jar,\
>
> poi-ooxml-lite-5.2.3.jar,\
>
> xmlbeans-5.1.1.jar
>
> …
>
>  
>
> This saved me with Tomcat. But with Jetty I had no luck so far to achieve 
> something similar. This is now hindering our developer since they can’t run 
> and debug the application locally anymore. I had planned to move that 
> project to the new plugin and a local Tomcat only later this year.
>
>  
>
> Is there **any** way to teach Jetty to **not** do these Annotation 
> scannings, either, or otherwise prevent these jars from being scanned?
>
>  
>
>  
>
> The full error stacktrace:
>
>  
>
> ...
>
> 00:00:11.874 [WARN] Failed startup of context 
> c.g.g.d.s.j.WebAppContextWithReload@31419990{/,file:/D:/Projects/KStA_ZH_ZHQuest/code/application/zhquest-web/target/zhquest/,STARTING}{D:\Projects\KStA_ZH_ZHQuest\code\application\zhquest-web\target\zhquest}
>
> org.eclipse.jetty.util.MultiException: Multiple exceptions 
>
>       at 
> org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:536)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:447)
>  
>
>
>       at 
> org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:479) 
>
>       at 
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1337) 
>
>
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
>  
>
>
>       at 
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505) 
>
>       at 
> com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)
>  
>
>
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  
>
>
>       at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
>  
>
>
>       at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
>  
>
>
>       at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
>  
>
>
>       at 
> org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)
>  
>
>
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  
>
>
>       at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
>  
>
>
>       at org.eclipse.jetty.server.Server.start(Server.java:387) 
>
>       at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
>  
>
>
>       at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
>  
>
>
>       at org.eclipse.jetty.server.Server.doStart(Server.java:354) 
>
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  
>
>
>       at 
> com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760) 
>
>       at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
>
>       at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923) 
>
>       at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706) 
>
>       at com.google.gwt.dev.DevMode.main(DevMode.java:432) Caused by: 
> org.eclipse.jetty.util.MultiException: Multiple exceptions 
>
>       at 
> org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:899)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
>  
>
>
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>  
>
>
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>  
>
>
>       at java.lang.Thread.run(Thread.java:748)
>
> Caused by: java.lang.RuntimeException: Error scanning entry 
> META-INF/versions/9/org/apache/logging/log4j/util/Base64Util.class from jar 
> file:/D:/Projects/KStA_ZH_ZHQuest/code/application/zhquest-web/target/zhquest/WEB-INF/lib/log4j-api-2.17.2.jar
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
>  
>
>
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>  
>
>
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>  
>
>
>       at java.lang.Thread.run(Thread.java:748) Caused by: 
> java.lang.IllegalArgumentException: null 
>
>       at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
>
>       at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
>
>       at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
>
>       at 
> org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
>  
>
>
>       at 
> org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
>  
>
>
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>  
>
>
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>  
>
>
>       at java.lang.Thread.run(Thread.java:748)
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/fd302212-27f1-4503-bf30-763abb748f16n%40googlegroups.com.

Reply via email to