Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initializa

un 27, 2011 11:29:12 AM org.springframework.web.servlet.FrameworkServlet initServletBean

SEVERE: Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is java.lang.NullPointerException

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)

 

 

出这个错是因为我的web.xml里配置了两段

 

  <listener>

  <listener-class>

  org.springframework.web.context.ContextLoaderListener

  </listener-class>

  </listener>

 

and

 

<servlet-name>flexspring</servlet-name>

   <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

 

这样会加载两次,把前面的listener去掉就OK了!

 

 

 

 

 

 

你可能感兴趣的:(java,bean,xml,Web,servlet)