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

时间:2016-03-01 19:17:26

标签: java struts2 weblogic weblogic12c

我在weblogic 12.c中运行了一个运行spring + hibernate + struts2的Web应用程序 因此,当我在我的本地weblogic上运行它时它运行得很好,但当我将它部署到我的qa服务器时,它也有一个weblogic 12.c我得到错误404,即使应用程序状态显示它是活动的。 从weblogic我打开应用程序选项,然后是测试选项,最后根据weblogic打开它的URL,但我仍然得到错误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? 提前致谢

3 个答案:

答案 0 :(得分:1)

在您的欢迎文件列表中,您使用了错误的文件名for (int i = 1; i< contours.size(); i++) // iterate through each contour. {...} 。您应该在int matSize = (edges.rows * edges.cols) * 0.95; // 95% size of image . . for (int i = 0; i< contours.size(); i++) // iterate through each contour. { double a = contourArea(contours[i], false); // Find the area of contour if(a > matSize) continue; . . } 标记中写入文件名。

jsp/index.jsp

不推荐使用welcome-file。您应该将Struts升级到最新版本并使用

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

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

答案 1 :(得分:0)

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

答案 2 :(得分:0)

在Intellij - weblogic项目中遇到此错误 “未找到错误404 来自RFC 2068超文本传输​​协议 - HTTP / 1.1:10.4.5 404 Not Found“

不知何故,项目工件未正确安装到本地.m2存储库中。通过运行mvn clean,package / install命令确保正确安装。