2 Replies Latest reply on Feb 8, 2007 12:12 PM by dandiodati

    Converter exception when using a factory?

    dandiodati

      We have this object that exists in the servlet session that I want to make available to inject into other Seam components. So I tried to create a factory pattern object:

      public class SessionObjFactory {
      
       public ParamBean getParamBean()
       {
       return (ParamBean)Contexts.getSessionContext().get(SessionConstants.PARAMS);
       }
      
       public void setParamBean(ParamBean params)
       {
       Contexts.getSessionContext().set(SessionConstants.PARAMS, params);
      }
      
      }



      and specified a SessionObjFactory.component.xml (wanted to use the auto-create option which does not seem to be available in the Factory annotation).

      <component>
      <factory name="paramBean" value="#{sessionScope.paramBean}" scope="session"/>
      </component>

      on startup I see the following exception:
      17:11:05,069 ERROR [[/]] Exception sending context initialized event to listener
      instance of class org.jboss.seam.servlet.SeamListener
      java.lang.IllegalArgumentException: No converter for type: com.sf.bean.ParamBean
      at org.jboss.seam.util.Conversions.getConverter(Conversions.java:54)
      at org.jboss.seam.Component$ConstantInitialValue.(Component.java:1
      971)
      at org.jboss.seam.Component.getInitialValue(Component.java:400)
      at org.jboss.seam.Component.initInitializers(Component.java:378)
      at org.jboss.seam.Component.(Component.java:263)
      at org.jboss.seam.Component.(Component.java:204)
      at org.jboss.seam.init.Initialization.addComponent(Initialization.java:7
      42)
      at org.jboss.seam.init.Initialization.addComponents(Initialization.java:
      674)
      at org.jboss.seam.init.Initialization.init(Initialization.java:429)
      at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.j
      ava:33)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
      t.java:3763)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
      ...





      What is going on I thought the factory pattern can be used to create any Pojo object? I can't find any documentation for having to create some Converter object for factories?