org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 88): Method call: Method toGregorianCalendar() cannot be found on java.util.Date type

Stack Overflow | Ulhas N | 3 weeks ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Method toGregorianCalendar() cannot be found on java.util.Date type

    Stack Overflow | 3 weeks ago | Ulhas N
    org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 88): Method call: Method toGregorianCalendar() cannot be found on java.util.Date type
  2. 0

    I think #this is not resolved correctly when it is used as an argument of a static method. If I try to execute this code : {code:title=TestExpr.java|borderStyle=solid} List<Map<String, Object>> myPayload = new ArrayList<Map<String, Object>>(); Map<String, Object> v1 = new HashMap<String, Object>(); Map<String, Object> v2 = new HashMap<String, Object>(); v1.put("test11", "test11"); v1.put("test12", "test12"); v2.put("test21", "test21"); v2.put("test22", "test22"); myPayload.add(v1); myPayload.add(v2); EvaluationContext context = new StandardEvaluationContext(myPayload); ExpressionParser parser=new SpelExpressionParser(); List res = parser.parseExpression("#root.![T(org.springframework.util.StringUtils).collectionToCommaDelimitedString(#this.values())]").getValue(context, List.class); {code} I get an exception : {code} org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 6): Method call: Method values() cannot be found on java.util.ArrayList type at org.springframework.expression.spel.ast.MethodReference.findAccessorForMethod(MethodReference.java:211) at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:125) at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49) at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:342) at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88) at org.springframework.expression.spel.ast.MethodReference.getArguments(MethodReference.java:154) {code} In this case #this shouldn't be an ArrayList but a HashMap. If I don't use #this in the method collectionToCommaDelimitedString, but directly in the projection expression like this : {code} List res = parser.parseExpression("#root.![#this.values()]").getValue(context, List.class); {code} I don't have any exceptions and the result is the one I was expecting.

    Spring JIRA | 2 years ago | Franck MARCHAND
    org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 6): Method call: Method values() cannot be found on java.util.ArrayList type
  3. 0

    I think #this is not resolved correctly when it is used as an argument of a static method. If I try to execute this code : {code:title=TestExpr.java|borderStyle=solid} List<Map<String, Object>> myPayload = new ArrayList<Map<String, Object>>(); Map<String, Object> v1 = new HashMap<String, Object>(); Map<String, Object> v2 = new HashMap<String, Object>(); v1.put("test11", "test11"); v1.put("test12", "test12"); v2.put("test21", "test21"); v2.put("test22", "test22"); myPayload.add(v1); myPayload.add(v2); EvaluationContext context = new StandardEvaluationContext(myPayload); ExpressionParser parser=new SpelExpressionParser(); List res = parser.parseExpression("#root.![T(org.springframework.util.StringUtils).collectionToCommaDelimitedString(#this.values())]").getValue(context, List.class); {code} I get an exception : {code} org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 6): Method call: Method values() cannot be found on java.util.ArrayList type at org.springframework.expression.spel.ast.MethodReference.findAccessorForMethod(MethodReference.java:211) at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:125) at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49) at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:342) at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88) at org.springframework.expression.spel.ast.MethodReference.getArguments(MethodReference.java:154) {code} In this case #this shouldn't be an ArrayList but a HashMap. If I don't use #this in the method collectionToCommaDelimitedString, but directly in the projection expression like this : {code} List res = parser.parseExpression("#root.![#this.values()]").getValue(context, List.class); {code} I don't have any exceptions and the result is the one I was expecting.

    Spring JIRA | 2 years ago | Franck MARCHAND
    org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 6): Method call: Method values() cannot be found on java.util.ArrayList type
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Why is my custom AclPermissionEvaluator not working?

    Stack Overflow | 1 year ago | Stefan Falk
    org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 0): Method call: Method hasPermission(java.lang.String) cannot be found on org.springframework.security.access.expression.method.MethodSecurityExpressionRoot type
  6. 0

    Spring + Thymeleaf, error in parsing integer to access array through javascript

    Stack Overflow | 2 months ago | Rizki Mardian
    org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 4): Method call: Method getPlasmid(null) cannot be found on org.cidarlab.main.thomoclotho.PlasmidList type

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.expression.spel.SpelEvaluationException

      EL1004E:(pos 88): Method call: Method toGregorianCalendar() cannot be found on java.util.Date type

      at org.springframework.expression.spel.ast.MethodReference.findAccessorForMethod()
    2. Spring Expression Language (SpEL)
      MethodReference.getValueInternal
      1. org.springframework.expression.spel.ast.MethodReference.findAccessorForMethod(MethodReference.java:185)
      2. org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:107)
      2 frames