当我打开我部署在weblogic上的应用程序时,为什么会收到错误404?

问题描述:

我用Spring + hibernate + struts2在weblogic 12中运行一个web应用程序.c 因此,当我在本地weblogic上运行它时,它完美运行,但是当我将它部署到我的qa服务器时,它也有一个weblogic 12。 c即使应用程序状态显示它处于活动状态,我也会收到错误404。 从weblogic我打开应用程序选项,然后测试选项,最后它根据weblogic的url,但我仍然得到错误404。 我试着检查我的数据库连接,我的上下文没有任何成功。当我打开我部署在weblogic上的应用程序时,为什么会收到错误404?

这里是我的weblogic.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> 
    <!-- Usar las librerias del repositorio y no las del weblogic --> 
    <container-descriptor> 
     <prefer-web-inf-classes>true</prefer-web-inf-classes> 
    </container-descriptor> 
    <!-- Configuracion del directorio virtual --> 
    <virtual-directory-mapping> 
     <local-path>C:\Oracle\Middleware\user_projects\domains\WeegoWeb</local-path> 
     <url-pattern>formatos/*</url-pattern> 
     <url-pattern>maletas/*</url-pattern> 
     <url-pattern>modems/*</url-pattern> 
     <url-pattern>sims/*</url-pattern> 
     <url-pattern>contratos/*</url-pattern> 
     <url-pattern>qr/*</url-pattern> 
     <url-pattern>*.png</url-pattern> 
     <url-pattern>*.zip</url-pattern> 
     <url-pattern>*.pdf</url-pattern> 
    </virtual-directory-mapping>  
    <jsp-descriptor> 
     <keepgenerated>true</keepgenerated> 
     <debug>true</debug> 
    </jsp-descriptor> 
    <!-- Configuracion del contexto --> 
    <context-root>WeegoWeb</context-root> 
    <fast-swap> 
     <enabled>false</enabled> 
    </fast-swap> 
</weblogic-web-app> 

和我的web.xml:

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

    <jsp-config> 
     <jsp-property-group> 
      <url-pattern>*.jsp</url-pattern> 
      <page-encoding>UTF-8</page-encoding> 
     </jsp-property-group> 
    </jsp-config> 

    <filter> 
     <filter-name>sanitizarFilter</filter-name> 
     <filter-class>com.proximate.generales.interceptors.SanitizarFilter</filter-class> 
    </filter> 

    <filter-mapping> 
     <filter-name>sanitizarFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping>  
    <filter> 
     <filter-name>encodingFilter</filter-name> 
     <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
     <init-param> 
      <param-name>encoding</param-name> 
      <param-value>UTF-8</param-value> 
     </init-param> 
     <init-param> 
      <param-name>forceEncoding</param-name> 
      <param-value>true</param-value> 
     </init-param> 
    </filter> 
    <filter-mapping> 
     <filter-name>encodingFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <filter> 
     <filter-name>struts</filter-name> 
     <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>struts</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

    <filter-mapping> 
     <filter-name>CharacterEncodingFilter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/conf/spring/context.xml</param-value> 
    </context-param> 
    <context-param> 
     <param-name>tilesDefinitions</param-name> 
     <param-value>/WEB-INF/tiles.xml</param-value> 
    </context-param> 

    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 
    <listener> 
     <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class> 
    </listener> 
    <listener> 
     <listener-class>com.proximate.generales.interceptors.LoginInterceptor</listener-class> 
    </listener> 

    <welcome-file-list> 
     <welcome-file>jsp/index.jsp</welcome-file> 
    </welcome-file-list> 
    <session-config> 
     <session-timeout>30</session-timeout> 
    </session-config> 
    <error-page> 
     <error-code>404</error-code> 
     <location>/jsp/404.jsp</location> 
    </error-page> 
<!-- <error-page> 
     Missing login 
     <error-code>401</error-code> 
     <location>/jsp/error/error2.jsp</location> 
    </error-page> 
    <error-page> 
     Forbidden directory listing 
     <error-code>403</error-code> 
     <location>/jsp/error/error2.jsp</location> 
    </error-page> 
    <error-page> 
     Uncaught exception 
     <error-code>500</error-code> 
     <location>/jsp/error/error2.jsp</location> 
    </error-page> 
    <error-page> 
     Unsupported servlet method 
     <error-code>503</error-code> 
     <location>/jsp/error/error2.jsp</location> 
    </error-page> --> 
</web-app> 

什么可能它只能在我的本地环境发生大公工作,在我的QA服务器显示错误404? 在此先感谢

+0

上面的weblogic.xml中定义的本地路径是否存在于QA服务器上? – ManoDestra

+0

是的。实际上它一直工作得很好,直到昨天,那么weblogic在内存部门的限制,所以他们重新启动weblogic,这就是当这个问题开始时。我试着用不同的上下文重复安装应用程序几次而没有成功。 – linker85

+0

如果他们已经重新启动了服务器,那么您可能需要确保所有必需的服务都已备份并正在运行,Web服务器,数据库等。 – ManoDestra

在检查日志后,我发现hibernate-configuration-3.0.dtd无法到达,因为服务器端口被阻塞了,所以现在我下载了hibernate-configuration-3.0.dtd并且放置它作为本地资源,所以我的hibernate映射文件可以在本地使用它们。我想我将从xml hibernate迁移到注释以避免更多问题。

在您的欢迎文件列表中您使用错误的文件名jsp/index.jsp。您应该在welcome-file标签中写入文件名。

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

FilterDispatcher已弃用。你应该升级的Struts到最新版本,并使用

<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 

了解如何编写Web应用程序描述web.xml