• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Integrating Spring 2.5 and a legacy Servlet Application

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

    Thanks in advance for any clues

     
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
     
    George Impagliazo
    Ranch Hand
    Posts: 41
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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.
     
    Mark Spritzler
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I posted a couple of links to better tutorials in this thread

    https://coderanch.com/t/567496/Spring/HandleRequestInternal-not-called-spring

    Mark
     
    George Impagliazo
    Ranch Hand
    Posts: 41
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark Spritzler wrote:I posted a couple of links to better tutorials in this thread

    https://coderanch.com/t/567496/Spring/HandleRequestInternal-not-called-spring

    Mark



    I'm reposting them here as I didn't find them searching:


    http://www.mkyong.com/spring3/spring-3-mvc-hello-world-example/

    http://www.giantflyingsaucer.com/blog/?p=2395

    Thanks much, I am going to try again tomorrow, following these tutorials.

     
    George Impagliazo
    Ranch Hand
    Posts: 41
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    In my legacy servlet application, the URLs the servlets are mapped to do not have file names.

    For example, there is a servlet, Address.java that would map to the URL:

    https://blah.blah.blah/abc/address/

    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?
     
    Mark Spritzler
    ranger
    Posts: 17347
    11
    Mac IntelliJ IDE Spring
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    George Impagliazo wrote:In my legacy servlet application, the URLs the servlets are mapped to do not have file names.

    For example, there is a servlet, Address.java that would map to the URL:

    https://blah.blah.blah/abc/address/

    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
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic