Re: s:fielderror not working in Java 8, WebSphere
I have faced similar issue. problem is on Java 8. On Thu, Jun 14, 2018, 8:12 PM Doug Breaux wrote: > > > On 2018/05/22 18:24:34, bre...@us.ibm.com wrote: > > Struts 2.5.14.1, WebSphere 8.5.5.13, IBM Java 8 (level 1.8.0_161) on AIX. > > > > We have a JSP with a plain element that works without > issue when we switch WebSphere back to Java 7, but in Java 8 produces the > following error: > > > > 2018-05-22 12:43:24,384 ERROR [freemarker.runtime]: error - Error > executing FreeMarker template > > FreeMarker template error: > > Java method "AbstractCollection.size()" threw an exception when invoked > on LinkedHashMap$LinkedKeySet object "[]"; see cause exception in the Java > stack trace. > > FYI, after pursuing as IBM Java issue, it now appears to be an issue with > a 3rd-party agent installed to the JVM, and am pursuing with them. > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/22 18:24:34, bre...@us.ibm.com wrote: > Struts 2.5.14.1, WebSphere 8.5.5.13, IBM Java 8 (level 1.8.0_161) on AIX. > > We have a JSP with a plain element that works without issue > when we switch WebSphere back to Java 7, but in Java 8 produces the following > error: > > 2018-05-22 12:43:24,384 ERROR [freemarker.runtime]: error - Error executing > FreeMarker template > FreeMarker template error: > Java method "AbstractCollection.size()" threw an exception when invoked on > LinkedHashMap$LinkedKeySet object "[]"; see cause exception in the Java stack > trace. FYI, after pursuing as IBM Java issue, it now appears to be an issue with a 3rd-party agent installed to the JVM, and am pursuing with them. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/24 14:42:55, Yasser Zamani wrote: > > But freemarker claims "Java method "AbstractCollection.size()" threw an > exception when invoked on LinkedHashMap$LinkedKeySet object "[]"; see > cause exception in the Java stack trace" and Java stack trace in JSP > exception says "Caused by: java.lang.AbstractMethodError: > java/util/AbstractCollection.size()I". Maybe that JSP exception isn't > for that freemarker exception but it's an unlikely guess from me. > > > I do have some IBM Java folks able to look at the issue, BTW. At least one > > of them pointed at this a potentially related, but beyond me to know if it > > could be: > > > > https://github.com/eclipse/openj9/pull/1892 > > Maybe. I see freemarker search superclasses for methods because class > LinkedHashMap$LinkedKeySet is private. I'm not sure or check if it > always find more specific method! At the suggestion of some IBM Java folks, I opened an issue at https://github.com/eclipse/openj9/issues/2010 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 5/24/2018 6:43 PM, Doug Breaux wrote: > I'm not sure if I misunderstood the threading here, or just missed this test > case, but this one does seem to run the same on IBM Java 8: > > java TestForStruts2 > COPY ME 1: class java.util.LinkedHashMap$LinkedKeySet > COPY ME 2: public abstract int java.util.AbstractCollection.size() > COPY ME 3: 0 > But freemarker claims "Java method "AbstractCollection.size()" threw an exception when invoked on LinkedHashMap$LinkedKeySet object "[]"; see cause exception in the Java stack trace" and Java stack trace in JSP exception says "Caused by: java.lang.AbstractMethodError: java/util/AbstractCollection.size()I". Maybe that JSP exception isn't for that freemarker exception but it's an unlikely guess from me. > I do have some IBM Java folks able to look at the issue, BTW. At least one of > them pointed at this a potentially related, but beyond me to know if it could > be: > > https://github.com/eclipse/openj9/pull/1892 Maybe. I see freemarker search superclasses for methods because class LinkedHashMap$LinkedKeySet is private. I'm not sure or check if it always find more specific method! Regards.
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/24 06:42:48, Yasser Zamaniwrote: > > It seems IBM JDK 8 has different behavior than Oracle or OpenJDK 8. Your > exception claims that JDK is not able to call abstract method size on > LinkedKeySet but here, Oracle and OpenJDK 8 are able to run: > > LinkedHashMap lhm = new LinkedHashMap(); > Object ks = LinkedHashMap.class.getMethod("keySet").invoke(lhm); > System.out.println("COPY ME 1: " + ks.getClass()); > Method m = AbstractCollection.class.getMethod("size"); > System.out.println("COPY ME 2: " + m); > Object s = m.invoke(ks); > System.out.println("COPY ME 3: " + s); > > They prints: > > COPY ME 1: class java.util.LinkedHashMap$LinkedKeySet > COPY ME 2: public abstract int java.util.AbstractCollection.size() > COPY ME 3: 0 > > which means they're able! I don't know if IBM violates Java > Specification here or Oracle and OpenJDK do. Are you able to ask IBM why > above piece of code fails on their JDK 8 and pass on 7? I'm not sure if I misunderstood the threading here, or just missed this test case, but this one does seem to run the same on IBM Java 8: java TestForStruts2 COPY ME 1: class java.util.LinkedHashMap$LinkedKeySet COPY ME 2: public abstract int java.util.AbstractCollection.size() COPY ME 3: 0 I do have some IBM Java folks able to look at the issue, BTW. At least one of them pointed at this a potentially related, but beyond me to know if it could be: https://github.com/eclipse/openj9/pull/1892 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/24 06:42:48, Yasser Zamaniwrote: > > It seems IBM JDK 8 has different behavior than Oracle or OpenJDK 8. Your > exception claims that JDK is not able to call abstract method size on > LinkedKeySet but here, Oracle and OpenJDK 8 are able to run: > > LinkedHashMap lhm = new LinkedHashMap(); > Object ks = LinkedHashMap.class.getMethod("keySet").invoke(lhm); > System.out.println("COPY ME 1: " + ks.getClass()); > Method m = AbstractCollection.class.getMethod("size"); > System.out.println("COPY ME 2: " + m); > Object s = m.invoke(ks); > System.out.println("COPY ME 3: " + s); > > They prints: > > COPY ME 1: class java.util.LinkedHashMap$LinkedKeySet > COPY ME 2: public abstract int java.util.AbstractCollection.size() > COPY ME 3: 0 > > which means they're able! I don't know if IBM violates Java > Specification here or Oracle and OpenJDK do. Are you able to ask IBM why > above piece of code fails on their JDK 8 and pass on 7? I'm looking for a way to pursue with IBM Java people. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 5/22/2018 10:54 PM, breaux@ wrote: > 2018-05-22 12:43:24,384 ERROR [freemarker.runtime]: error - Error executing > FreeMarker template > FreeMarker template error: > Java method "AbstractCollection.size()" threw an exception when invoked on > LinkedHashMap$LinkedKeySet object "[]"; see cause exception in the Java stack > trace. > Caused by: java.lang.AbstractMethodError: java/util/AbstractCollection.size()I > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) > at java.lang.reflect.Method.invoke(Method.java:508) > at > freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1487) It seems IBM JDK 8 has different behavior than Oracle or OpenJDK 8. Your exception claims that JDK is not able to call abstract method size on LinkedKeySet but here, Oracle and OpenJDK 8 are able to run: LinkedHashMap lhm = new LinkedHashMap(); Object ks = LinkedHashMap.class.getMethod("keySet").invoke(lhm); System.out.println("COPY ME 1: " + ks.getClass()); Method m = AbstractCollection.class.getMethod("size"); System.out.println("COPY ME 2: " + m); Object s = m.invoke(ks); System.out.println("COPY ME 3: " + s); They prints: COPY ME 1: class java.util.LinkedHashMap$LinkedKeySet COPY ME 2: public abstract int java.util.AbstractCollection.size() COPY ME 3: 0 which means they're able! I don't know if IBM violates Java Specification here or Oracle and OpenJDK do. Are you able to ask IBM why above piece of code fails on their JDK 8 and pass on 7? Thanks in advance! - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/23 19:30:40, Yasser Zamaniwrote: > > Thanks. Sorry, for last one, could you check: > > java.util.Map lhm = new java.util.LinkedHashMap<>(); > Class c = lhm.getClass(); > java.lang.reflect.Method m = c.getMethod("keySet"); > Object ks = m.invoke(lhm); > Class c2 = ks.getClass(); > java.lang.reflect.Method m2 = c2.getMethod("size"); > System.out.println("COPY ME 1: " + m2); > Object s = m2.invoke(ks); > System.out.println("COPY ME 2: " + s); java TestForStruts COPY ME 1: public final int java.util.LinkedHashMap$LinkedKeySet.size() Exception in thread "main" java.lang.IllegalAccessException: Class TestForStruts can not access a member of class java.util.LinkedHashMap$LinkedKeySet with modifiers "public final" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:114) at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:399) at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:391) at java.lang.reflect.Method.invoke(Method.java:501) at TestForStruts.main(TestForStruts.java:15) Where line 15 is: Object s = m2.invoke(ks); - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 5/23/2018 11:29 PM, Doug Breaux wrote: > Looks the same: > > java TestForStruts > COPY ME 1: public abstract int java.util.Set.size() > COPY ME 2: 0 Thanks. Sorry, for last one, could you check: java.util.Map lhm = new java.util.LinkedHashMap<>(); Class c = lhm.getClass(); java.lang.reflect.Method m = c.getMethod("keySet"); Object ks = m.invoke(lhm); Class c2 = ks.getClass(); java.lang.reflect.Method m2 = c2.getMethod("size"); System.out.println("COPY ME 1: " + m2); Object s = m2.invoke(ks); System.out.println("COPY ME 2: " + s); and if were successful, then check in your action method if: java.util.Map lhm = this.getFieldErrors() Class c = lhm.getClass(); java.lang.reflect.Method m = c.getMethod("keySet"); Object ks = m.invoke(lhm); Class c2 = ks.getClass(); java.lang.reflect.Method m2 = c2.getMethod("size"); System.out.println("COPY ME 1: " + m2); Object s = m2.invoke(ks); System.out.println("COPY ME 2: " + s); is also successful.
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/23 18:38:19, Yasser Zamaniwrote: > then reply back COPY MEs values please. Here I get: > > COPY ME 1: public abstract int java.util.Set.size() > COPY ME 2: 0 Looks the same: java TestForStruts COPY ME 1: public abstract int java.util.Set.size() COPY ME 2: 0 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
Sorry. Could you please check this updated one which is OK here: public static void main(String[] args) throws Exception { java.util.Map lhm = new java.util.LinkedHashMap<>(); Class c = lhm.getClass(); java.lang.reflect.Method m = c.getMethod("keySet"); Object ks = m.invoke(lhm); java.lang.reflect.Method m2 = m.getReturnType().getMethod("size"); System.out.println("COPY ME 1: " + m2); Object s = m2.invoke(ks); System.out.println("COPY ME 2: " + s); } then reply back COPY MEs values please. Here I get: COPY ME 1: public abstract int java.util.Set.size() COPY ME 2: 0 On 5/23/2018 11:01 PM, Doug Breaux wrote: > > > On 2018/05/23 18:11:34, Yasser Zamaniwrote: > >> Thanks. Could you also check if your IBM JDK 8 is able to run this: >> >> java.util.Map lhm = new >> java.util.LinkedHashMap<>(); >> Class c = lhm.getClass(); >> Method m = c.getMethod("keySet"); >> Object ks = m.invoke(lhm); >> Method m2 = m.getReturnType().getMethod("size"); >> Object s = m2.invoke(ks); >> >> System.out.println("COPY ME: " + s); >> > > That actually produces a compile error: > > TestForStruts.java:10: error: incompatible types: Class cannot be > converted to Class > Class c = lhm.getClass(); >^ > where CAP#1 is a fresh type-variable: > CAP#1 extends Map from capture of ? extends Map > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/23 18:11:34, Yasser Zamaniwrote: > Thanks. Could you also check if your IBM JDK 8 is able to run this: > > java.util.Map lhm = new > java.util.LinkedHashMap<>(); > Class c = lhm.getClass(); > Method m = c.getMethod("keySet"); > Object ks = m.invoke(lhm); > Method m2 = m.getReturnType().getMethod("size"); > Object s = m2.invoke(ks); > > System.out.println("COPY ME: " + s); > That actually produces a compile error: TestForStruts.java:10: error: incompatible types: Class cannot be converted to Class Class c = lhm.getClass(); ^ where CAP#1 is a fresh type-variable: CAP#1 extends Map from capture of ? extends Map - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 5/23/2018 8:56 PM, Doug Breaux wrote: > This is the latest IBM JDK 8. Or at least the latest that works with our > version WebSphere, but it's very recent. The build date is 20180214. And this > WebSphere cannot use Oracle or OpenJDK. Thanks. Could you also check if your IBM JDK 8 is able to run this: java.util.Maplhm = new java.util.LinkedHashMap<>(); Class c = lhm.getClass(); Method m = c.getMethod("keySet"); Object ks = m.invoke(lhm); Method m2 = m.getReturnType().getMethod("size"); Object s = m2.invoke(ks); System.out.println("COPY ME: " + s); - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/23 15:38:51, Yasser Zamaniwrote: > > Could you check with latest version of IBM JDK 8? And are you maybe able > to check also with Oracle and OpenJDK 8? This is the latest IBM JDK 8. Or at least the latest that works with our version WebSphere, but it's very recent. The build date is 20180214. And this WebSphere cannot use Oracle or OpenJDK. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
On 5/23/2018 5:38 PM, Doug Breaux wrote: > Quite possibly. Hoping somebody here will be able to confirm or give some > additional hints. Could you check with latest version of IBM JDK 8? And are you maybe able to check also with Oracle and OpenJDK 8?
Re: s:fielderror not working in Java 8, WebSphere
On 2018/05/23 06:07:05, Lukasz Lenartwrote: > You mean ? There is no tag. Did you > try to use the latest Freemarker version? Yes, sorry. I did not try the latest Freemarker, I'm using what is packaged with Struts (min-lib.zip). Which, even at the very latest 2.5.16, is apparently 2.3.26-incubating. I assumed that whatever is packaged with Struts is what is tested and "supported" with it. Not using Maven, but I assume that's what the Maven dependency would pull in as well? > I have tested the tag with Oracle Java 8 and it works without issue. > Look like incompatibility between IBM Java and Freemarker. Quite possibly. Hoping somebody here will be able to confirm or give some additional hints. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:fielderror not working in Java 8, WebSphere
You mean ? There is no tag. Did you try to use the latest Freemarker version? I have tested the tag with Oracle Java 8 and it works without issue. Look like incompatibility between IBM Java and Freemarker. 2018-05-22 20:24 GMT+02:00 bre...@us.ibm.com: > Struts 2.5.14.1, WebSphere 8.5.5.13, IBM Java 8 (level 1.8.0_161) on AIX. > > We have a JSP with a plain element that works without issue > when we switch WebSphere back to Java 7, but in Java 8 produces the following > error: > > 2018-05-22 12:43:24,384 ERROR [freemarker.runtime]: error - Error executing > FreeMarker template > FreeMarker template error: > Java method "AbstractCollection.size()" threw an exception when invoked on > LinkedHashMap$LinkedKeySet object "[]"; see cause exception in the Java stack > trace. > > > FTL stack trace ("~" means nesting-related): > - Failed at: #assign eKeysSize = eKeys.size() [in template > "template/simple/fielderror.ftl" at line 23, column 5] > > > Java stack trace (for programmers): > > freemarker.core._TemplateModelException: [... Exception message was already > printed; see it above ...] > at > freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:289) > at > freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:252) > at > freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:74) > at freemarker.core.MethodCall._eval(MethodCall.java:65) > at freemarker.core.Expression.eval(Expression.java:81) > at freemarker.core.Assignment.accept(Assignment.java:134) > at freemarker.core.Environment.visit(Environment.java:326) > at freemarker.core.Environment.visit(Environment.java:332) > at freemarker.core.Environment.visit(Environment.java:332) > at freemarker.core.Environment.process(Environment.java:305) > at freemarker.template.Template.process(Template.java:378) > at > org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:149) > at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:579) > at org.apache.struts2.components.UIBean.end(UIBean.java:535) > at > org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:39) > .. my JSP > .. > Caused by: java.lang.AbstractMethodError: java/util/AbstractCollection.size()I > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) > at java.lang.reflect.Method.invoke(Method.java:508) > at > freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1487) > at > freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:69) > > Does anyone know what could be the cause of this? > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org