Hi Pat,

We ran into a similar situation and found a workable (but not pretty) solution. 
First, you need to contribute to the ApplicationInitializers contribution point 
as described in this thread:

http://article.gmane.org/gmane.comp.java.tapestry.user/33013

But in this case you'll want to make sure your service is created after the 
ApplicationStateManager has been setup, so it should look something like this 
in hivemodule.xml:

<contribution configuration-id="tapestry.init.ApplicationInitializers">
        <command after="*" id="myInitializer" object="service:MyInitializer"/>
</contribution>

Then set the service you want to eager-load on "MyInitializer" and call 
something on it inside the initialize() method to ensure it gets created:

public void initialize(HttpServlet servlet)
{
        myEagerLoadedService.initializeMe();
}

Maybe someone else knows a better way, but this is the best I'm come up with to 
deal with the issue of eager loading services that need the infrastructure.

Ben

________________________________________
From: Patrick Moore [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 26, 2006 10:45 AM
To: users@tapestry.apache.org
Subject: Re: problems getting a session state object on start up (resend ..? )

Hi there --

I have a hivemind service that loads test data into my app. I use the EagerLoad 
feature of hivemind to trigger this dataload. However, I get this exception:

java.lang.IllegalStateException: The Infrastructure service has not yet been 
initialized. 
org.apache.tapestry.services
.impl.InfrastructureImpl.getProperty(InfrastructureImpl.java:292)
org.apache.tapestry.services.impl.InfrastructureImpl.getApplicationStateManager(InfrastructureImpl.java:116)
 
$Infrastructure_10de95366c1.getApplicationStateManager($Infrastructure_10de95366c1.java)
 
$Infrastructure_10de95366c0.getApplicationStateManager($Infrastructure_10de95366c0.java)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

The relevant hivemodule.xml snippet is:

    <service-point id="sessionFactory" 
interface="com.transparentpolitics.core.TransPolSessionManager">
        <invoke-factory>
            <construct class=" 
com.transparentpolitics.core.TransPolSessionManagerImpl" 
initialize-method="init">
                <set-object property="stateManager" 
value="infrastructure:applicationStateManager"/> 
                <set-service property="broadcastProviderManager" 
service-id="broadcastProviderManager"/>
            </construct>
        </invoke-factory>
    </service-point> 

( I have attached complete hivemodule.xml file)

In the hivemodule.xml file, does anyone know how to inject the stateObject 
itself directly without going through the applicationStateManager? I know how 
to do it on a tapestry component/page but not in hivemind.

-Pat Moore

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

Reply via email to