I am not the authority, but I just solved this error myself.

You cannot pass objects directly to tapestry in hivemind. In brief, have your DataContextService implement org.apache.tapestry.engine.state.StateObjectFactory and return an instance to itself. There is a page that I got some help on at http://wiki.apache.org/jakarta-tapestry/Tapestry+Spring+SSO+ASO that while not exactly what you need could help out.

HTH
Phillip

Mike Pestorich wrote:

I am trying to contribute an object to tapestry's ASOs with session scope and inject (or wire in) a Cayenne DataContext. I receive this error:

java.lang.NoSuchMethodException
setFactory
Stack Trace:
org.apache.hivemind.schema.rules.InvokeParentRule.findMethod(InvokeParentRule.java:127) org.apache.hivemind.schema.rules.InvokeParentRule.begin(InvokeParentRule.java:58)
org.apache.hivemind.impl.SchemaElement.fireBegin(SchemaElement.java:228)
org.apache.hivemind.impl.SchemaProcessorImpl.processElement(SchemaProcessorImpl.java:255) org.apache.hivemind.impl.SchemaProcessorImpl.processNestedElements(SchemaProcessorImpl.java:277) org.apache.hivemind.impl.SchemaProcessorImpl.processElement(SchemaProcessorImpl.java:257) org.apache.hivemind.impl.SchemaProcessorImpl.processRootElement(SchemaProcessorImpl.java:235)
...

I am new to hivemind and tapestry and I know that there are other ways of doing this (and actually have got it to work those other ways) but am trying to do things the way the tapestry and hivemind documentation preach. I have been stuck on this for a little while now and it seems to me that what I am trying to do should be working based on the documentation I have read. However, I just reviewed a previous post on this list from last December "Injecting registry services to POJOS" and it looks like this person had the same problem as me. From that post it looks like he eventually solved it using hiveutils. Before I add another jar to my project and head in a different direction, I would like to know what I am doing or where my thinking is wrong here.

===web.xml===

<web-app>
...
    <listener>
<listener-class>org.objectstyle.cayenne.conf.WebApplicationContextProvider</listener-class>
    </listener>
...
</web-app>

===DataContextService.java===

package com.pestorich.tapestry;

import org.objectstyle.cayenne.access.DataContext;

public interface DataContextService {

    public DataContext getDataContext();

}

===DataContextServiceImpl.java===

package com.pestorich.tapestry;

import org.objectstyle.cayenne.access.DataContext;

public class DataContextServiceImpl implements DataContextService {

    public DataContext getDataContext() {
        return DataContext.getThreadDataContext();
    }
}

===Session.java===

package com.pestorich.tapestry;

import java.io.Serializable;
import org.objectstyle.cayenne.access.DataContext;
import com.pestorich.tapestry.DataContextService;

public class Session implements Serializable {

    private static final long serialVersionUID = 1L;
    private DataContextService _dataContextService;

    public Session() {}

public void setDataContextService(DataContextService dataContextService) {
        _dataContextService = dataContextService;
    }

    public DataContext getContext() {
        return _dataContextService.getDataContext();
    }
}

===hivemodule.xml===

<module id="com.pestorich.tapestry" version="1.0.0">
    <service-point id="DataContextService">
        <invoke-factory>
            <construct class="DataContextServiceImpl" />
        </invoke-factory>
        <interceptor service-id="hivemind.LoggingInterceptor" />
    </service-point>
    <service-point id="Session">
        <invoke-factory>
            <construct class="Session" />
        </invoke-factory>
    </service-point>
    <contribution configuration-id="tapestry.state.ApplicationObjects">
        <state-object name="Session" scope="session">
            <invoke-factory object="service:Session" />
        </state-object>
    </contribution>
</module>


Thanks for any help or criticism in advance. It's all greatly appreciated :)

Mike



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to