Announcement Announcement Module
Collapse
No announcement yet.
referring contexts in jars causes locking when undeploying ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • referring contexts in jars causes locking when undeploying ?

    Hi all,

    when trying to execute the catalina undeploy task on a webapp that has it's web.xml referring to spring context files in a jar, I experience a locked jar situation. If not for the fact it's the ContextLoaderServlet's responsibility for loading these contexts I would have considered it a Tomcat problem (actually I did initially).

    What chronologically happens is :
    • Servlet 'springwebapp' configured successfully on Tomcat
    • Executing Undeploy catalina task
    • Removing web application at context path /springwebapp
    • Closing application context for 'springwebapp-servlet'
    • Destroying singletons in factory
    • Destroying inner beans in factory
    Result : the relevant jar-file remains on disk. It seems the streams are closed properly, but not in time. Please advise.

    Added info :
    - Tomcat 5.0.25/28 and 5.5.4
    - Spring 1.1.3
    - contextConfigLocation in web.xml contains classpath*:com/mycompany/myproject/applicationContext.xml
    - org.springframework.web.context.ContextLoaderServl et is used for loading the contexts

    Regards,
    M

  • #2
    I'm having the same problem, only my context files are NOT in jars.

    Comment


    • #3
      Obviously I have a risk that it is a configuration problem.

      But if so, I'm not able to find it. Instead when I remove the reference to the context file in my jar, the undeploy task works perfectly.
      Removal means practically :

      Code:
      <context-param>
      		<param-name>contextConfigLocation</param-name>
      		<param-value>			
                  /WEB-INF/applicationContext.xml            
      		</param-value>
      	</context-param>
      instead of
      Code:
      <context-param>
      		<param-name>contextConfigLocation</param-name>
      		<param-value>
      			classpath*&#58;com/mycompany/myproject/applicationContext.xml
      			classpath*&#58;com/mycompany/myproject/dataAccessContext-local.xml
                  /WEB-INF/applicationContext.xml            
      		</param-value>
      	</context-param>
      Note to jdoklovic, this kind of problem can occur on any kind of stream, not just context files. Check what other kind of external resources your web.xml uses.

      M

      Comment


      • #4
        Ok, update, I did some more fine-grained testing, meaning "what if I specify a dummy spring context file under the contextLoaderServlet and try to undeploy ?".

        If it would still lock, this means that using the classpath*: prefix for finding context files causes the lock (instead of some content in those context files for example). Whether that lock is Tomcat/Ant/Spring related I do not know, I tried out the latest Tomcat version (5.5.9), Spring-1.1.5 ant Ant 1.6.2 and it still happens

        Could someone of the Spring team check this please (or explain to me why this cannot be a Spring issue) ?

        Code:
        <context-param>
        		<param-name>contextConfigLocation</param-name>
        		<param-value>
                    classpath*&#58;be/ringring/test/test.xml            
        		</param-value>
        	</context-param>
        test.jar!be/ringring/test.xml :
        Code:
        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
        
        <beans>
        
        	
        
        </beans>
        Regards,
        M

        Comment


        • #5
          Why don't I get an helpfull answer in the thread ? Is it a stupid question ? Should I have seen the obvious truth ? Or is it something else ?

          Because I'm completely in the dark here, moreover, posting this on the Tomcat users list has the same risk of being wrong, so taking one step at a time isn't such a bad idea at all : if it's not Spring related I'd like to know, solving this issue is one thing (e.g. by not using context files in jars), understanding is another.

          Regards,
          M

          Comment


          • #6
            Don't use the Spring classpath*: pseudo URL handler to access resources inside JAR files on operatig systems that perform strict file locking (e.g. Win32 platforms).

            There are a number of bugs in the Win32 implementation of the JVM that cause less-than ideal file locking behaviour.

            Comment


            • #7
              I'm getting a problem which may be related, but not just on Tomcat. GlassFish and OC4J are also giving me problems on undeploying. I'm not using classpath: either, just a /WEB-INF/eiserver_servlet.xml.

              On OC4J it shows up as a ClassLoader problem - the specialised context ClassLoader reports that it's being used when it should have been closed.

              I think we may be looking for some kind of ClassLoader reference "leak" where a class loaded with the web-app's context classloader is being held onto by the container.

              It's also possible that the problem could be coming from TopLink rather than Spring, but even Oracle should have found that one by now.

              Comment


              • #8
                Same problem

                Hi! I think I am having the same problem.... anyone here know is this is fixed in Spring 2.5 ?
                Thanks
                Luxspes

                Comment


                • #9
                  In
                  http://static.springframework.org/sp.../changelog.txt
                  I read:
                  Changes in version 2.0 M3 (8.3.2006) "refined PropertiesLoaderUtils to use a URLConnection with "setUseCaches(false)", to avoid jar file locking on Windows"

                  Anyone know if that is related to this problem? (I guess not because it seems to be fixed since 2.0, but it certainly seems related....)

                  Thanks
                  bye
                  Luxspes
                  Last edited by luxspes; Nov 28th, 2007, 08:33 PM.

                  Comment


                  • #10
                    I think is a tomcat configuration issue.
                    Try setting <Context antiJARLocking="true" antiResourceLocking="true">
                    in ${CatalinaBase}/conf/context.xml

                    Comment


                    • #11
                      Hi gregd!
                      Thanks for answering, but...
                      Sadly, I am not using tomcat, I am having this problem with other application servers (like Glassfish). Do you know of an equivalent trick for Glassfish?
                      Thanks
                      Regards
                      Luxspes

                      Comment


                      • #12
                        no clue at all

                        Comment

                        Working...
                        X