ClassNotFoundException на TapestryFilter с архетипом Tynamo
Я создаю новый проект с tynamo-archetype, основанным на tynamo и Tapestry (давайте назовем это разделением), и я сталкиваюсь с проблемой при запуске Jetty для того, чтобы протестировать его.
Я создал идентификатор с mvn archetype:generate
по каталогу тынамо.
ошибка
[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>
Здесь полный пом
<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, но я впервые использую тинамо...
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