Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2548

StackOverFlow when used with EL and JSF

XMLWordPrintable

    • Hide

      1) deploying the attached jsf23-simple.war to WildFly 14.0.1.Final, which uses weld 3.0.5.Final.
      2) access the localhost:8080/jsf23-simple/el2.xhtml

      java.lang.StackOverflowError
      	at java.util.HashMap.putVal(HashMap.java:628)
      	at java.util.HashMap.put(HashMap.java:611)
      	at java.util.HashSet.add(HashSet.java:219)
      	at io.undertow.servlet.spec.HttpServletRequestImpl.getHeaderNames(HttpServletRequestImpl.java:221)
      	at com.sun.faces.context.RequestHeaderValuesMap.getEntryIterator(RequestHeaderValuesMap.java:132)
      	at com.sun.faces.context.BaseContextMap$EntrySet.iterator(BaseContextMap.java:169)
      	at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.java:1039)
      	at java.util.Collections$UnmodifiableCollection.iterator(Collections.java:1038)
      	at java.util.AbstractMap.toString(AbstractMap.java:547)
      	at java.util.Collections$UnmodifiableMap.toString(Collections.java:1493)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at org.jboss.weld.contexts.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at java.util.AbstractMap.toString(AbstractMap.java:559)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at org.jboss.weld.contexts.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at java.util.AbstractMap.toString(AbstractMap.java:559)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at org.jboss.weld.contexts.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at java.util.AbstractMap.toString(AbstractMap.java:559)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at org.jboss.weld.contexts.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60)
      	at java.lang.String.valueOf(String.java:2994)
      	at java.lang.StringBuilder.append(StringBuilder.java:131)
      	at java.util.AbstractMap.toString(AbstractMap.java:559)
      	at java.lang.String.valueOf(String.java:2994)
      
      Show
      1) deploying the attached jsf23-simple.war to WildFly 14.0.1.Final, which uses weld 3.0.5.Final. 2) access the localhost:8080/jsf23-simple/el2.xhtml java.lang.StackOverflowError at java.util.HashMap.putVal(HashMap.java:628) at java.util.HashMap.put(HashMap.java:611) at java.util.HashSet.add(HashSet.java:219) at io.undertow.servlet.spec.HttpServletRequestImpl.getHeaderNames(HttpServletRequestImpl.java:221) at com.sun.faces.context.RequestHeaderValuesMap.getEntryIterator(RequestHeaderValuesMap.java:132) at com.sun.faces.context.BaseContextMap$EntrySet.iterator(BaseContextMap.java:169) at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.java:1039) at java.util.Collections$UnmodifiableCollection.iterator(Collections.java:1038) at java.util.AbstractMap.toString(AbstractMap.java:547) at java.util.Collections$UnmodifiableMap.toString(Collections.java:1493) at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at org.jboss.weld.contexts.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60) at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at java.util.AbstractMap.toString(AbstractMap.java:559) at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at org.jboss.weld.contexts.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60) at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at java.util.AbstractMap.toString(AbstractMap.java:559) at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at org.jboss.weld.contexts.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60) at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at java.util.AbstractMap.toString(AbstractMap.java:559) at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at org.jboss.weld.contexts.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60) at java.lang.String.valueOf(String.java:2994) at java.lang.StringBuilder.append(StringBuilder.java:131) at java.util.AbstractMap.toString(AbstractMap.java:559) at java.lang.String.valueOf(String.java:2994)

      The StackOverFlow error could be resolved by modifying
      org.jboss.weld.contexts.AbstractContext.java .

      comment out the "beanStore.put(id, beanInstance);" at line 99.
      The StackOverFlow error would disappear.

         82         BeanIdentifier id = getId(contextual);
         83         ContextualInstance<T> beanInstance = beanStore.get(id);
         84         if (beanInstance != null) {
         85             return beanInstance.getInstance();
         86         } else if (creationalContext != null) {
         87             LockedBean lock = null;
         88             try {
         89                 if (multithreaded) {
         90                     lock = beanStore.lock(id);
         91                     beanInstance = beanStore.get(id);
         92                     if (beanInstance != null) {
         93                         return beanInstance.getInstance();
         94                     }   
         95                 }   
         96                 T instance = contextual.create(creationalContext);
         97                 if (instance != null) {
         98                     beanInstance = new SerializableContextualInstanceImpl<Contextual<T>, T>(contextual, instance, creationalContext, serviceRegistry.get(ContextualStore.class));         
         99                     // beanStore.put(id, beanInstance);
        100                 }
        101                 return instance;
        102             } finally {
        103                 if (lock != null) {
        104                     lock.unlock();
        105                 }
        106             }
        107         } else {
        108             return null;
        109         }
        110     }
        110     }
      
      

        1. jsf23-simple.war
          13 kB
          Ruolin Li

              Unassigned Unassigned
              ruolli Ruolin Li (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: