wicket异常启动过滤器检票口

时间:2013-04-16 16:16:01

标签: eclipse java-ee tomcat wicket

我正在尝试使用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 =假

  2. 我将项目导入了eclipse

  3. 我通过右键单击启用了Maven Dependancies
  4. 我将项目转换为Web项目并设置了Tomcat 7服务器
  5. 右键单击我在此服务器上运行项目,生成消息:HTTP Status 404 - The requested resource is not available.
  6. 这是控制台上的错误消息:

    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“&GT;     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>
    

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

2 个答案:

答案 0 :(得分:7)

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

右键点击项目 - &gt;属性 - &gt;部署程序集

确保将项目库部署到WEB-INF / lib文件夹中。在我的情况下,根本没有库,所以我必须按

添加它们

添加 - &gt; Java构建路径条目

选择库(其中的wicket库)

答案 1 :(得分:0)

你改变了你的POM吗?这个类属于wicket-core,快速入门添加了这个:

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

检查此声明是否在pom.xml