Integrating Spring 2.5 and a legacy Servlet Application
George Impagliazo
Ranch Hand
Joined: Sep 25, 2010
Posts: 31
posted
0
I'm new to Spring.
I worked through the sections of this tutorial that cover web flow. My ultimate goal is to use Spring to implement new features in a legacy servlet webapp and then gradually replace the existing code making the servlet webapp into a Spring webabb.
So, to that end, I decided to go through the web flow part of the tutorial again, changing names to make my own first "hello world" screen with Spring within the development copy of the legacy servlet application.
My problem is that when I put the servlet mappings for Spring into my web.xml, I get 404s trying to get to my landing page.
[*]I'm using WebLogic 9.2
[*]I converted the directory tree of my webapp to mimic the layout that Spring webapps use
[*]I copied spring.jar and spring-mvc.jar into my WEB-INF/lib
[*]My application is "abc", it is depllyed abc.war, weblogic.xml has this tag: <wls:context-root>nsd</wls:context-root>
I made a simplified version of my web.xml, with just one legacy servlet in it ( for the landing page ) and Spring. It works with the Spring stuff commented out, but not otherwise. Here it is, my WEB-INF/web.xml for the "abc" webapp
This is my WEB-INF/abc-servlet.xml
Here is the code for my elementary controller:
Again, my problem isn't with the controller or the view (jsp)...yet. Right now, when I include the Spring servlet mappings in my web.xml, I can't get to my landing page, I get a 404. When I yank the Spring servlet mappings, that problem goes away.
I'm a raw beginner with Spring, so I am not sure where to look.
If you are learning Spring, it is best to use the latest version of Spring and latest approaches. By looking at your Controller you are using really old style of Spring MVC. I recommend looking at materials that are up to date, like the Spring documentation at www.springframework.org
Mark Spritzler wrote:If you are learning Spring, it is best to use the latest version of Spring and latest approaches. By looking at your Controller you are using really old style of Spring MVC. I recommend looking at materials that are up to date, like the Spring documentation at www.springframework.org
Good Luck
Mark
I agree with you Mark. However, the most advanced tutorial I found is for 2.5. I even bought an otherwise excellent book ( from "* In Action" series yet ) that doesn't even have a complete working example. There are just too many new things going on for me to use docs with out a step by step tutorial.
Let me know if you have any ideas what the issue is with my original post.......thanks.
Is it possible that Spring, WebLogic, the web.xml are considering URLs like that to *.htm files and getting things confused, with Spring trying to map those URLs to itself while the web.xml is trying to map those URLs to another servlet?
Is it possible that Spring, WebLogic, the web.xml are considering URLs like that to *.htm files and getting things confused, with Spring trying to map those URLs to itself while the web.xml is trying to map those URLs to another servlet?
It depends on your Servlet mapping in your web.xml. If you put in <servlet-mapping> tags that overlap each other, then yes you would have issues. But that is all based on what you put into the web.xml for all your servlet mapping, nothing that Spring is doing.
Good Luck
Mark
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Integrating Spring 2.5 and a legacy Servlet Application