4

我正在尝试使用 wicket 创建一个 Web 应用程序。这些是我遵循的步骤:

  1. 我使用以下命令创建了一个 Maven 项目:

    mvn archetype:generate -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=6.6.0 -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository= https://repository.apache.org/ - DinteractiveMode=false

  2. 我将项目导入eclipse

  3. 我通过右键单击启用了 Maven 依赖项
  4. 我将我的项目转换为 Web 项目并设置了 Tomcat 7 服务器
  5. 通过右键单击,我在此服务器上运行了项目,产生了以下消息:HTTP Status 404 - The requested resource is not available.

这是控制台上的错误消息:

SEVERE: Exception starting filter wicket.myproject
java.lang.ClassNotFoundException: org.apache.wicket.protocol.http.WicketFilter
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5309)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

现在这是我的 pom.xml :

http://maven.apache.org/maven-v4_0_0.xsd">4.0.0 com.amadeus RDA_2 战争 1.0-SNAPSHOT 快速入门

<licenses>
    <license>
        <name>The Apache Software License, Version 2.0</name>
        <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        <distribution>repo</distribution>
    </license>
</licenses>
<properties>
    <wicket.version>6.6.0</wicket.version>
    <jetty.version>7.6.3.v20120416</jetty.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <!--  WICKET DEPENDENCIES -->
    <!-- <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-core</artifactId>
        <version>${wicket.version}</version>
    </dependency>
    OPTIONAL DEPENDENCY
    <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-extensions</artifactId>
        <version>${wicket.version}</version>
    </dependency>
    -->

    <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-core</artifactId>
        <version>${wicket.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-extensions</artifactId>
        <version>${wicket.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.wicket</groupId>
        <artifactId>wicket-devutils</artifactId>
        <version>${wicket.version}</version>
    </dependency>


    <!-- LOGGING DEPENDENCIES - LOG4J -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.4</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>


    <!--  JUNIT DEPENDENCY FOR TESTING -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>

    <!--  JETTY DEPENDENCIES FOR TESTING  -->
    <dependency>
        <groupId>org.eclipse.jetty.aggregate</groupId>
        <artifactId>jetty-all-server</artifactId>
        <version>${jetty.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>wicket</groupId>
        <artifactId>wicket</artifactId>
        <version>1.2.7</version>
    </dependency>
</dependencies>
<build>
    <resources>
        <resource>
            <filtering>false</filtering>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <filtering>false</filtering>
            <directory>src/main/java</directory>
            <includes>
                <include>**</include>
            </includes>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
    <testResources>
        <testResource>
            <filtering>false</filtering>
            <directory>src/test/resources</directory>
        </testResource>
        <testResource>
            <filtering>false</filtering>
            <directory>src/test/java</directory>
            <includes>
                <include>**</include>
            </includes>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </testResource>
    </testResources>
    <plugins>
        <plugin>
            <inherited>true</inherited>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>UTF-8</encoding>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>${jetty.version}</version>
            <configuration>
                <connectors>
                    <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                        <port>8080</port>
                        <maxIdleTime>3600000</maxIdleTime>
                    </connector>
                    <connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
                        <port>8443</port>
                        <maxIdleTime>3600000</maxIdleTime>
                        <keystore>${project.build.directory}/test-classes/keystore</keystore>
                        <password>wicket</password>
                        <keyPassword>wicket</keyPassword>
                    </connector>
                </connectors>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <downloadSources>true</downloadSources>
            </configuration>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>Apache Nexus</id>
        <url>https://repository.apache.org/content/repositories/snapshots/</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>
</project>

这是我的 web.xml :

<filter>
    <filter-name>wicket.myproject</filter-name>
    <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
    <init-param>
        <param-name>applicationClassName</param-name>
        <param-value>com.mycompany.WicketApplication</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>wicket.myproject</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

任何人都可以帮助我吗????

4

2 回答 2

7

有点晚了,但这是解决问题的方法:

右键单击项目-> 属性-> 部署程序集

确保项目的库部署到 WEB-INF/lib 文件夹中。就我而言,根本没有库,所以我必须通过按来添加它们

添加 -> Java 构建路径条目

并选择图书馆(其中的检票口图书馆)

于 2014-05-29T16:44:04.303 回答
0

你改变你的POM了吗?此类属于wicket-core,快速入门添加了以下内容:

<dependency>
  <groupId>org.apache.wicket</groupId>
  <artifactId>wicket-core</artifactId>
  <version>6.6.0</version>
</dependency>

检查此声明是否在您的pom.xml.

于 2013-04-16T16:25:24.207 回答