简体   繁体   English

在tomcat和weblogic 10服务器中部署spring应用程序之间的区别

[英]difference between deploying spring application in tomcat and weblogic 10 servers

i have a spring application i deployed in tomcat it is running fine but it is not running on weblogic server. 我在tomcat中部署了一个spring应用程序,它运行良好,但未在weblogic服务器上运行。 i did not written any big logic, my requirement is i want to forward request from jsp to controller class getMethod that's it. 我没有写任何大的逻辑,我的要求是我想将请求从jsp转发到控制器类getMethod就是这样。 but this is not working in weblogic.here i am not using any servlet 3.0 jars 但这在weblogic中不起作用。在这里我没有使用任何servlet 3.0 jar

here is my web.xml 这是我的web.xml

<servlet-mapping>
        <servlet-name>DispatcherServlet</servlet-name>
        <url-pattern>/</url-pattern>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>

in my index.jsp i am just forwarding my request to one controller method 在我的index.jsp中,我只是将我的请求转发到一个控制器方法

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<c:redirect url="/result"/>
</body>
</html>

and in my controller class i have a method with above url 在我的控制器类中,我有一个上面URL的方法

@RequestMapping(value="/result")
    public String getResults(ModelMap map){

        map.put("userList",null);
        System.out.println("result page ...");
        return "result";

    }

anybody please tell me what am i missing here why it is not working in welogic and what is the difference. 有人请告诉我我在这里想念的是为什么它在welogic中不起作用以及有什么区别。

i think that when you have deployed to tomcat it had a context root , ie if you have developed your application with eclipse go to your project -> right click -> web project settings -> context root. 我认为,当您部署到tomcat时,它具有上下文根,即如果您使用Eclipse开发了应用程序,请转到您的项目->右键单击-> Web项目设置->上下文根。 This would probably be BPMBatchSchedular for you. 对于您来说,这可能是BPMBatchSchedular。

But when you deployed to web logic you did not set a context root. 但是,当您部署到Web逻辑时,您没有设置上下文根。 In order to set a context root, create a weblogic.xml in the same directory where your web.xml is and put these lines of code 为了设置上下文根,请在web.xml所在的目录中创建一个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">
      <context-root>/BPMBatchSchedular</context-root>

  </weblogic-web-app>

If you don't want to create a weblogic.xml file you can set the context root in the web logic web console 如果您不想创建weblogic.xml文件,则可以在Web逻辑Web控制台中设置上下文根

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM