spring mvc - springMVC-dubbo:The origin server did not find a current representation for the target resource or is not willing to disclose that one exists -
this springmvc-dubbo project started tomcat9 , jdk8.the problem index.jsp avialable,others 404 error.when delete index.jsp in web-info,i can access nothing.
<?xml version="1.0" encoding="utf-8"?> <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> <display-name>micro service example web application</display-name> <context-param> <!--contextconfiglocation--> <param-name>contextconfiglocation</param-name> <param-value> classpath:spring/spring-core.xml </param-value> </context-param> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet>org.springframework.web.servlet.dispatcherservlet</servlet- <init-param> <param-name>contextconfiglocation</param-name> <param-value>classpath:spring/spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <listener> <description>spring监听器</description> <org.springframework.web.context.contextloaderlistener</listener- </listener> </web-app>
spring-core.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:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans /spring-beans-3.2.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context /spring-context-3.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring- util-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/ default-autowire="byname" default-lazy-init="false"> <!-- service provider name --> <!-- zookeeper registry server address --> <dubbo:registry address="zookeeper://127.0.0.1:2181" /> <!-- set default protocol , listening port --> <dubbo:protocol name="dubbo" port="20887" /> <!-- enable monitoring feature --> <dubbo:monitor protocol="registry"/> <bean id="sparkservice" class="com.jd.dmse.provider.service.serviceimpl" <dubbo:service interface="com.jd.dmse.contract.sparkservice" ref="sparkservice" version="1.0.0" /> </beans>
spring-mvc.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.jd.dmse.provider.service"/> <bean hereclass="org.springframework.web.servlet.view. internalresourceviewresolver"> <property name="prefix"> <value>/web-inf/views/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> <!-- setting maximum uploaded file size 20mb. --> <bean id="multipartresolver" lass="org.springframework.web.multipart.commons. commonsmultipartresolver"> <property name="maxuploadsize" value="20971520" /> </bean> </beans>
this pom.xml
<project xmlns="http://maven.apache.org/pom/4.0.0" si="http://www.w3.org/2001/xmlschema-instance"i:schemalocation="http: /maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>dmse-provider</groupid> <artifactid>provider</artifactid> <packaging>war</packaging> <version>1.0-snapshot</version> <name>provider maven webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupid>dmse-contract</groupid> <artifactid>contract</artifactid> <version>1.0-snapshot</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>com.alibaba</groupid> <artifactid>dubbo</artifactid> <version>2.5.3</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-webmvc</artifactid> <version>3.1.1.release</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>3.1.1.release</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>javax.servlet-api</artifactid> <version>3.1.0</version> </dependency> <dependency> <groupid>javax.servlet.jsp</groupid> <artifactid>jsp-api</artifactid> <version>2.2</version> </dependency> <dependency> <groupid>com.github.sgroschupf</groupid> <artifactid>zkclient</artifactid> <version>0.1</version> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency> </dependencies> <build> <finalname>provider</finalname> </build> </project>
Comments
Post a Comment