Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-718

Reloading the spring context does not refresh the MessageDispatcherServlet

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Core
    • Labels:
      None

      Description

      Our application uses a special classloader from which it can load beans dynamically. The applicationcontext is reloaded to do this. The normal DispatcherServlet has a mechanism to allow the applicationcontext to be reloaded by overriding the onRefresh method. The MessageDispatcherServlet does not do this and crashes occur when webservices are invoked.

      The class below can be used as a workaround.

      public class FixedMessageDispatcherServlet
      	extends MessageDispatcherServlet
      {
      
      	private boolean initializing = true;
      
      	@Override
      	protected void onRefresh(ApplicationContext context)
      	{
      		try {
      			if (this.initializing) {
      				this.initializing = false;
      			} else {
      				this.initFrameworkServlet();
      			}
      		} catch (Exception e) {
      			throw new RuntimeException(e);
      		}
      	}
      }
      

        Attachments

          Activity

            People

            Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            j.gorter Johan Gorter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 55m
                55m