无类路径检测春WebApplicationInitializer类型(No Spring WebAp

2019-09-01 15:39发布

我的Eclipse项目突然不再部署正确。 我不能跟踪到我已经对环境做出任何特别的变化。

我曾与多个源控制项目的测试,它们都表现了同样的方式:

May 01, 2013 12:00:45 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in     production environments was not found on the java.library.path: C:\Program Files   (x86)\Java\jdk1.7.0_11\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA     Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows \System32\WindowsPowerShell\v1.0\;.
May 01, 2013 12:00:45 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:fismacm' did not find a matching property.
May 01, 2013 12:00:45 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
May 01, 2013 12:00:45 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 01, 2013 12:00:45 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 296 ms
May 01, 2013 12:00:45 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 01, 2013 12:00:45 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.35
May 01, 2013 12:00:46 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://www.springframework.org/tags/form is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://www.springframework.org/tags is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://www.springframework.org/security/tags is already defined
May 01, 2013 12:00:48 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 01, 2013 12:00:48 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 01, 2013 12:00:48 PM org.apache.catalina.core.ApplicationContext log
INFO: Set web app root system property: 'webapp.root' =     [X:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\fismacm\]
May 01, 2013 12:00:48 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing log4j from [X:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\fismacm\WEB-    INF\log4j.properties]
May 01, 2013 12:00:48 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
May 01, 2013 12:00:49 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 01, 2013 12:00:49 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 01, 2013 12:00:49 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3898 ms

这似乎是一个关键组成部分:信息:在类路径中没有检测到春天WebApplicationInitializer类型。

我试着清理项目,重新定义了服务器,甚至创造全新的工作空间。 我已经清楚地错过了标记。

在得到这个清理任何提示将不胜感激。

Answer 1:

我花了这个时间,而解决办法是:

  • 停止Tomcat
  • “项目”菜单 - >清理 - >清除所有项目
  • 服务器选项卡 - > Tomcat的 - >右键 - >干净。
  • 右键单击项目 - >运行方式 - >在服务器上运行


Answer 2:

事实证明,这是一个愚蠢的错误。 我的log4j没有配置来捕捉我的错误输出。 我被扔配置错误在后台,一旦我固定的我好去和我的请求映射工作的罚款。



Answer 3:

当心,如果你正在使用Maven。 您的文件夹的结构必须是正确的。

当使用Maven,在WEB-INF目录必须是内部的webapp:

src/main/webapp/WEB-INF


Answer 4:

INFO:无弹簧WebApplicationInitializer类型的类路径检测。

也可以显示出来,如果你使用Maven与Eclipse和部署使用你的战争;

(Eclipse中,开普勒,与M2)

(在你的项目上单击右键) - >运行方式- >服务器上运行

这是下到M2E-WTP文件夹和内容的生成和删除。

确保,build目录下的Maven存档生成的文件进行检查。

在 “窗口 - >首选项 - >的Maven - > Java EE的集成”

然后:

使用M2,做你的构建,即通常的清洁 - >包或安装等...

如果“项目 - >自动构建”没有被选中。 您可以强制通过执行“M2E-WTP文件夹和内容”的产生;

“(在你的项目上单击右键) - > Maven的- >更新项目......”

注意:确保“清洁工程”选项取消选中。 否则,目标/类的内容将被删除,你又回到了起点。

此外,当;

项目- >自动构建 ”选择“M2E-WTP文件夹和内容”被生成

或“ 项目- >生成所有

“(项目上单击鼠标右键) - >构建项目



Answer 5:

WebApplicationInitializer是你可以在你的一个类实现一个接口。 在启动春季是扫描这个班,只要您使用Servlet规范3,有一个元数据的完整=“假”在web.xml属性。 但是,这似乎并不成为问题。 我可以找出唯一的错误是缺少SLF4J-log4j12.jar。



Answer 6:

我也有同样的问题。 我的行家有tomcat7插件,但在JRE环境为1.6。 我改变了我的tomcat7到的Tomcat6和错误不见了。



Answer 7:

XML是不是在WEB-INF文件夹,这就是为什么我在收到此错误,请确保web.xml和XXX-servlet.xml中是WEB_INF文件夹内,而不是在Web应用程序文件夹中。



Answer 8:

我得到了我花了一个令人尴尬的长期解决....看看我的pom.xml一个愚蠢的错误...

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.outbottle</groupId>
<artifactId>PersonalDetailsMVC</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>PersonalDetailsMVC</name>

<properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <spring.version>4.0.1.RELEASE</spring.version>
    <jstl.version>1.2</jstl.version>
    <javax.servlet.version>3.0.1</javax.servlet.version>
</properties>

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>${javax.servlet.version}</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>${jstl.version}</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <compilerArguments>
                    <endorseddirs>${endorsed.dir}</endorseddirs>
                </compilerArguments>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${endorsed.dir}</outputDirectory>
                        <silent>true</silent>
                        <artifactItems>
                            <artifactItem>
                                <groupId>javax</groupId>
                                <artifactId>javaee-endorsed-api</artifactId>
                                <version>7.0</version>
                                <type>jar</type>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

问题是我的包名。 它必须是“com.outbottle”(当时配置/控制器/模型/等)为它工作。 正如你可以在上面看到,我使用的Maven(首次),春,1.8 JDK和近患了中风调试这个问题。 所有Glassfish上运行(Tomcat是也没关系了上述POM的配置)。 这就是说,现在我所有的快乐与自己,知道Maven和春季多的我的春节,学习曲线的下一步更好。 希望这可以帮助你也!



Answer 9:

STS有其工作区下的元数据文件夹。 你会看到在.log文件实际的错误在C:\用户\ firstname.lastname \文件\ workspace下,STS-3.9.2.RELEASE.metadata



文章来源: No Spring WebApplicationInitializer types detected on classpath