2 Replies Latest reply on Mar 25, 2008 12:09 PM by Carsten Hoehne

    duplicate method: createInstance with HibernateEntityHome

    Carsten Hoehne Master

      Hello,
      i do have an application derived from the seam 1.2.1GA hibernate example. This app is sucessfully migrated to Seam 2.0.0 and JPA Entities.


      But i have to maintain the seam 1.2.1 version of tzhe app.
      In the app all Entities are created in context.xml:


           <factory name="umsatz" value="#{umsatzHome.instance}" />
      
      
           <component class="de.katharinad.is.KDUmsatz" name="umsatzHome">
      
                <property name="entity-class">de.katharinad.kv.model.Umsatz</property>
      
                <property name="new-instance">#{newUmsatz}</property>
      
           </component>
      
      
           <component name="newUmsatz" 
      
                 class="de.katharinad.kv.model.Umsatz">
      
                 <property name="kunde" >#{kunde}</property>
      
                 <property name="tag">#{currentDate}</property>
      
          </component>
      
       


      For a more sophisticated setup i have to configure via extension.


      This works with EntityHome. But the very same Home object for HibernateEntityHome does not work. According to
      appframework homeobjects
      my Home object should look like this:


      @Name("umsatzHome")
      
      public class UmsatzHome extends KDUmsatz<Umsatz> {
      
      
           @In Date currentDate;
      
           @In (create = true)Kunde kunde;
      
           
      
           public void setUmsatzId(Long id) {
      
                setId(id);
      
           }
      
      
           public Long getUmsatzId() {
      
                return (Long) getId();
      
           }
      
      
           @Factory("umsatz")
      
           public Umsatz  initUmsatz(){return getInstance();}
      
           
      
           @Override
      
           protected Umsatz createInstance() {
      
                
      
                Umsatz umsatz = new Umsatz();
      
      // do setup...
      
                return umsatz;
      
           }
      
      
      
           public Umsatz getDefinedInstance() {
      
                return isIdDefined() ? getInstance() : null;
      
           }
      
      
      }
      
      



      KDUmsatz extends in this case HibernateEntityHome.


      But this will not work. I get an exception(duplicate method: createInstance see below)
      Searching the jira and the old forum has not revealed any clue what is going on. Is this a restriction for hibernateEntityHome and Seam 1.2.1?


      For my EntityHome based app(Seam 2.0.0) this is working.


      
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: umsatzHome
      
           at org.jboss.seam.Component.newInstance(Component.java:1740)
      
           at org.jboss.seam.Component.getInstance(Component.java:1643)
      
           at org.jboss.seam.Component.getInstance(Component.java:1610)
      
           at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1689)
      
           at org.jboss.seam.Component.getInstance(Component.java:1633)
      
           at org.jboss.seam.Component.getInstance(Component.java:1610)
      
           at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:53)
      
           at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
      
           at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
      
           at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:73)
      
           at com.sun.el.parser.AstValue.getValue(AstValue.java:114)
      
           at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:195)
      
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
      
           at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
      
           at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
      
           at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
      
           at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:69)
      
           at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:57)
      
           at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
      
           at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:442)
      
           at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:216)
      
           at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:98)
      
           at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
      
           at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286)
      
           at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
      
           at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
      
           at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
      
           at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
      
           at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
      
           at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:244)
      
           at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
      
           at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
      
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
      
           at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      
           at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
      
           at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
      
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
      
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
      
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
      
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
      
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      
           at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      
           at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      
           at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      
           at java.lang.Thread.run(Unknown Source)
      
      Caused by: java.lang.RuntimeException: duplicate method: createInstance
      
           at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:173)
      
           at org.jboss.seam.Component.createProxyFactory(Component.java:1979)
      
           at org.jboss.seam.Component.getProxyFactory(Component.java:1154)
      
           at org.jboss.seam.Component.wrap(Component.java:1145)
      
           at org.jboss.seam.Component.instantiateJavaBean(Component.java:1134)
      
           at org.jboss.seam.Component.instantiate(Component.java:1088)
      
           at org.jboss.seam.Component.newInstance(Component.java:1736)
      
           ... 66 more