как исправить javax.servlet.ServletException: не удалось создать экземпляр класса WebApplicationInitializer - PullRequest
0 голосов
/ 26 июня 2019

Я пытался запустить весеннюю программу, но у меня были некоторые проблемы.

Я думаю, что это в моей pom.xml версии кода или что-то? Я продолжаю получать это.

Я уже пробовал несколько вещей, чтобы исправить это, но это не работает, и я все еще получаю ошибки. Пожалуйста, помогите мне, чтобы решить эту проблему.

Это мой pom.xml

<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.path</groupId>
    <artifactId>project</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>MyProject</name>

    <description>Web Application</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.0.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>

        <!--version -->
        <mybatis.generator.version>1.3.2</mybatis.generator.version>

        <start-class>com.path.path.App</start-class>

        <timestamp>${maven.build.timestamp}</timestamp>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <!-- exclude tomcat jdbc connection pool, use HikariCP -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- exclude tomcat-jdbc, Spring Boot will use HikariCP automatically  -->
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>2.7.8</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>

        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.3.0</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.2.2</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-core</artifactId>
            <version>${mybatis.generator.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.16</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.16</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.9.2</version>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity4</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-java8time</artifactId>
            <version>2.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>neo4j-cypher-compiler-2.1</artifactId>
            <version>2.1.8</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.9</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/fop -->
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>fop</artifactId>
            <version>2.2</version>
        </dependency>
        <dependency>
            <groupId>com.github.jai-imageio</groupId>
            <artifactId>jai-imageio-core</artifactId>
            <version>1.3.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/net.sf.barcode4j/barcode4j-fop-ext -->
        <dependency>
            <groupId>net.sf.barcode4j</groupId>
            <artifactId>barcode4j-fop-ext</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>1.14</version>
        </dependency>
        <dependency>
            <groupId>org.docx4j</groupId>
            <artifactId>docx4j</artifactId>
            <version>3.3.3</version>

            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
                <!--Joda Time-->
                <dependency>
                    <groupId>joda-time</groupId>
                    <artifactId>joda-time</artifactId>
                    <version>2.9</version>
                </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>com.github.cage</groupId>
            <artifactId>cage</artifactId>
            <version>1.0</version>
        </dependency>
     <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>5.1.5.RELEASE</version>
      <type>jar</type>
     </dependency>
    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>${mybatis.generator.version}</version>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>**/*.woff</exclude>
                    <exclude>**/*.ttf</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/*.woff</include>
                    <include>**/*.ttf</include>
                </includes>
            </resource>
        </resources>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>1.5.4.RELEASE</version>
                <configuration>
                    <jvmArguments>
                        -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
                    </jvmArguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.8</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>2.3</version>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>3.0.5</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>checkstyle</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>


</project>

Это сообщение об ошибке от tomcat:

javax.servlet.ServletException: не удалось создать экземпляр класса WebApplicationInitializer в org.springframework.web.SpringServletContainerInitializer.onStartup (SpringServletContainerInitializer.java:157) в org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5132) в org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:183) в org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:717) в org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:690) в org.apache.catalina.core.StandardHost.addChild (StandardHost.java:705) в org.apache.catalina.startup.HostConfig.deployDescriptor (HostConfig.java:631) в org.apache.catalina.startup.HostConfig.deployApps (HostConfig.java:487) в org.apache.catalina.startup.HostConfig.check (HostConfig.java:1642) at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) в java.lang.reflect.Method.invoke (Method.java:498) в org.apache.tomcat.util.modeler.BaseModelMBean.invoke (BaseModelMBean.java:289) в com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke (DefaultMBeanServerInterceptor.java:819) в com.sun.jmx.mbeanserver.JmxMBeanServer.invoke (JmxMBeanServer.java:801) в org.apache.catalina.manager.ManagerServlet.check (ManagerServlet.java:1590) в org.apache.catalina.manager.ManagerServlet.deploy (ManagerServlet.java:1019) в org.apache.catalina.manager.ManagerServlet.doGet (ManagerServlet.java:355) на javax.servlet.http.HttpServlet.service (HttpServlet.java:634) на javax.servlet.http.HttpServlet.service (HttpServlet.java:741) в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:231) в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) в org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:53) в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) в org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:202) в org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:96) в org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:607) в org.apache.catalina.valves.RequestFilterValve.process (RequestFilterValve.java:348) в org.apache.catalina.valves.RemoteAddrValve.invoke (RemoteAddrValve.java:53) в org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:139) в org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:92) в org.apache.catalina.valves.AbstractAccessLogValve.invoke (AbstractAccessLogValve.java:678) в org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:74) в org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:343) в org.apache.coyote.http11.Http11Processor.service (Http11Processor.java:408) в org.apache.coyote.AbstractProcessorLight.process (AbstractProcessorLight.java:66)в org.apache.coyote.AbstractProtocol $ ConnectionHandler.process (AbstractProtocol.java:853) в org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun (NioEndpoint.java:1587) в org.apache.tomcat.util.net.SocketProcessorBase.run (SocketProcessorBase.java:49) в java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149) в java.util.concurrent.ThreadPoolExecutor $ Worker.runec (24)org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread.java:61) в java.lang.Thread.run (Thread.java:748). Причина: java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.accessibleConstructor (Ljava / языки / Класс; [Ljava / языки / Класс;) Ljava / языки / отражения / Конструктор;в org.springframework.web.SpringServletContainerInitializer.onStartup (SpringServletContainerInitializer.java:154) ... еще 44

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...