[ 
https://issues.apache.org/jira/browse/OFBIZ-12721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17654543#comment-17654543
 ] 

Jacques Le Roux commented on OFBIZ-12721:
-----------------------------------------

Hi Daniel,

bq. If I've understood the situation correctly, OFBIZ-12733 shall be used to 
apply the workarounds necessary to get both the release 22 branch and trunk 
working with JDK 17 and Gradle 7.6. We can consider those workarounds as our 
'tactical' fixes needed to remove a blocker for release 22.
Yep. As I already suggested For 18.12, that is currently the stable demo, we 
will simply stop and comment it out in https://ofbiz.apache.org/ofbiz-demos.html

bq. Conversely, OFBIZ-12400 and its sub-tickets are for the 
'strategic/long-term' fixes to get OFBiz running with JDK 17 without the need 
for any workarounds.
Not all of them (eg OFBIZ-12729 is a pre-step and depends on OFBIZ-12733). It's 
more to easily focus on what need's to be done regarding JDK 17, at least for 
me :). Though I don't see why now, maybe we will need to create more sub or 
related tickets.

bq. As OFBIZ-12400 and its sub-tickets are resolved in trunk, we should see 
workaround from OFBIZ-12733 gradually removed from trunk.
Right, as we know it will certainly take some time.

Note: if you don't know already by hovering on Jira issues you can read their 
titles. Also if you use the simple syntax (OFBIZ-#) you can know if they are 
-closed- or not (then 

> Replace all occurrences of java.util.TimeZone by java.time.ZoneId
> -----------------------------------------------------------------
>
>                 Key: OFBIZ-12721
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12721
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: ALL COMPONENTS
>    Affects Versions: Upcoming Branch
>         Environment: Java 17
>            Reporter: Jacques Le Roux
>            Assignee: Ioan Eugen Stan
>            Priority: Major
>
> Using JDK 17, we have this issue:
> {noformat}
> 2022-12-06 19:04:30,689 |sse-nio-8443-exec-10 |FreeMarkerWorker              
> |E| null
> freemarker.core._TemplateModelException: Java method 
> "sun.util.calendar.ZoneInfo.useDaylightTime()" threw an exception when 
> invoked on sun.util.calendar.ZoneInfo object 
> "sun.util.calendar.ZoneInfo[id=\"Europe/Paris\",offset=3600000,dstSa
> vings=3600000,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,start
> TimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]";
>  see cause exception in the Java stack trace.
> ----
> FTL stack trace ("~" means nesting-related):
>         - Failed at: ${timeZone.getDisplayName(timeZone.us...  [in template 
> "component://helveticus/template/includes/Footer.ftl" at line 21, column 98]
> ----
>         at 
> freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:292)
>  ~[freemarker-2.3.31.jar:2.3.31]
> [...]
> Caused by: java.lang.IllegalAccessException: class 
> freemarker.ext.beans.BeansWrapper cannot access class 
> sun.util.calendar.ZoneInfo (in module java.base) because module java.base 
> does not export sun.util.calendar to unnamed module @1c852c0f
>         at 
> jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
>  ~[?:?]
>         at 
> java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674) 
> ~[?:?]
>         at java.lang.reflect.Method.invoke(Method.java:560) ~[?:?]
>         at 
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1552) 
> ~[freemarker-2.3.31.jar:2.3.31]
>         at 
> freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:73) 
> ~[freemarker-2.3.31.jar:2.3.31]
>         ... 85 more
> {noformat}
> [The var timeZone is accessible in screen 
> context|https://cwiki.apache.org/confluence/display/OFBIZ/Variables+always+available+in+screen+context].
>  The java.util.TimeZone class uses sun.util.calendar.ZoneInfo internally. 
> It's no longer supported by Java 17. We need to replace all occurrences of 
> java.util.TimeZone by java.time.ZoneId.
> An easy temporary solution is to set 
> {{--add-exports=java.base/sun.util.calendar=ALL-UNNAMED}} in build.gradle:
> : 
> ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=100000;maxdepth=20;maxrefs=1000;maxbytes=500000','--add-exports=java.base/sun.util.calendar=ALL-UNNAMED']
> It has no impact with JDK 11.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to