deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerhard Petracek <gerhard.petra...@gmail.com>
Subject Re: DeltaSpike x Payara App Server
Date Fri, 08 Jul 2016 21:04:02 GMT
hi edilmar,

if you are using it as base-class, please drop @FacesConverter

regards,
gerhard



2016-07-08 22:40 GMT+02:00 Edilmar LISTAS <edilista@intersite.com.br>:

> I have this abstract converter with generic code, but I never use this
> converter for JSF, I create children classes for JSF using. But it is
> possible that JEE7 appservers don't like this.
>
>
> Em 08-07-2016 15:26, Gerhard Petracek escreveu:
>
>> hi edilmar,
>>
>> please don't try to use abstract-classes as converters.
>> we don't have all details of your application, so it isn't possible to
>> answer why gf3 ~ignores it.
>>
>> regards,
>> gerhard
>>
>>
>>
>> 2016-07-08 21:14 GMT+02:00 Edilmar LISTAS <edilista@intersite.com.br>:
>>
>> But why does webapp run fine in GF 3.1.2.2/Mojarra 2.1.29 and doesn't in
>>> Payara/GF 4.1.1/Mojarra 2.2.13? My converter is very simple:
>>>
>>> package SubMacroWeb.convert;
>>>
>>> import SubMacroUtils.Geral;
>>> import SubMacroUtils.HTMLProducerTab;
>>> import SubMacroWeb.util.JsfUtil;
>>> import entity.GenericEntity;
>>> import javax.faces.component.UIComponent;
>>> import javax.faces.context.FacesContext;
>>> import javax.faces.convert.Converter;
>>> import javax.faces.convert.FacesConverter;
>>> import javax.persistence.EntityManager;
>>>
>>> @FacesConverter
>>> public abstract class LookupStrConverter<T> implements Converter {
>>>   private Class<T> persistentClass;
>>>   private EntityManager em;
>>>
>>>   public LookupStrConverter() {
>>>   }
>>>   protected void init(Class<T> persistentClass) {
>>>     setPersistentClass(persistentClass);
>>>     setEm(JsfUtil.getAttributeEntityManager());
>>>   }
>>>
>>>   public Class<T> getPersistentClass() {
>>>     return persistentClass;
>>>   }
>>>
>>>   public void setPersistentClass(Class<T> persistentClass) {
>>>     this.persistentClass = persistentClass;
>>>   }
>>>
>>>   public EntityManager getEm() {
>>>     return em;
>>>   }
>>>
>>>   public void setEm(EntityManager em) {
>>>     this.em = em;
>>>   }
>>>
>>>   @Override
>>>   public T getAsObject(FacesContext facesContext, UIComponent
>>> uiComponent,
>>> String string) {
>>>     if (Geral.StrEmpty(string)) {
>>>       return null;
>>>     }
>>>     try {
>>>       if (string.indexOf(HTMLProducerTab.XMLSEPARADORCOMBO) > -1)
>>>         string = Geral.getItemComboBoxCod(string);
>>>       T object;
>>>       if (em != null)
>>>         object = em.find(persistentClass, string);
>>>       else
>>>         object = null;
>>>       return object;
>>>     } catch (Exception e) {
>>>       e.printStackTrace();
>>>       return null;
>>>     }
>>>   }
>>>
>>>   @Override
>>>   public String getAsString(FacesContext facesContext, UIComponent
>>> uIComponent, Object object) {
>>>     if (object == null) {
>>>       return null;
>>>     }
>>>     if (object instanceof Long) {
>>>       return object.toString();
>>>     } else {
>>>       try {
>>>         GenericEntity o = (GenericEntity) object;
>>>         return Geral.LimpaDescricao(o.getDescricao()) +
>>> HTMLProducerTab.XMLSEPARADORCOMBO + o.getCodigo().toString();
>>>       } catch (Exception e) {
>>>         e.printStackTrace();
>>>         return null;
>>>       }
>>>     }
>>>   }
>>> }
>>>
>>>
>>> Em 07-07-2016 12:33, Gerhard Petracek escreveu:
>>>
>>> hi edilmar,
>>>>
>>>> looks like mojarra has an issue with your converter - see:
>>>> at
>>>>
>>>>
>>>> sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
>>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>>>> at java.lang.Class.newInstance(Class.java:442)
>>>> at
>>>>
>>>>
>>>> com.sun.faces.application.ApplicationImpl.newConverter(ApplicationImpl.java:1808)
>>>>
>>>> -> that isn't related to deltaspike.
>>>>
>>>> regards,
>>>> gerhard
>>>>
>>>>
>>>>
>>
>

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