10分钟前还是好的,但现在一直就不能编译通过了。
以前也出现过这种情况,一会自己就好了。感觉一直失灵时不灵的。
请大家指教下问题出在哪里。
错误信息:
严重: Exception sending context initialized event to listener instance of class com.hrds.eix.webapp.eixmq.web.WebConsoleStarter
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionPool' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: Cannot resolve reference to bean 'connectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: Cannot resolve reference to bean 'brokerURL' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerService' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.hrds.eixmq.xbean.XBeanBrokerService#0' defined in ServletContext resource [/WEB-INF/eixmq.xml]: Invocation of init method failed; nested exception is java.io.IOException: Could not locate data file \data\kahadb\db-8.log
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at com.hrds.eix.webapp.eixmq.web.WebConsoleStarter.createWebapplicationContext(WebConsoleStarter.java:42)
at com.hrds.eix.webapp.eixmq.web.WebConsoleStarter.contextInitialized(WebConsoleStarter.java:26)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: Cannot resolve reference to bean 'brokerURL' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerService' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.hrds.eixmq.xbean.XBeanBrokerService#0' defined in ServletContext resource [/WEB-INF/eixmq.xml]: Invocation of init method failed; nested exception is java.io.IOException: Could not locate data file \data\kahadb\db-8.log
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:495)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:162)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 32 more

解决方案 »

  1.   

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerService' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.hrds.eixmq.xbean.XBeanBrokerService#0' defined in ServletContext resource [/WEB-INF/eixmq.xml]: Invocation of init method failed; nested exception is java.io.IOException: Could not locate data file \data\kahadb\db-8.log
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:287)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
    ... 47 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.hrds.eixmq.xbean.XBeanBrokerService#0' defined in ServletContext resource [/WEB-INF/eixmq.xml]: Invocation of init method failed; nested exception is java.io.IOException: Could not locate data file \data\kahadb\db-8.log
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:88)
    at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:76)
    at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:72)
    at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:68)
    at com.hrds.eixmq.xbean.BrokerFactoryBean.afterPropertiesSet(BrokerFactoryBean.java:70)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
    ... 69 more
    Caused by: java.io.IOException: Could not locate data file \data\kahadb\db-8.log
    at org.apache.kahadb.journal.Journal.getDataFile(Journal.java:325)
    at org.apache.kahadb.journal.Journal.getNextLocation(Journal.java:482)
    at com.hrds.eixmq.store.kahadb.MessageDatabase.getRecoveryPosition(MessageDatabase.java:556)
    at com.hrds.eixmq.store.kahadb.MessageDatabase.recover(MessageDatabase.java:359)
    at com.hrds.eixmq.store.kahadb.MessageDatabase.open(MessageDatabase.java:252)
    at com.hrds.eixmq.store.kahadb.MessageDatabase.load(MessageDatabase.java:293)
    at com.hrds.eixmq.store.kahadb.MessageDatabase.start(MessageDatabase.java:162)
    at com.hrds.eixmq.store.kahadb.KahaDBPersistenceAdapter.start(KahaDBPersistenceAdapter.java:168)
    at com.hrds.eixmq.broker.BrokerService.start(BrokerService.java:434)
    at com.hrds.eixmq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:42)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
    ... 88 more
      

  2.   

    看看文件名字大小写。如果是unix/linux上,
    \data\kahadb\db-8.log和\Data\kahadb\db-8.log是不一样的。
    windows上无所谓。
      

  3.   

    补充:我是通过MAVEN获取文件和JAR的
      

  4.   

    好像是tomcat的问题,清空tomcat下work文件夹,清除webapp下5个原装文件夹以外的东西,重启服务器试试,。
      

  5.   

    是不是你的bean有依赖关系啊?
    比如A依赖B,那如果在构造A之前已经有B了,则不报错。反之则报错。
      

  6.   

    Error creating bean with name 'sessionPool' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: 
    这里有错啊,LZ仔细检查下。
      

  7.   


    我觉得应该是Tomcat的问题,如果能运行,说明编译能通过,配置文件应该没问题,按楼上的说法试试,可能能行
      

  8.   

    /WEB-INF/webconsole-embedded.xml注入出错
    ,检查一下文件下是不是有sessionPool对象,或参数是不是正确
      

  9.   

    我觉得有可能。看看你报错的那几个bean。是否存在依赖。
      

  10.   

    <bean id="xxxx" depends-on="xxx"
    去百度查下具体用法。
      

  11.   

    没有改动过,不过通过MAVEN重新编译过
      

  12.   

    不过通过MAVEN重新编译过 
     这个是编译好的怎么又重新编译呢?
      

  13.   

    建议
      1,理清你的程序思路
      2,确认你的配置文件配置 
          尤其是这个/WEB-INF/webconsole-embedded.xml
                  /WEB-INF/eixmq.xml
      3,最后在检查你的代码 主要是类关系的检查。
      

  14.   

     Could not locate data file \data\kahadb\db-8.log 
      这个文件在哪?
      

  15.   

    编译失败,所以没有发布在tomcat上
    还没有这个文件
      

  16.   

    编译失败,所以没有发布在tomcat上 
    还没有这个文件  那里在配置文件貌似配了这个路径吧、、、、
      

  17.   

    看一下这个eixmq.xml文件。。
       它报的是初始化这个文件失败。
         失败原因正是在读这个db-8.log文件抛出的IO异常 
      

  18.   

    应该你的spring有问题,看看你的spring配置吧
      

  19.   

    我还是觉得好像是SPRING的配置问题
    但没用过spring
      

  20.   

    把你的applicationContext-beans.xml的文件内容贴上来 
      

  21.   


     帖这个eixmq.xml和webconsole-embedded.xml
      

  22.   

    这个是eixmq.XML文件
    <beans
      xmlns="http://www.springframework.org/schema/beans"
      xmlns:emq="http://eixmq.hrds.com/schema/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:osgi="http://www.springframework.org/schema/osgi"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      http://eixmq.hrds.com/schema/core http://eixmq.hrds.com/schema/core/eixmq-core.xsd   
      http://eixmq.hrds.com/camel/schema/spring http://eixmq.hrds.com/camel/schema/spring/camel-spring.xsd
      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">
        <!-- Allows us to use system properties as variables in this configuration file -->
       
        <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
           <!-- 
            <property name="locations">
                <value>file:${eixmq.base}/conf/credentials.properties</value>
            </property>      
              -->
        </bean>
       
      
      <!--<import resource="webconsole-query.xml"/>-->    <broker xmlns="http://eixmq.hrds.com/schema/core" brokerName="localhost">        <!--<managementContext>-->
                <!--<managementContext createConnector="false"/>-->
                <!--<managementContext createConnector="true"/>-->
            <!--</managementContext>-->
            
            <persistenceAdapter>
        
               <kahaDB journalMaxFileLength="12" directory="/data/kahadb" cleanupInterval="12"/>
               
            </persistenceAdapter>
        
       <transportConnectors>
          <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" />
        
        </transportConnectors>    </broker>
    </beans>其中BROKER节点报错:cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'broker'.但为啥别人都能编译通过,就我不行呢
      

  23.   

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionPool' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: Cannot resolve reference to bean 'connectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException:
    应该是那个配置文件搞错了,
    bean工厂的配置,关注一下
      

  24.   

    抛出的异常是BeanCreationException
    你仔细检查一下bean的定义,应该是bean在定义时:1>没有引入;2>bean的map指定的路径不对。通常这种情况就是定义bean时名字有问题,框架找不到你映射的bean
      

  25.   

    其中BROKER节点报错:cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'broker'. 但为啥别人都能编译通过,就我不行呢  嘿嘿
         
        报的是你的节点无效
      

  26.   

     xmlns="http://www.springframework.org/schema/beans" 
      xmlns:emq="http://eixmq.hrds.com/schema/core" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:osgi="http://www.springframework.org/schema/osgi" 
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
      http://eixmq.hrds.com/schema/core http://eixmq.hrds.com/schema/core/eixmq-core.xsd  
      http://eixmq.hrds.com/camel/schema/spring http://eixmq.hrds.com/camel/schema/spring/camel-spring.xsd 
      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsdxmlns="http://eixmq.hrds.com/schema/core"确认你上面这些 是否少写了什么东西
      

  27.   

    还有
    我在web.XML中
    注释掉这句
    <!--  <listener>
    <listener-class>com.hrds.eix.webapp.eixmq.web.WebConsoleStarter</listener-class>
    </listener> --> 
    就正确了
      

  28.   


      你这个节点定义失败。
      参考 http://blog.csdn.net/xiaoming444/archive/2009/07/03/4319308.aspx
       
      

  29.   

     你这个com.hrds.eix.webapp.eixmq.web.WebConsoleStarter类是否有呢?
      

  30.   

    WebConsoleStarter那这个类是你自己写的还是拷的呢?
      

  31.   

    embedded.xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">  <import resource="webconsole-query.xml"/>
      <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
        
      <bean id="sessionPool" class="com.hrds.eixmq.web.SessionPool">
       <property name="connectionFactory" ref="connectionFactory"/>
      </bean>  <bean id="brokerService" class="com.hrds.eixmq.xbean.BrokerFactoryBean">
        <property name="config" value="/WEB-INF/eixmq.xml"/>
      </bean>
      <bean id="brokerURL" factory-bean="brokerService" factory-method="getVmConnectorURI"/>  <bean id="connectionFactory" class="com.hrds.eixmq.EixMQConnectionFactory">
        <constructor-arg ref="brokerURL"/>
      </bean>  <bean id="brokerQuery" class="com.hrds.eixmq.web.LocalBrokerFacade" autowire="constructor" scope="prototype"/></beans>
      

  32.   

    Error creating bean with name 'connectionFactory' defined in ServletContext resource [/WEB-INF/webconsole-embedded.xml]: Cannot resolve reference to bean 'brokerURL' while setting constructor argument;是应该是这里相关联的地方出现问题,webconsole-embedded.xml文件中的语法错误,或者引用错误都会造成加载时异常。LZ自已仔细看下,这种错误也只能靠细心了。
      

  33.   

    仔细检查了N多遍,发现问题在com.hrds.eix.webapp.eixmq.web.WebConsoleStarter类