TapestryFilter上带有Tynamo原型的ClassNotFoundException

时间:2012-10-08 11:09:48

标签: maven jetty tapestry tynamo

我正在建立一个基于tynamo和Tapestry的tynamo-archetype的新项目(让我们称之为分区),我在运行jetty时遇到了一个问题,以便对其进行测试。

我在tynamo目录上使用mvn archetype:generate生成了id。

错误

[INFO] ------------------------------------------------------------------------
[INFO] Building division-t5-tynamo - My Tynamo project
[INFO]    task-segment: [jetty:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing jetty:run
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [jetty:run {execution: default-cli}]
[INFO] Configuring Jetty for project: division-t5-tynamo - My Tynamo project
[INFO] webAppSourceDirectory D:\ecommerce\workspaces\division\division-t5-tynamo\src\main\webapp does not exist. Defaulting to D:\ecommerce\workspaces\division\division-t5-
tynamo\src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = D:\ecommerce\workspaces\division\division-t5-tynamo\target\classes
[INFO] Context path = /
[INFO] Tmp directory = D:\ecommerce\workspaces\division\division-t5-tynamo\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:/D:/ecommerce/workspaces/division/division-t5-tynamo/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = D:\ecommerce\workspaces\division\division-t5-tynamo\src\main\webapp
2012-10-08 12:39:02.681:INFO:oejs.Server:jetty-7.6.0.v20120127
2012-10-08 12:39:02.915:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2012-10-08 12:39:03.087:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/D:/ecommerce/workspaces/division/division-t5-tynamo/src/main/webapp/},fil
e:/D:/ecommerce/workspaces/division/division-t5-tynamo/src/main/webapp/
2012-10-08 12:39:03.102:WARN:oejs.Holder:
java.lang.ClassNotFoundException: org.apache.tapestry5.TapestryFilter

的pom.xml

我唯一的定制是删除以下行...

<contextPath>/${project.artifactId}</contextPath>

这里是完整的pom

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>fr.company.division</groupId>
    <artifactId>division-t5-tynamo</artifactId>
    <packaging>war</packaging>
    <version>4.9.0-SNAPSHOT</version>
    <name>division-t5-tynamo - My Tynamo project</name>
    <url>http://tynamo.org/</url>

<!--  -->

    <properties>
        <tynamo-version>0.3.0</tynamo-version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <finalName>division-t5-tynamo</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.11</version>
                </plugin>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <optimize>true</optimize>
                </configuration>
            </plugin>

            <!-- Run the application using "mvn jetty:run" -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>7.6.0.v20120127</version>
                <configuration>
                    <contextPath>/${project.artifactId}</contextPath>
                    <systemProperties>
                        <systemProperty>
                            <name>tapestry.execution-mode</name>
                            <value>development</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>

            <!-- This changes the WAR file packaging so that what would normally go into WEB-INF/classes
                 is instead packaged as WEB-INF/lib/division-t5-tynamo.jar. This is necessary for Tapestry
                 to be able to search for page and component classes at startup. Only
                 certain application servers require this configuration, please see the documentation
                 at the Tapestry 5 project page (http://tapestry.apache.org/tapestry5/).
             -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1-beta-1</version>
                <configuration>
                    <archiveClasses>true</archiveClasses>
                </configuration>
            </plugin>

            <!-- This gets the plugin to clean up the cobertura.ser file left
        in the root directory. -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.2</version>
                <executions>
                    <execution>
                        <id>clean</id>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <!-- Adds a report detailing the components, mixins and base classes defined by this module. -->
        <plugins>
            <plugin>
                <groupId>org.apache.tapestry</groupId>
                <artifactId>tapestry-component-report</artifactId>
                <version>5.2.4</version>
                <configuration>
                    <rootPackage>fr.company.division</rootPackage>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.1.2</version>
                <configuration>
                    <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.12</version>
            </plugin>
        </plugins>
    </reporting>

    <dependencies>

        <dependency>
            <groupId>org.tynamo</groupId>
            <artifactId>tapestry-model-hibernate</artifactId>
            <version>${tynamo-version}</version>
        </dependency>

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

        <dependency>
            <groupId>org.tynamo</groupId>
            <artifactId>tapestry-model-web</artifactId>
            <version>${tynamo-version}</version>
        </dependency>

        <dependency>
            <groupId>org.tynamo</groupId>
            <artifactId>tapestry-routing</artifactId>
            <version>0.0.1</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.3.165</version>
        </dependency>

    </dependencies>

    <!--
    IMPORTANT NOTE:

    Configuring repositories is against Maven best practices. If you have
    a repository manager in use, remove this section and configure your
    repository manager to proxy these repositories instead.
    -->
    <repositories>
        <!-- Don't use snapshots unless absolutely necessary -->
        <repository>
            <id>codehaus-nexus-snapshots</id>
            <name>Codehaus Nexus Snapshots</name>
            <url>https://nexus.codehaus.org/content/groups/snapshots-group/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>

        <repository>
            <id>repository.jboss.org</id>
            <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

        <!--
            little hack to disable java.net repositories because they are not working
            and they corrupt your local repo.
        -->
        <repository>
            <id>maven-repository.dev.java.net</id>
            <url>https://maven-repository.dev.java.net/nonav/repository</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>java.net</id>
            <url>https://maven-repository.dev.java.net/nonav/repository</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

    </repositories>

</project>

Web.xml中

Tapestry过滤器在web.xml中声明得很好,而java包似乎与属性匹配:

    <?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>division-t5-tynamo</display-name>

        <context-param>
            <!-- The only significant configuration for Tapestry 5, this informs Tapestry
                of where to look for pages, components, mixins and entities. -->
            <param-name>tapestry.app-package</param-name>
            <param-value>fr.company.division</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>
                fr.company.division.services.DevelopmentModule
            </param-value>
        </context-param>
        <context-param>
            <param-name>tapestry.qa-modules</param-name>
            <param-value>
                fr.company.division.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>

        <welcome-file-list>
            <welcome-file>index</welcome-file>
        </welcome-file-list>

    </web-app>

我无法弄清楚问题是什么。这不是我的第一个Tapestry项目,但这是我第一次使用tynamo ......

1 个答案:

答案 0 :(得分:1)

一切看起来都不错。我已经尝试了完全相同的配置(groupId,artifactId和package),没有任何问题。唯一的区别是我在MacOSX上,看起来你正在使用MS Windows。 / contextPath 也不应该是个问题。 你可以尝试不同的码头版本吗? 也许使用与您已经使用的任何其他Tapestry项目相同的版本。 您可以尝试使用Tapestry在其原型中使用的6.1.16版本:https://svn.apache.org/repos/asf/tapestry/tapestry5/trunk/quickstart/filtered/archetype-resources/pom.xml