执行简单的SPRING MVC示例时发生异常严重:无法销毁与ProtocolHandler相关的端点

时间:2018-08-20 04:31:41

标签: java spring maven spring-mvc

以下堆栈跟踪是我尝试运行Web应用程序时得到的。

SEVERE: Failed to destroy end point associated with ProtocolHandler ["http- 
nio-8086"]
java.lang.NullPointerException
at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:315)
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:491)
at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:896)
at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551)
at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.startup.Catalina.start(Catalina.java:645)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483)

Aug 20, 2018 9:45:01 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-nio-8015"]
Aug 20, 2018 9:45:01 AM org.apache.coyote.AbstractProtocol destroy
SEVERE: Failed to destroy end point associated with ProtocolHandler ["ajp- 
nio-8015"]
java.lang.NullPointerException
at 
org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:315)
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:491)
at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:896)
at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:551)
at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:589)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:879)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:292)
at org.apache.catalina.startup.Catalina.start(Catalina.java:645)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:349)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:483)

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" 
    version="3.0">

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <servlet>
        <servlet-name>spring</servlet-name>
        <servlet- class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>
</web-app>

spring-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>  
<beans 
    xmlns="http://www.springframework.org/schema/beans"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xmlns:p="http://www.springframework.org/schema/p"  
    xmlns:context="http://www.springframework.org/schema/context"  
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
    http://www.springframework.org/schema/context  
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">  

    <context:component-scan base-package="com.javatpoint"></context:component-scan>
    <bean 
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">

        <property name="prefix" value="/WEB-INF/jsp/"></property>
        <property name="suffix" value=".jsp"></property>
    </bean>

</beans>

HelloWorldController

package com.javatpoint;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloWorldController {

    @RequestMapping("/hello")
    public ModelAndView handleRequestInternal(HttpServletRequest request,
        HttpServletResponse response) throws Exception{


        String message="Hello Spring MVC how r u";
        return new ModelAndView("hellopage","message",message);
    }
}

hellopage.jsp

Message: ${message}

我已经在/ WebRoot / lib中添加了Spring jar,并将其包含在project属性中。 我添加的罐子是

spring-aop-4.1.4.RELEASE.jar

spring-aspects-4.1.4.RELEASE.jar

spring-beans-4.1.4.RELEASE.jar

spring-context-4.1.4.RELEASE.jar

spring-context-support-4.1.4.RELEASE.jar

spring-core-4.1.4.RELEASE.jar

spring-expression-4.1.4.RELEASE.jar

spring-instrument-4.1.4.RELEASE.jar

spring-instrument-tomcat-4.1.4.RELEASE.jar

spring-jdbc-4.1.4.RELEASE.jar

spring-jms-4.1.4.RELEASE.jar

spring-messaging-4.1.4.RELEASE.jar

spring-orm-4.1.4.RELEASE.jar

spring-oxm-4.1.4.RELEASE.jar

spring-test-4.1.4.RELEASE.jar

spring-tx-4.1.4.RELEASE.jar

spring-web-4.1.4.RELEASE.jar

spring-webmvc-4.1.4.RELEASE.jar

spring-webmvc-portlet-4.1.4.RELEASE.jar

spring-websocket-4.1.4.RELEASE.jar

任何帮助将不胜感激,请不要标出我的问题,因为我找不到解决问题的任何相关解决方案。

0 个答案:

没有答案