使用 Spring 的 Rest Web 服务未在 weblogic 12.2.1 中调用

Rest Web Services using Spring are not invoked in weblogic 12.2.1

我们正在考虑将我们的应用程序升级到 Weblogic 12.2.1。服务器正常启动。但是我们无法调用任何网络服务。它们是使用 Spring 编写的。我们还使用 JDK 8.

日志中出现的错误消息是:

org.springframework.web.servlet.PageNotFound No mapping found for HTTP request with URI [/test/components] in DispatcherServlet with name 'dispatcher' [noHandlerFound:1120 {}]

仅当我们使用安装程序安装应用程序时才会出现此问题。 当我们在开发环境中部署应用程序时,问题没有出现。我们能够成功调用服务。

我们比较了安装程序和开发中的类路径,它们是一样的。

调度员-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>

请给我们任何帮助解决问题的建议。

我们已经向 Oracle 提出了一个案例。与此同时,我们找到了解决上述问题的方法。

如果其余 类 在 WEB-INF/classes 或 WEB-INF/lib 下可用,这似乎可行。以前,我们从 "higher" 类加载器、ear/lib(通过 application.xml 设置为 lib)加载 类,然后我们看到了问题。
当然,在 WLS 12.1.3 中,我们从未遇到过任何问题。包含 REST 类 的 .jar 仅在 ear/lib 中,而不在 WAR.

的 WEB-INF 中