You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by James Carroll <ji...@microbrightfield.com> on 2003/09/24 20:11:14 UTC

Global class not instantiated???

Hi I'm using 3.0b3, and have the following application:

<application
  name="MicroBrightField Databases"
  engine-class="org.apache.tapestry.engine.SimpleEngine"
  org.apache.tapestry.global-class="tt.GlobalResources"
  >

  <page name="Home" specification-path="/tt/Home.page"/>
  <page name="RMAs" specification-path="/tt/RMAs.page"/>

  <component-alias type="Border" specification-path="/Border.jwc"/>

</application>


I do a getGlobal() and cast it to a GlobalResources in my code
and get a ClassCastException.  Am I specifiying the global class
correctly?

My global class is going to hold my Hibernate Session Factory.
Is this the best place for it?  I was thinking of subclassing
SimpleEngine and having it there too.

Thanks,
-Jim

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


Re: Global class not instantiated???

Posted by Colin Sampaleanu <co...@exis.com>.
James Carroll wrote:

>Hi I'm using 3.0b3, and have the following application:
>
><application
>  name="MicroBrightField Databases"
>  engine-class="org.apache.tapestry.engine.SimpleEngine"
>  org.apache.tapestry.global-class="tt.GlobalResources"
>  >
>
>  <page name="Home" specification-path="/tt/Home.page"/>
>  <page name="RMAs" specification-path="/tt/RMAs.page"/>
>
>  <component-alias type="Border" specification-path="/Border.jwc"/>
>
></application>
>
>
>I do a getGlobal() and cast it to a GlobalResources in my code
>and get a ClassCastException.  Am I specifiying the global class
>correctly?
>
>My global class is going to hold my Hibernate Session Factory.
>Is this the best place for it?  I was thinking of subclassing
>SimpleEngine and having it there too.
>  
>
Jim,

If you are using Hibernate and Tapestry, you might want to look at this 
article I wrote on integrating Tapestry and Spring Framework. I would 
highly recommend using Hibernate and Spring Framework together, as the 
Hibernate integration and utility code in Spring reduces your work a 
lot. In the Tapestry+Hibernate+Spring Framework scenario, your session 
factory would come out of a Spring Application Context.
  http://www.springframework.org/docs/integration/tapestry.html
  http://hibernate.bluemars.net/110.html

Regards,
Colin



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


Re: Global class not instantiated???

Posted by Harish Krishnaswamy <hk...@comcast.net>.
And Global is the right place for the session factory and other 
application wide resources, as far as I know.

-Harish

James Carroll wrote:

>Hi I'm using 3.0b3, and have the following application:
>
><application
>  name="MicroBrightField Databases"
>  engine-class="org.apache.tapestry.engine.SimpleEngine"
>  org.apache.tapestry.global-class="tt.GlobalResources"
>  >
>
>  <page name="Home" specification-path="/tt/Home.page"/>
>  <page name="RMAs" specification-path="/tt/RMAs.page"/>
>
>  <component-alias type="Border" specification-path="/Border.jwc"/>
>
></application>
>
>
>I do a getGlobal() and cast it to a GlobalResources in my code
>and get a ClassCastException.  Am I specifiying the global class
>correctly?
>
>My global class is going to hold my Hibernate Session Factory.
>Is this the best place for it?  I was thinking of subclassing
>SimpleEngine and having it there too.
>
>Thanks,
>-Jim
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


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


Re: Global class not instantiated???

Posted by Harish Krishnaswamy <hk...@comcast.net>.
Global is a property of the engine and so is specified via a 
<property...> element like...

    <property name="org.apache.tapestry.global-class"
        value="tt.GlobalResources"/>

-Harish

James Carroll wrote:

>Hi I'm using 3.0b3, and have the following application:
>
><application
>  name="MicroBrightField Databases"
>  engine-class="org.apache.tapestry.engine.SimpleEngine"
>  org.apache.tapestry.global-class="tt.GlobalResources"
>  >
>
>  <page name="Home" specification-path="/tt/Home.page"/>
>  <page name="RMAs" specification-path="/tt/RMAs.page"/>
>
>  <component-alias type="Border" specification-path="/Border.jwc"/>
>
></application>
>
>
>I do a getGlobal() and cast it to a GlobalResources in my code
>and get a ClassCastException.  Am I specifiying the global class
>correctly?
>
>My global class is going to hold my Hibernate Session Factory.
>Is this the best place for it?  I was thinking of subclassing
>SimpleEngine and having it there too.
>
>Thanks,
>-Jim
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


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