newbie with Quick Start > Tapestry Tutorial

From: Michael Mangus (mdmangu..mail.com)
Date: Thu Feb 10 2005 - 16:39:52 EST

  • Next message: Andrus Adamchik: "Re: 'java.lang.OutOfMemory' and 'Bad File descriptor'"

    Hi,

    I am having problems with the Quick Start Tapestry Tutorial that is included
    with the Cayenne installation.

    The application loads with the option to click [ view artists ] - [ view
    galleries ].

    When clicking on any of the links it throws an exception:
    Unable to instantiate visit object from class
    cayenne.tutorial.tapestry.Visit.

    It also shows an unlabledMessage:
    [org.objectstyle.cayenne.conf.DefaultConfiguration] : Domain configuration
    file "cayenne.xml" is not found.

    My setup:
    Eclipse 3.1M4, Spindle 3.1.15, Tapestry 3.0.1, Jetty Launcher 1.2.1, and
    JDK1.5.

    I loaded the canyenne.xml into CayenneModeler and successfully Generated
    Database Schema into MS SQL Server from the dataMap. I than loaded the data
    from the provided tutorialdb.sql.

    The MS SQL Database has "ARTIST", "AUTO_PK_SUPPORT", "GALLERY", and
    "PAINTING" generated from Cayenne.

    I created a new Eclipse project "ArtistApp".
    Java Build Path: cayenne.jar, servlet-api.jar, jre1.5.0_01, Tapestry
    Framework

    Src:
       cayenne.tutorial.tapestry > ArtistAppServlet.java, Visit.java
       cayenne.tutorial.tapestry.domain > Artist.java, Gallery.java,
    Painting.java
       cayenne.tutorial.tapestry.domain.auto > _Artist.java, _Gallery.java,
    _Painting.java
       cayenne.tutorial.tapestry.pages:
            AddArtistPage.java, AddGalleryPage.java, AddPainting.java,
    ApplicationPage.java,
            BrowseArtistsPage.java, BrowseGalleriesPage.java,
    ChooseGalleryPage.java,
            EditorPage.java

    Context:
       images > ...
       WEB-INF:
            components > PageWrapper.html, PageWrapper.jwc
            pages > AddArtistPage.html, AddArtistPage.page, ... etc
            ArtistApp.application
            cayenne.xml
            datamap.map.xml
            datanode.driver.xml
            web.xml
       styles.css

    The project compiles all the classes and starts the servlet app inside Jetty
    from Eclipse. I don't understand why it says it can't find cayenne.xml when
    it is provided in the WEB-INF, unless this file is suppose to go somewhere
    else?

    ArtistApp.application:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application PUBLIC
      "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
      "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

    <application name="Artist Web App">
      <property
    name="org.apache.tapestry.visit-class">cayenne.tutorial.tapestry.Visit</prop
    erty>

      <page name="Home" specification-path="pages/Home.page"/>
      <!-- page name="Main"
    specification-path="cayenne/tutorial/tapestry/pages/Main.page"/-->
      <page name="BrowseArtistsPage"
    specification-path="pages/BrowseArtistsPage.page"/>
      <page name="BrowseGalleriesPage"
    specification-path="pages/BrowseGalleriesPage.page"/>
      <page name="AddArtistPage" specification-path="pages/AddArtistPage.page"/>
      <page name="AddGalleryPage"
    specification-path="pages/AddGalleryPage.page"/>
      <page name="AddPaintingPage"
    specification-path="pages/AddPaintingPage.page"/>
      <page name="ChooseGalleryPage"
    specification-path="pages/ChooseGalleryPage.page"/>
      
      <component-type type="PageWrapper"
    specification-path="components/PageWrapper.jwc"/>
    </application>

    web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app
          PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          "http://java.sun.com/dtd/web-app_2_3.dtd">
    <!-- generated by Spindle, http://spindle.sourceforge.net -->

    <web-app>
        <display-name>ArtistApp</display-name>
        <filter>
            <filter-name>redirect</filter-name>
            <filter-class>org.apache.tapestry.RedirectFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>redirect</filter-name>
            <url-pattern>/</url-pattern>
        </filter-mapping>
        <servlet>
            <servlet-name>ArtistApp</servlet-name>
     
    <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>ArtistApp</servlet-name>
            <url-pattern>/app</url-pattern>
        </servlet-mapping>
    </web-app>

    cayenne.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <domains project-version="1.1">
    <domain name="DefaultDomain">
            <map name="datamap" location="datamap.map.xml"/>

            <node name="datanode"
                     datasource="datanode.driver.xml"
            
    adapter="org.objectstyle.cayenne.dba.sqlserver.SQLServerAdapter"
            
    factory="org.objectstyle.cayenne.conf.DriverDataSourceFactory">
                            <map-ref name="datamap"/>
             </node>
    </domain>
    </domains>

    datamap.map.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <data-map project-version="1.1">
            <property name="defaultPackage"
    value="cayenne.tutorial.tapestry.domain"/>
            <db-entity name="ARTIST">
                    <db-attribute name="ARTIST_ID" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="11"/>
                    <db-attribute name="ARTIST_NAME" type="CHAR"
    isMandatory="true" length="254"/>
                    <db-attribute name="DATE_OF_BIRTH" type="DATE" length="8"/>
            </db-entity>
            <db-entity name="GALLERY">
                    <db-attribute name="GALLERY_ID" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="11"/>
                    <db-attribute name="GALLERY_NAME" type="VARCHAR"
    isMandatory="true" length="100"/>
            </db-entity>
            <db-entity name="PAINTING">
                    <db-attribute name="ARTIST_ID" type="INTEGER" length="11"/>
                    <db-attribute name="ESTIMATED_PRICE" type="DECIMAL"
    length="10"/>
                    <db-attribute name="GALLERY_ID" type="INTEGER" length="11"/>
                    <db-attribute name="PAINTING_ID" type="INTEGER"
    isPrimaryKey="true" isMandatory="true" length="11"/>
                    <db-attribute name="PAINTING_TITLE" type="VARCHAR"
    isMandatory="true" length="255"/>
            </db-entity>
            <obj-entity name="Artist"
    className="cayenne.tutorial.tapestry.domain.Artist" dbEntityName="ARTIST">
                    <obj-attribute name="artistName" type="java.lang.String"
    db-attribute-path="ARTIST_NAME"/>
                    <obj-attribute name="dateOfBirth" type="java.util.Date"
    db-attribute-path="DATE_OF_BIRTH"/>
            </obj-entity>
            <obj-entity name="Gallery"
    className="cayenne.tutorial.tapestry.domain.Gallery" dbEntityName="GALLERY">
                    <obj-attribute name="galleryName" type="java.lang.String"
    db-attribute-path="GALLERY_NAME"/>
            </obj-entity>
            <obj-entity name="Painting"
    className="cayenne.tutorial.tapestry.domain.Painting"
    dbEntityName="PAINTING">
                    <obj-attribute name="estimatedPrice"
    type="java.math.BigDecimal" db-attribute-path="ESTIMATED_PRICE"/>
                    <obj-attribute name="paintingTitle" type="java.lang.String"
    db-attribute-path="PAINTING_TITLE"/>
            </obj-entity>
            <db-relationship name="paintingArray" source="ARTIST"
    target="PAINTING" toMany="true">
                    <db-attribute-pair source="ARTIST_ID" target="ARTIST_ID"/>
            </db-relationship>
            <db-relationship name="paintingArray" source="GALLERY"
    target="PAINTING" toMany="true">
                    <db-attribute-pair source="GALLERY_ID" target="GALLERY_ID"/>
            </db-relationship>
            <db-relationship name="toArtist" source="PAINTING" target="ARTIST"
    toMany="false">
                    <db-attribute-pair source="ARTIST_ID" target="ARTIST_ID"/>
            </db-relationship>
            <db-relationship name="toGallery" source="PAINTING" target="GALLERY"
    toMany="false">
                    <db-attribute-pair source="GALLERY_ID" target="GALLERY_ID"/>
            </db-relationship>
            <obj-relationship name="paintingArray" source="Artist"
    target="Painting" db-relationship-path="paintingArray"/>
            <obj-relationship name="paintingArray" source="Gallery"
    target="Painting" db-relationship-path="paintingArray"/>
            <obj-relationship name="toArtist" source="Painting" target="Artist"
    db-relationship-path="toArtist"/>
            <obj-relationship name="toGallery" source="Painting"
    target="Gallery" db-relationship-path="toGallery"/>
    </data-map>

    Datanode.driver.xml:
    <?xml version="1.0" encoding="utf-8"?>
    <driver project-version="1.1">
            <connectionPool min="1" max="1" />
    </driver>



    This archive was generated by hypermail 2.0.0 : Thu Feb 10 2005 - 16:40:32 EST