Announcement Announcement Module
Collapse
No announcement yet.
Spring FrameworkServlet reloads Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring FrameworkServlet reloads

    I posted this under the Web section but thought that this might be a better place for it. I noticed with other Spring applications that the appender warning is normal when log4j is not set up so I know that is normal. What i dont get is why the application context keeps reloading.

    Hi, I have a Spring 2.5.6 MVC app running on Tomcat 6, Java 6. It seems that the ApplicationContexts keeps reloading over and over. The output is bellow. I dont know if it has anything to do with the no appenders found message that I keep getting, but I dont think that has to do with it. Has anyone ever seen this?

    INFO: Starting service Catalina
    Dec 31, 2009 11:46:32 AM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
    log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet ).
    log4j:WARN Please initialize the log4j system properly.
    Dec 31, 2009 11:46:33 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring FrameworkServlet 'springmvc'
    Dec 31, 2009 11:46:33 AM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    Dec 31, 2009 11:46:34 AM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    Dec 31, 2009 11:46:34 AM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/63 config=null
    Dec 31, 2009 11:46:34 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 2004 ms
    Dec 31, 2009 11:46:43 AM org.apache.catalina.loader.WebappClassLoader modified
    INFO: Additional JARs have been added : 'jms-1.1.jar'
    Dec 31, 2009 11:46:43 AM org.apache.catalina.core.StandardContext reload
    INFO: Reloading this Context has started
    Dec 31, 2009 11:46:43 AM org.apache.catalina.core.ApplicationContext log
    INFO: Destroying Spring FrameworkServlet 'springmvc'
    log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet ).
    log4j:WARN Please initialize the log4j system properly.
    Dec 31, 2009 11:46:44 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring FrameworkServlet 'springmvc'
    Dec 31, 2009 11:46:55 AM org.apache.catalina.loader.WebappClassLoader modified
    INFO: Additional JARs have been added : 'jms-1.1.jar'
    Dec 31, 2009 11:46:55 AM org.apache.catalina.core.StandardContext reload
    INFO: Reloading this Context has started
    Dec 31, 2009 11:46:55 AM org.apache.catalina.core.ApplicationContext log
    INFO: Destroying Spring FrameworkServlet 'springmvc'
    log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet ).
    log4j:WARN Please initialize the log4j system properly.
    Dec 31, 2009 11:46:56 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring FrameworkServlet 'springmvc'
    Dec 31, 2009 11:47:07 AM org.apache.catalina.loader.WebappClassLoader modified
    INFO: Additional JARs have been added : 'jms-1.1.jar'
    Dec 31, 2009 11:47:07 AM org.apache.catalina.core.StandardContext reload
    INFO: Reloading this Context has started
    Dec 31, 2009 11:47:07 AM org.apache.catalina.core.ApplicationContext log
    INFO: Destroying Spring FrameworkServlet 'springmvc'
    log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet ).
    log4j:WARN Please initialize the log4j system properly.
    Dec 31, 2009 11:47:07 AM org.apache.catalina.core.ApplicationContext log

  • #2
    i just started seeing the same behavior, with an application that was working previously. now i am running out of java heap space

    have you made any progress with it?

    Comment


    • #3
      None as of yet. I have also been running into the heap space issue after it cycles through for a while.

      Comment


      • #4
        i've upgraded eclipse to sr1 and it is still happening, i am at a loss for what the problem is.

        Comment


        • #5
          OK so I think that I found the issue. I updated the commons-collections jar to 3.2.1 from 3.1.1. Don't ask why but my app has been up and running for about 10 mins without a reload.

          The only weird thing about this though is that commons-collections is only a dependency of hibernate-core. Don't know why that would cause the issue. But if it works, it works. Let me know if that fixed your issue also.

          Comment


          • #6
            no, i am already running it so it must be another issue. here are my depends

            Code:
            <spring.version>2.5.6.SEC01</spring.version>
            <spring.security.version>2.0.4</spring.security.version>
            <tiles.version>2.0.6</tiles.version>
            
            <dependency>
            			<groupId>org.apache.tiles</groupId>
            			<artifactId>tiles-api</artifactId>
            			<version>${tiles.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.apache.tiles</groupId>
            			<artifactId>tiles-core</artifactId>
            			<version>${tiles.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.apache.tiles</groupId>
            			<artifactId>tiles-jsp</artifactId>
            			<version>${tiles.version}</version>
            		</dependency>
            
            		<!-- commons -->
            		<dependency>
            			<groupId>org.apache.commons</groupId>
            			<artifactId>commons-io</artifactId>
            			<version>1.3.2</version>
            		</dependency>
            		<dependency>
            			<groupId>commons-dbcp</groupId>
            			<artifactId>commons-dbcp</artifactId>
            			<version>1.2.2</version>
            		</dependency>
            		<dependency>
            			<groupId>commons-lang</groupId>
            			<artifactId>commons-lang</artifactId>
            			<version>2.4</version>
            		</dependency>
            		<dependency>
            			<groupId>commons-collections</groupId>
            			<artifactId>commons-collections</artifactId>
            			<version>3.2.1</version>
            		</dependency>
            		<dependency>
            			<groupId>commons-logging</groupId>
            			<artifactId>commons-logging</artifactId>
            			<version>1.1.1</version>
            		</dependency>
            		<dependency>
            			<groupId>commons-validator</groupId>
            			<artifactId>commons-validator</artifactId>
            			<version>1.3.1</version>
            		</dependency>
            		<dependency>
            			<groupId>commons-beanutils</groupId>
            			<artifactId>commons-beanutils</artifactId>
            			<version>1.7.0</version>
            		</dependency>
            		<dependency>
            			<groupId>commons-digester</groupId>
            			<artifactId>commons-digester</artifactId>
            			<version>1.8</version>
            		</dependency>
            		<dependency>
            			<groupId>log4j</groupId>
            			<artifactId>log4j</artifactId>
            			<version>1.2.14</version>
            		</dependency>
            		<dependency>
            			<groupId>org.slf4j</groupId>
            			<artifactId>slf4j-simple</artifactId>
            			<version>1.5.6</version>
            		</dependency>
            		<dependency>
            			<groupId>org.slf4j</groupId>
            			<artifactId>slf4j-api</artifactId>
            			<version>1.5.6</version>
            		</dependency>
            
            		<!-- spring -->
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-core</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-aop</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-beans</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-context</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-context-support</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-aspects</artifactId>
            			<version>2.5.6</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-orm</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-tx</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-web</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-webmvc</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-test</artifactId>
            			<version>${spring.version}</version>
            			<scope>test</scope>
            		</dependency>
            		<!--
            			dependencies bringing in spring-security-acl and spring-security-core
            		-->
            		<dependency>
            			<groupId>org.springframework.security</groupId>
            			<artifactId>spring-security-core-tiger</artifactId>
            			<version>${spring.security.version}</version>
            			<!-- Bringing in Spring 2.0.8 -->
            			<exclusions>
            				<exclusion>
            					<groupId>org.springframework</groupId>
            					<artifactId>spring-support</artifactId>
            				</exclusion>
            			</exclusions>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework.security</groupId>
            			<artifactId>spring-security-taglibs</artifactId>
            			<version>${spring.security.version}</version>
            			<!-- Bringing in Spring 2.0.8 -->
            			<exclusions>
            				<exclusion>
            					<groupId>org.springframework</groupId>
            					<artifactId>spring-support</artifactId>
            				</exclusion>
            			</exclusions>
            		</dependency>
            
            		<!-- hibernate -->
            		<dependency>
            			<groupId>org.hibernate</groupId>
            			<artifactId>hibernate-annotations</artifactId>
            			<version>3.4.0.GA</version>
            		</dependency>
            		<dependency>
            			<groupId>org.hibernate</groupId>
            			<artifactId>hibernate-core</artifactId>
            			<version>3.3.2.GA</version>
            		</dependency>
            		<dependency>
            			<groupId>org.hibernate</groupId>
            			<artifactId>hibernate-ehcache</artifactId>
            			<version>3.3.2.GA</version>
            		</dependency>
            		<dependency>
            			<groupId>org.hibernate</groupId>
            			<artifactId>hibernate-entitymanager
            			</artifactId>
            			<version>3.4.0.GA</version>
            		</dependency>

            Comment


            • #7
              Hmm... dont know. You can check yours against mine maybe its just getting the right combination.

              Code:
              <dependencies>
                	<dependency>
                		<groupId>org.springframework</groupId>
                		<artifactId>spring</artifactId>
                		<version>2.5.6</version>
                	</dependency>
                	<dependency>
                		<groupId>org.springframework</groupId>
                		<artifactId>spring-web</artifactId>
                		<version>2.5.6</version>
                	</dependency>
                	<dependency>
                		<groupId>org.springframework</groupId>
                		<artifactId>spring-webmvc</artifactId>
                		<version>2.5.6</version>
                	</dependency>
                	<dependency>
                		<groupId>javax.servlet</groupId>
                		<artifactId>jstl</artifactId>
                		<version>1.2</version>
                	</dependency>
                	<dependency>
                		<groupId>org.apache.tiles</groupId>
                		<artifactId>tiles-api</artifactId>
                		<version>2.0.7</version>
                	</dependency>
                	<dependency>
                		<groupId>org.apache.tiles</groupId>
                		<artifactId>tiles-core</artifactId>
                		<version>2.0.7</version>
                	</dependency>
                	<dependency>
                		<groupId>org.apache.tiles</groupId>
                		<artifactId>tiles-jsp</artifactId>
                		<version>2.0.7</version>
                	</dependency>
                	<dependency>
                		<groupId>org.apache.tiles</groupId>
                		<artifactId>tiles-servlet</artifactId>
                		<version>2.1.0</version>
                	</dependency>
                	<dependency>
                		<groupId>org.hibernate</groupId>
                		<artifactId>hibernate-core</artifactId>
                		<version>3.3.2.GA</version>
                	</dependency>
                	<dependency>
                		<groupId>org.hibernate</groupId>
                		<artifactId>hibernate-annotations</artifactId>
                		<version>3.4.0.GA</version>
                	</dependency>
                	<dependency>
                		<groupId>log4j</groupId>
                		<artifactId>log4j</artifactId>
                		<version>1.2.15</version>
                		<type>jar</type>
                		<scope>compile</scope>
                	</dependency>
                	<dependency>
                		<groupId>org.slf4j</groupId>
                		<artifactId>slf4j-log4j12</artifactId>
                		<version>1.5.8</version>
                		<type>jar</type>
                		<scope>compile</scope>
                	</dependency>
                	<dependency>
                		<groupId>mysql</groupId>
                		<artifactId>mysql-connector-java</artifactId>
                		<version>5.1.10</version>
                		<type>jar</type>
                		<scope>compile</scope>
                	</dependency>
                	<dependency>
                		<groupId>javassist</groupId>
                		<artifactId>javassist</artifactId>
                		<version>3.8.0.GA</version>
                		<type>jar</type>
                		<scope>compile</scope>
                	</dependency>
                	<dependency>
                		<groupId>org.springframework</groupId>
                		<artifactId>spring-aop</artifactId>
                		<version>2.5.6</version>
                	</dependency>
                	<dependency>
                		<groupId>org.aspectj</groupId>
                		<artifactId>aspectjlib</artifactId>
                		<version>1.6.2</version>
                	</dependency>
                	<dependency>
                		<groupId>org.aspectj</groupId>
                		<artifactId>aspectjrt</artifactId>
                		<version>1.6.6</version>
                	</dependency>
                	<dependency>
                		<groupId>org.aspectj</groupId>
                		<artifactId>aspectjweaver</artifactId>
                		<version>1.6.6</version>
                	</dependency>
                	<dependency>
                		<groupId>commons-collections</groupId>
                		<artifactId>commons-collections</artifactId>
                		<version>3.2.1</version>
                	</dependency>
                </dependencies>

              Comment


              • #8
                OK here is the deal. This was a Tomcat issue where a jar file would load after the server was started. And for some reason it would trigger the servlet context to reload over and over. The feature is so that you can do hot code replacement without having to restart Tomcat. Something was wrong though and kept Tomcat thinking that it should reload over and over. Some postings that I was reading said that if a file had a time stamp with a future date or time that would cause that. Don't know if that is accurate or not. The fix that I found to this is in the server.xml for your instance of Tomcat. In Tomcat 6 there is a <context /> element with an attribute named reloadable. In my case it was set to true. Changing this to false will prevent Tomcat from reloading when a file changes.

                Code:
                <Context docBase="myApp" path="/myApp" reloadable="false" source="org.eclipse.jst.jee.server:myApp"/>
                Hope this helps. One draw back is that any Java code changes or properties changes will require a server restart. But on the other hand I have never found hot-code replacement to be too reliable anyways.

                Comment

                Working...
                X