You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Xuqian Zhang <zx...@gmail.com> on 2013/10/02 04:24:55 UTC

[T5.3.7] Cannot start tapestry project as development mode in tomcat

Hi all! This is my first time to send mail to you, I hope you could receive
it. I was developing a simple management system using Tapestry 5.3.7. After
some time, I found the exception reporting didn't display detailed stack
trace, then I realized the development mode didn't open in the right way,
but it was normal before. Could you please tell me what was wrong? Here is
my relevant files:

*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">
<web-app>
    <display-name>bookstore Tapestry 5 Application</display-name>
    <context-param>
        <!-- The only significant configuration for Tapestry 5, this
informs Tapestry
of where to look for pages, components and mixins. -->
        <param-name>tapestry.app-package</param-name>
        <param-value>com.zxuqian.bookstore</param-value>
    </context-param>
    <!--
    Specify some additional Modules for two different execution
    modes: development and qa.
    Remember that the default execution mode is production
    -->
    <context-param>
        <param-name>tapestry.development-modules</param-name>
        <param-value>
            com.zxuqian.bookstore.services.DevelopmentModule
        </param-value>
    </context-param>
    <context-param>
        <param-name>tapestry.qa-modules</param-name>
        <param-value>
            com.zxuqian.bookstore.services.QaModule
        </param-value>
    </context-param>
    <filter>
        <filter-name>app</filter-name>
        <filter-class>org.apache.tapestry5.TapestryFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>app</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

*Pom.xml*
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.zxuqian</groupId>
    <artifactId>bookstore</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>bookstore Tapestry 5 Application</name>
        <dependencies>
        <!-- Too set up an application with a database, change the
artifactId below to
             tapestry-hibernate, and add a dependency on your JDBC driver.
You'll also
             need to add Hibernate configuration files, such as
hibernate.cfg.xml. -->
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-core</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>

        <!-- This adds automatic compression of JavaScript and CSS when in
production mode. -->
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-yuicompressor</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>

        <!-- Uncomment this to add support for file uploads:

         <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-upload</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>

        -->

        <!-- A dependency on either JUnit or TestNG is required, or the
surefire plugin (which runs the tests)
will fail, preventing Maven from packaging the WAR. Tapestry includes a
large number
of testing facilities designed for use with TestNG (http://testng.org/), so
it's recommended. -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng-release-version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>${easymock-release-version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-test</artifactId>
            <version>${tapestry-release-version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Provided by the servlet container, but sometimes referenced in
the application
       code. -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>${servlet-api-release-version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Provide dependency to the Tapestry javadoc taglet which
replaces the Maven component report -->
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-javadoc</artifactId>
            <version>${tapestry-release-version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Tapestry Hibernate -->
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-hibernate</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>

        <!-- Mysql Connector -->
        <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.26</version>
</dependency>
 <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>



    </dependencies>
    <build>
        <finalName>bookstore</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                    <optimize>true</optimize>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.7.2</version>
                <configuration>
                    <systemPropertyVariables>

<tapestry.execution-mode>Qa</tapestry.execution-mode>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <!-- Run the application using "mvn jetty:run" -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.16</version>
                <configuration>
                    <!-- Log to the console. -->
                    <requestLog
implementation="org.mortbay.jetty.NCSARequestLog">
                        <!-- This doesn't do anything for Jetty, but is a
workaround for a Maven bug
                             that prevents the requestLog from being set.
-->
                        <append>true</append>
                    </requestLog>
                    <systemProperties>
                        <systemProperty>
                            <name>tapestry.execution-mode</name>
                            <value>development</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting/>

    <repositories>

        <!-- This repository is only needed when the Tapestry version is a
preview release, rather
             than a final release. -->
        <repository>
            <id>apache-staging</id>
            <url>https://repository.apache.org/content/groups/staging/</url>
        </repository>
    </repositories>

    <properties>
        <tapestry-release-version>5.3.7</tapestry-release-version>
        <servlet-api-release-version>2.5</servlet-api-release-version>
        <testng-release-version>5.14.10</testng-release-version>
        <easymock-release-version>3.0</easymock-release-version>
    </properties>
</project>

DevelopmentModule.java
package com.zxuqian.bookstore.services;

import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.ioc.MappedConfiguration;

/**
 * This module is automatically included as part of the Tapestry IoC
Registry if <em>tapestry.execution-mode</em>
 * includes <code>development</code>.
 */
public class DevelopmentModule
{
    public static void contributeApplicationDefaults(
            MappedConfiguration<String, Object> configuration)
    {
        // The factory default is true but during the early stages of an
application
        // overriding to false is a good idea. In addition, this is often
overridden
        // on the command line as -Dtapestry.production-mode=false
        configuration.add(SymbolConstants.PRODUCTION_MODE, false);

        // The application version number is incorprated into URLs for some
        // assets. Web browsers will cache assets because of the far future
expires
        // header. If existing assets are changed, the version number
should also
        // change, to force the browser to download new versions.
        configuration.add(SymbolConstants.APPLICATION_VERSION,
"1.0.0-SNAPSHOT-DEV");
    }
}

*The output:*
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.ioc.services.TapestryIOCModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.hibernate.HibernateModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.hibernate.HibernateCoreModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.json.services.JSONModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.yuicompressor.services.YuiCompressorModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.services.TapestryModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.internal.services.InternalModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.services.assets.AssetsModule
[INFO] ioc.RegistryBuilder Adding module definition for class
org.apache.tapestry5.services.pageload.PageLoadModule
[INFO] ioc.RegistryBuilder Adding module definition for class
com.zxuqian.bookstore.services.AppModule


 ______                  __             ____
/_  __/__ ____  ___ ___ / /_______ __  / __/
 / / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \
/_/  \_,_/ .__/\__/___/\__/_/  \_, / /____/
        /_/                   /___/  5.3.7



In addition, I ran it in tomcat 7.0.27. I found a temporary solution for
this, I added a @SubModule annotation on AppModule, and it seemed that
tapestry could start in development mode..It's weird. Still need your help!

Re: [T5.3.7] Cannot start tapestry project as development mode in tomcat

Posted by Xuqian Zhang <zx...@gmail.com>.
Thank you Thiago H de Paula Figueiredo! I found the solution in
http://tapestry.apache.org/loading-the-project-into-eclipse.html, it says:
> Tapestry runs best with a couple of additional options; click the
"Arguments" tab and enter the following VM Arguments: -XX:MaxPermSize=256M
-Xmx600m -Dtapestry.execution-mode=development
I just followed this step, and it became normal again! Thank you anyway!


2013/10/2 Thiago H de Paula Figueiredo <th...@gmail.com>

> Hi!
>
> I guess you're missing setting the tapestry.execution-mode symbol. In your
> web.xml, that would be:
>
> <context-param>
>     <param-name>tapestry.**execution-mode</param-name>
>     <param-value>development</**param-value>
> </context-param>
>
>
>  In addition, I ran it in tomcat 7.0.27. I found a temporary solution for
>> this, I added a @SubModule annotation on AppModule, and it seemed that
>> tapestry could start in development mode..It's weird. Still need your
>> help!
>>
>
> Actually, with @Submodule, it seems that the application started in
> production mode, which is the default, but the DevelopmentModule was only
> loaded because you did it explicitly through @Submodule
>
> --
> Thiago H. de Paula Figueiredo
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: [T5.3.7] Cannot start tapestry project as development mode in tomcat

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
Hi!

I guess you're missing setting the tapestry.execution-mode symbol. In your  
web.xml, that would be:

<context-param>
     <param-name>tapestry.execution-mode</param-name>
     <param-value>development</param-value>
</context-param>

> In addition, I ran it in tomcat 7.0.27. I found a temporary solution for
> this, I added a @SubModule annotation on AppModule, and it seemed that
> tapestry could start in development mode..It's weird. Still need your  
> help!

Actually, with @Submodule, it seems that the application started in  
production mode, which is the default, but the DevelopmentModule was only  
loaded because you did it explicitly through @Submodule

-- 
Thiago H. de Paula Figueiredo

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