You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Raul Raja Martinez <do...@estudiowebs.com> on 2005/12/05 07:51:47 UTC

rror invoking method setFactory on org.apache.tapestry.engine.state.StateObjectContribution@875ac3 ... java.lang.NoSuchMethodException,setFactory

I believe this could be a bug, in case it is, please let me know so that 
I can post it in the JIRA.

Thanks. Raul.


I'm trying to reference a service from a ApplicationState contribution 
and I find two weird behaviors.

1. If the service calls a class directly instead of an interface 
auto-wiring doesn't work and my service doesn't get injected my other 
EntityService.

2. If the service is in fact an Interface with its implementation, I get 
the following exception:

org.apache.hivemind.ApplicationRuntimeException
Error invoking method setFactory on 
org.apache.tapestry.engine.state.StateObjectContribution@875ac3 (at 
jar:file:/Users/dobleerre/Public/Laszlo/openlaszlo-3.0.2/Server/tomcat-5.0.24/webapps/com.estudiowebs.CMS/WEB-INF/lib/tapestry-4.0-beta-13.jar!/META-INF/tapestry.state.xml, 
line 76, column 47): setFactory
location: 
jar:file:/Users/dobleerre/Public/Laszlo/openlaszlo-3.0.2/Server/tomcat-5.0.24/webapps/com.estudiowebs.CMS/WEB-INF/lib/tapestry-4.0-beta-13.jar!/META-INF/tapestry.state.xml, 
line 76, column 47
71     The factory object that will create the state object as needed.
72     </attribute>
73
74     <rules>
75     <push-attribute attribute="object"/>
76     <invoke-parent method="setFactory"/>
77     </rules>
78
79     </element>
80     </element>
81     </schema>

java.lang.NoSuchMethodException
setFactory


Here is the code that I'm using:

hivemodule.xml
--------------------------------------------------------------------
<contribution configuration-id="tapestry.state.ApplicationObjects">
  <state-object name="globalMenu" scope="application">
   <invoke-factory object="service:CMS.GlobalMenu" />
  </state-object>
</contribution>

<service-point id="GlobalMenu" 
interface="com.estudiowebs.CMS.DAO.IGlobalMenu">
  <invoke-factory model="singleton">
   <construct class="com.estudiowebs.CMS.DAO.GlobalMenu"/>
  </invoke-factory>
</service-point>


GlobalMenu.java
--------------------------------------------------------------------
public class GlobalMenu extends Menu implements IGlobalMenu{

  private EntityService service;

  public void setService(EntityService service) {
   this.service = service;
  }

  public GlobalMenu() {
   Menu m = null;
   System.out.println("EntityService is " + service);
   m = (Menu) service.load(Menu.class, new Integer(1));
   System.out.println("Global menu constructed");
  }

}

MyComponent.jwc
--------------------------------------------------------------------
public abstract class MenuNavigation extends BaseComponent {

  @InjectState("globalMenu")
  public abstract IGlobalMenu getMenu();

  public Collection getCategories() {
   return getMenu().getCategories();
  }

}


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org