struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Götz <s.go...@inform-technology.de>
Subject Re: Java 11 support
Date Thu, 24 Jan 2019 10:41:35 GMT
Hello Yasser,

I have followed your instructions. The exceptions are gone although my
webapp does not work either.
But I need more time to figure out whether this is a general
compatibility issue between struts2 2.5.2 and 2.5.20 or a matter of the
Java 11 compiler.


Am 23.01.2019 um 08:17 schrieb Yasser Zamani:
>
>> -----Original Message-----
>> From: Sebastian Götz <s.goetz@inform-technology.de>
>> Sent: Thursday, January 17, 2019 4:41 PM
>> To: user@struts.apache.org
>> Subject: Re: Java 11 support
>>
>> Hi folks,
>>
>> it appears that there is some work left in the convention plugin. As I can see from
>> my IVY resolve process this plugin drags in asm 5.2. From its sources it looks like
it
>> supports class version up to 1.8 (class version 52).
>> As we compile with JDK 11 already (class version 55) we get a lot of these
>> exceptions:
>>
>>  java.lang.IllegalArgumentException
>>     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.apache.struts2.convention.DefaultClassFinder.readClassDef(DefaultClassFind
>> er.java:461)
>>     at
>> org.apache.struts2.convention.DefaultClassFinder.<init>(DefaultClassFinder.java:
>> 93)
>>     at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildClassFind
>> er(PackageBasedActionConfigBuilder.java:395)
>>     at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(Pa
>> ckageBasedActionConfigBuilder.java:377)
>>     at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionCo
>> nfigs(PackageBasedActionConfigBuilder.java:333)
>>     at
>> org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(Classpat
>> hPackageProvider.java:52)
>>     at
>> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(D
>> efaultConfiguration.java:206)
>>     at
>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Con
>> figurationManager.java:66)
>>     at
>> org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957)
>>     at
>> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.j
>> ava:463)
>>     at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
>>     at
>> org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:7
>> 3)
>>     at
>> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrep
>> areAndExecuteFilter.java:61)
>>     at
>> eu.inform.servlet.context.URIExcludeFilter.init(URIExcludeFilter.java:37)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig
>> .java:270)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig
>> .java:251)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.ja
>> va:102)
>>     at
>> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4491)
>>     at
>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:51
>> 35)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432
>> )
>>     at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422
>> )
>>     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>     at
>> org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorServ
>> ice.java:75)
>>     at
>> java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorS
>> ervice.java:140)
>>     at
>> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
>>     at
>> org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432
>> )
>>     at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422
>> )
>>     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>     at
>> org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorServ
>> ice.java:75)
>>     at
>> java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorS
>> ervice.java:140)
>>     at
>> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
>>     at
>> org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at
>> org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at
>> org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:801)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at org.apache.catalina.startup.Catalina.start(Catalina.java:695)
>>     at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>     at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodA
>> ccessorImpl.java:62)
>>     at
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Delegating
>> MethodAccessorImpl.java:43)
>>     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
>>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
>>
>> I tried to exclude asm 5.2 on favor of 7.0 which works from the dependency
>> resolving side. But the Struts2 ClassVisitor implementation is tied to ASM 5:
>>
>> public class InfoBuildingVisitor extends ClassVisitor {
>>         private Info info;
>>         private ClassFinder classFinder;
>>
>>         public InfoBuildingVisitor(ClassFinder classFinder) {
>>             super(Opcodes.ASM5);
>>             this.classFinder = classFinder;
>>         }
>> ...
>> }
>>
>> Therefore this leads to the following problem:
>>
>> java.lang.UnsupportedOperationException: This feature requires ASM7
>>     at
>> org.objectweb.asm.ClassVisitor.visitNestMember(ClassVisitor.java:236)
>>     at org.objectweb.asm.ClassReader.accept(ClassReader.java:651)
>>     at org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
>>     at
>> org.apache.struts2.convention.DefaultClassFinder.readClassDef(DefaultClassFind
>> er.java:462)
>>     at
>> org.apache.struts2.convention.DefaultClassFinder.<init>(DefaultClassFinder.java:
>> 93)
>>     at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildClassFind
>> er(PackageBasedActionConfigBuilder.java:395)
>>     at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(Pa
>> ckageBasedActionConfigBuilder.java:377)
>>     at
>> org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionCo
>> nfigs(PackageBasedActionConfigBuilder.java:333)
>>     at
>> org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(Classpat
>> hPackageProvider.java:52)
>>     at
>> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(D
>> efaultConfiguration.java:206)
>>     at
>> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Con
>> figurationManager.java:66)
>>     at
>> org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957)
>>     at
>> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.j
>> ava:463)
>>     at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
>>     at
>> org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:7
>> 3)
>>     at
>> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrep
>> areAndExecuteFilter.java:61)
>>     at
>> eu.inform.servlet.context.URIExcludeFilter.init(URIExcludeFilter.java:37)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig
>> .java:270)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig
>> .java:251)
>>     at
>> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.ja
>> va:102)
>>     at
>> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4491)
>>     at
>> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:51
>> 35)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432
>> )
>>     at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422
>> )
>>     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>     at
>> org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorServ
>> ice.java:75)
>>     at
>> java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorS
>> ervice.java:140)
>>     at
>> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
>>     at
>> org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1432
>> )
>>     at
>> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1422
>> )
>>     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>     at
>> org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorServ
>> ice.java:75)
>>     at
>> java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorS
>> ervice.java:140)
>>     at
>> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:944)
>>     at
>> org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:261)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at
>> org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at
>> org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:801)
>>     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
>>     at org.apache.catalina.startup.Catalina.start(Catalina.java:695)
>>     at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>     at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodA
>> ccessorImpl.java:62)
>>     at
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Delegating
>> MethodAccessorImpl.java:43)
>>     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
>>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
>>
>> Can someone verfiy that and propose a fix?
>>
>
> Hi Sebastian,
>
> Thank you very much for your explores share!
>
> Yes you're right. It seems we should upgrade to ASM7 in 2.5.21 also if it passed all
tests as well. And sorry for these troubles above! We missed those because we run our integration
tests in struts showcase app only on JDK8 and only with target java 7 (as you discovered).
>
> Could you please check if any further issue persists with my following solution (beside
your workaround for drop-in ASM7 dependency)? I think "This feature requires ASM7" will vanished
with it but I'm not comprehensively sure if any further issue arises after. If so, it would
be nice to fix them in 2.5.21 as well (beside asm.version=7.0).
>
> The solution (with thanks to Struts awesome design) :) :
> 1. Copy org.apache.struts2.convention.DefaultClassFinder and paste to your.app.target.package.ASM7DefaultClassFinder.
> 2. Replace all Opcodes.ASM5 with Opcodes.ASM7 in your.app.target.package.ASM7DefaultClassFinder.
> 3. Define the new class your.app.target.package.ASM7ClassFinderFactory as below:
> import com.opensymphony.xwork2.util.finder.ClassFinder;
> import com.opensymphony.xwork2.util.finder.ClassFinderFactory;
> import com.opensymphony.xwork2.util.finder.ClassLoaderInterface;
> import com.opensymphony.xwork2.util.finder.Test; 
> public class ASM7ClassFinderFactory implements ClassFinderFactory {
>     public ClassFinder buildClassFinder(ClassLoaderInterface classLoaderInterface, Collection
urls, boolean extractBaseInterfaces, Set protocols, Test classNameFilter) {
>         return new ASM7DefaultClassFinder(classLoaderInterface, urls, extractBaseInterfaces,
protocols, classNameFilter);
>     }
> }
> 4. Register it in your struts.xml as below:
> <bean type="com.opensymphony.xwork2.util.finder.ClassFinderFactory" class="your.app.target.package.ASM7ClassFinderFactory"
scope="singleton"/>
>
> Thanks in advance!
>
> Kind Regards.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

-- 
Mit freundlichen Grüßen

Sebastian Götz

iNFORM Technology GmbH
Niederlassung Albstadt
Berliner Straße 24
72458 Albstadt-Ebingen

Tel: +49 7431 9816090
Fax: +49 7431 9816092
s.goetz@inform-technology.de <mailto:s.goetz@inform-technology.de>
PGP-Fingerabdruck: 8B0F A27C 16E2 1EFA 1323 997F 038A 001A A597 F613
http://www.inform-technology.de/

*****************************************************

Zentrale Stockach:
Bodenseeallee 18
D-78333 Stockach
Tel: +49 7771 9282 494

*****************************************************

Geschäftsführer: Dipl.-Ing. (FH) Heinz Roth | Handelsregister: HRB
715948, Amtsgericht Freiburg | USt-ID Nr.: DE312290945

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message