我在eclipse中集成了weblogic的插件,已经能正常运行,现在加入spring,并在web.xml中配置了WebApplicationContext初始化:
<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/app/*.xml</param-value> </context-param> <servlet> <servlet-name>context</servlet-name> <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
一切都正常,可以调用注入配置的bean。但是,在开发过程中,如果需要修改代码调试,编译完后调用,就会出现下面的错误,如果重新启动服务器,就没有问题了,这样就存在开发效率的问题了:只要我的代码改动一个字,就要重新启动应用服务,才能进行测试。请问各位高手,怎么样配置,才能解决这个问题呢?
2008-09-24 15:37:07,984 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Closing application context [WebApplicationContext for namespace 'springapp-servlet']> 2008-09-24 15:37:07,984 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Destroying singletons in factory {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [springappController,prodMan,product1,product2,product3,messageSource,urlMapping,viewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [helloBean]; root of BeanFactory hierarchy}> 2008-09-24 15:37:08,484 INFO [org.springframework.web.servlet.DispatcherServlet] - <Initializing servlet 'springapp'> 2008-09-24 15:37:08,640 INFO [org.springframework.core.CollectionFactory] - <JDK 1.4+ collections available> 2008-09-24 15:37:08,671 INFO [org.springframework.core.CollectionFactory] - <Commons Collections 3.x available> 2008-09-24 15:37:08,671 INFO [org.springframework.web.servlet.DispatcherServlet] - <FrameworkServlet 'springapp': initialization started> <2008-9-24 下午15时37分08秒 CST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=1149197,name=completeWeb,context-path=/completeWeb)] Root cause of ServletException. java.lang.IllegalStateException: Root context attribute is not of type WebApplicationContext: org.springframework.web.context.support.XmlWebApplicationContext: display name [Root WebApplicationContext]; startup date [Wed Sep 24 15:36:27 CST 2008]; root of context hierarchy; config locations [/WEB-INF/app/*.xml] at org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(WebApplicationContextUtils.java:64) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:250) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:220) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:115) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:993) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:869) at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:848) at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:787) at weblogic.servlet.internal.ServletStubImpl.reloadServlet(ServletStubImpl.java:705) at weblogic.servlet.internal.ServletStubImpl.checkForReload(ServletStubImpl.java:685) at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:522) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:362) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) >