简体   繁体   English

INFO:在tomcat 8的类路径上未检测到Spring WebApplicationInitializer类型

[英]INFO: No Spring WebApplicationInitializer types detected on classpath on tomcat 8

I am trying to deploy a java web application on the tomcat 8. The war is built on jdk 1.8 When I see the catalina.log I see that the application is deployed and the server is started successfully. 我正在尝试在tomcat 8上部署Java Web应用程序。战争是基于jdk 1.8构建的。当我看到catalina.log时,看到该应用程序已部署并且服务器已成功启动。 But in the localhost.log I see the message 14-Dec-2015 12:10:42.774 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath 但是在localhost.log中我看到消息14-Dec-2015 12:10:42.774 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log在类路径上未检测到Spring WebApplicationInitializer类型

Moreover I am not able to launch the welcome page when I hit the app url. 此外,当我点击应用程序网址时,我无法启动欢迎页面。 No other error in the logs. 日志中没有其他错误。 Can somebody please let me know if I am missing anything. 如果我想念什么,请让我知道。

Thanks Arpit 谢谢Arpit

I got a silly error it took me an embarrassingly long to solve.... Check out my pom.xml ... 我遇到了一个愚蠢的错误,这使我尴尬地解决了很长时间。...查看我的pom.xml ...

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0

<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>

Problem was my package name. 问题是我的包裹名称。 After checking: 经过检查:

a) Runtime package name in the IDE (Netbeans for me) to see if my runtime source was 1.8kjdk against the POM a)IDE中的运行时程序包名称(对我来说是Netbeans),以查看我的运行时源是否针对POM为1.8kjdk

b) Double checked the POM (pom.xml) to ensure it has the Javax servlet config for annotations (3.0+) and Spring dependencies b)仔细检查POM(pom.xml),以确保它具有Javax Servlet配置的注解(3.0+)和Spring依赖项

c) Double checked my WebInitializer.java (implements WebApplicationInitializer (instead of web.xml)) was syntaxically correct c)仔细检查我的WebInitializer.java(实现WebApplicationInitializer(而不是web.xml))在语法上是正确的

d) Double checked my Config.java file to ensure it was correctly overloading addResourceHandlers(ResourceHandlerRegistry registry) and the bean for setupViewResolver() was correct d)仔细检查我的Config.java文件,以确保它正确地重载了​​addResourceHandlers(ResourceHandlerRegistry注册表),并且setupViewResolver()的bean是正确的

e) Double checked my folder structure to ensure it was correct and the programatic flow looked coherent e)仔细检查我的文件夹结构,以确保它正确且程序流看起来一致

f) Remove and redeployed Glassfish to see if anything would change f)移走并重新部署Glassfish,以查看是否有任何变化

then I found my issue which was: 然后我发现我的问题是:

f) "com.trainer.config" is wrong! f)“ com.trainer.config”是错误的! It MUST be "com.outbottle" (then config/controllers/model/etc) for it to work. 它必须是“ com.outbottle”(然后是config / controllers / model / etc)才能起作用。 As you can see above, I used Maven (for the first time), Spring, 1.8 JDK and nearly had a stroke debugging this issue. 正如您在上面看到的,我第一次使用Maven,Spring,1.8 JDK,并且几乎调试了此问题。 All running on Glassfish (Tomcat is ok too for the above pom config). 全部在Glassfish上运行(对于上述pom配置,Tomcat也可以)。 That said, I'm all happy with myself now and know Maven and Spring much better for the next step of my Spring learning curve. 就是说,我现在对自己感到很高兴,并且对Maven和Spring更好地了解了Spring学习曲线的下一步。 Hoping this helps you also! 希望这对您也有帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 信息:没有在类路径上检测到Spring WebApplicationInitializer类型 - INFO: No Spring WebApplicationInitializer types detected on classpath INFO:在类路径(jre 1.8)上未检测到Spring WebApplicationInitializer类型 - INFO: No Spring WebApplicationInitializer types detected on classpath (jre 1.8) Jboss在类路径上未检测到Spring WebApplicationInitializer类型 - Jboss No Spring WebApplicationInitializer types detected on classpath 展开战争:在类路径上未检测到Spring WebApplicationInitializer类型 - Deploying war: No Spring WebApplicationInitializer types detected on classpath 在Docker中将Java War部署到Tomcat中,错误在类路径上未检测到Spring WebApplicationInitializer类型 - Deploying Java War to Tomcat in Docker, error No Spring WebApplicationInitializer types detected on classpath Glassfish 4共享库Spring在类路径上未检测到Spring WebApplicationInitializer类型 - Glassfish 4 shared library Spring No Spring WebApplicationInitializer types detected on classpath 只有一个错误:没有在类路径上检测到Spring WebApplicationInitializer类型 - only one error: No Spring WebApplicationInitializer types detected on classpath 当我使quarkus适应一个简单的spring boot项目时,“在classpath上没有检测到Spring WebApplicationInitializer类型”? - “No Spring WebApplicationInitializer types detected on classpath” when I adapt quarkus to a simple spring boot project? Spring WebApplicationInitializer - Spring WebApplicationInitializer Springboot-&gt; Springboot 2:在类路径上检测到2个Spring WebApplicationInitializers - Springboot -> Springboot 2: 2 Spring WebApplicationInitializers detected on classpath
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM