简体   繁体   中英

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. i did not written any big logic, my requirement is i want to forward request from jsp to controller class getMethod that's it. but this is not working in weblogic.here i am not using any servlet 3.0 jars

here is my 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

<%@ 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

@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.

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. This would probably be BPMBatchSchedular for you.

But when you deployed to web logic you did not set a context root. 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

<?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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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