【发布时间】:2015-11-06 13:29:58
【问题描述】:
我们正在考虑将我们的应用程序升级到 Weblogic 12.2.1。服务器正常启动。但是我们无法调用任何网络服务。它们是使用 Spring 编写的。我们也在使用 JDK 8。
日志中出现的错误消息是:
org.springframework.web.servlet.PageNotFound 在名称为“dispatcher”的 DispatcherServlet [noHandlerFound:1120 {}] 中找不到具有 URI [/test/components] 的 HTTP 请求的映射
仅当我们使用安装程序安装应用程序时才会出现问题。 当我们在开发环境中部署应用程序时,不会出现问题。我们能够成功调用服务。
我们对比了安装程序和开发程序中的类路径,它们是相同的。
调度程序-servlet.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"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<context:component-scan base-package="test" />
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="en" />
</bean>
<bean id="mvcConfigurationBeanPostProcessor"
class="com.jda.webworks.publicapi.common.SpringMvcConfigBeanPostProcessor">
</bean>
<mvc:annotation-driven>
<mvc:message-converters register-defaults="false">
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
<bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter" />
<bean class="org.springframework.http.converter.StringHttpMessageConverter" />
</mvc:message-converters>
</mvc:annotation-driven>
<!-- enable the configuration of app server transactional behavior based on annotations -->
<tx:annotation-driven/>
<tx:jta-transaction-manager/>
<!-- Create instance of transaction template for programmatic transaction manipulation -->
<bean id="transactionTemplate" class="org.springframework.transaction.support.TransactionTemplate">
<property name="transactionManager" ref="transactionManager"></property>
</bean>
我们也尝试添加<mvc:default-servlet-handler />。但这并没有帮助。
web.xml
<?xml version="1.0" encoding="UTF-8"?>
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</context-param>
<!--
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/config/log4j.xml</param-value>
</context-param>
-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
-->
<session-config>
<session-timeout>1</session-timeout>
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>WebWORKS RESTful Services</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>NetworksUsers</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>default</realm-name>
</login-config>
<security-role>
<role-name>NetworksUsers</role-name>
</security-role>
请给我们任何指示以帮助解决问题。
【问题讨论】:
-
可以添加web.xml吗?
标签: spring rest java-8 weblogic12c