NutzCN Logo
问答 js中配置bean,没报错,但在ioc容器中无法找到
发布于 2282天前 作者 qq_e25320ed 1860 次浏览 复制 上一个帖子 下一个帖子
标签:

配置两个bean,在ioc/tcc-transaction.js中,在setup的init方法中NutConfig能找到该配置,但是ioc中取不到该bean。

transactionConfigurator:{
			type : "org.mengyun.tcctransaction.spring.support.SpringTransactionConfigurator",
			create : "init"
		},
		transactionRecovery:{
			type : "org.mengyun.tcctransaction.recover.TransactionRecovery",
			fields:{
				transactionConfigurator : {
					refer : 'transactionConfigurator'
				}
		    }
		},
15 回复

配置是按这个规范要求。其他bean都有,只有这两个找不到,不知为何?

完整贴一下?

var ioc = {
		transactionConfigurator:{
			type : "org.mengyun.tcctransaction.spring.support.SpringTransactionConfigurator",
			create : "init"
		},
		transactionRecovery:{
			type : "org.mengyun.tcctransaction.recover.TransactionRecovery",
			fields:{
				transactionConfigurator : {
					refer : 'transactionConfigurator'
				}
		    }
		},

};

其他ioc文件也在这个iox目录下吗??IocBy贴来看看

在setup的init方法中NutConfig能找到该配置

这是啥意思

其他的都在同一个ioc目录下

@IocBy(type = ComboIocProvider.class, args = {
		"*org.nutz.ioc.loader.json.JsonLoader", "ioc/",
		"*org.nutz.ioc.loader.annotation.AnnotationIocLoader", "org.mengyun.tcctransaction.sample"})

启动日志贴一下看看, 感觉不应该的

public void init(NutConfig config) {
		
		final Ioc ioc = config.getIoc();
                
}

此处ioc toString()有我配置的bean信息

/*NutIoc*/
{
loader:/*ComboIocLoader*/
{
   "paths" :["ioc/"],
   "map" :{
      "baseService" :{
         "type" :"com.alibaba.dubbo.config.ServiceConfig",
         "fields" :{
            "application" :{
               "refer" :"provider.application"
            },
            "registry" :{
               "refer" :"registry"
            },
            "protocol" :{
               "refer" :"protocol"
            }
         }
      },
      "txREPEATABLE_READ" :{
         "type" :"org.nutz.aop.interceptor.TransactionInterceptor",
         "args" :[4]
      },
      "dataSource" :{
         "type" :"com.alibaba.druid.pool.DruidDataSource",
         "events" :{
            "depose" :"close"
         },
         "fields" :{
            "driverClassName" :{
               "java" :"$conf.get(\"db_driver\")"
            },
            "url" :{
               "java" :"$conf.get(\"db_url\")"
            },
            "username" :{
               "java" :"$conf.get(\"db_user\")"
            },
            "password" :{
               "java" :"$conf.get(\"db_passwd\")"
            },
            "filters" :"stat",
            "initialSize" :30,
            "maxActive" :150,
            "minIdle" :30
         }
      },
      "protocol" :{
         "type" :"com.alibaba.dubbo.config.ProtocolConfig",
         "fields" :{
            "name" :"dubbo",
            "port" :"8181",
            "payload" :"52428800"
         }
      },
      "transactionRepository" :{
         "type" :"org.mengyun.tcctransaction.repository.RedisTransactionRepository",
         "fields" :{
            "keyPrefix" :"TCC:CAP:",
            "jedisPool" :{
               "refer" :"jedisPool"
            }
         }
      },
      "txNONE" :{
         "type" :"org.nutz.aop.interceptor.TransactionInterceptor",
         "args" :[0]
      },
      "service.basic.CapitalAccountService" :{
         "parent" :"baseService",
         "fields" :{
            "interfaceName" :"org.mengyun.tcctransaction.sample.dubbo.capital.api.CapitalAccountService",
            "ref" :{
               "refer" :"capitalAccountService"
            }
         }
      },
      "provider.application" :{
         "type" :"com.alibaba.dubbo.config.ApplicationConfig",
         "fields" :{
            "name" :"capital",
            "logger" :"log4j"
         }
      },
      "jedisPoolConfig" :{
         "type" :"redis.clients.jedis.JedisPoolConfig",
         "fields" :{
            "maxTotal" :"1000",
            "maxWaitMillis" :"1000"
         }
      },
      "transactionRecovery" :{
         "type" :"org.mengyun.tcctransaction.recover.TransactionRecovery",
         "fields" :{
            "transactionConfigurator" :{
               "refer" :"transactionConfigurator"
            }
         }
      },
      "txSERIALIZABLE" :{
         "type" :"org.nutz.aop.interceptor.TransactionInterceptor",
         "args" :[8]
      },
      "transactionConfigurator" :{
         "type" :"org.mengyun.tcctransaction.spring.support.SpringTransactionConfigurator",
         "create" :"init"
      },
      "$aop" :{
         "type" :"org.nutz.ioc.aop.config.impl.JsonAopConfigration",
         "fields" :{
            "itemList" :[["org\\.mengyun\\.tcctransaction\\.sample\\.dubbo\\.capital\\.service\\..+", ".+", "ioc:txREAD_COMMITTED"]]
         }
      },
      "conf" :{
         "type" :"org.nutz.ioc.impl.PropertiesProxy",
         "fields" :{
            "paths" :["custom/"]
         }
      },
      "txREAD_UNCOMMITTED" :{
         "type" :"org.nutz.aop.interceptor.TransactionInterceptor",
         "args" :[1]
      },
      "jedisPool" :{
         "type" :"redis.clients.jedis.JedisPool",
         "args" :[{
            "refer" :"jedisPoolConfig"
         }, "127.0.0.1", "6379", "1000", "", 0]
      },
      "service.basic.CapitalTradeOrderService" :{
         "parent" :"baseService",
         "fields" :{
            "interfaceName" :"org.mengyun.tcctransaction.sample.dubbo.capital.api.CapitalTradeOrderService",
            "ref" :{
               "refer" :"capitalTradeOrderService"
            }
         }
      },
      "reference" :{
         "type" :"com.alibaba.dubbo.config.ReferenceConfig",
         "singleton" :false,
         "fields" :{
            "cluster" :"failfast",
            "loadbalance" :"leastactive",
            "timeout" :38000,
            "application" :{
               "refer" :"provider.application"
            },
            "registry" :{
               "refer" :"registry"
            }
         }
      },
      "txREAD_COMMITTED" :{
         "type" :"org.nutz.aop.interceptor.TransactionInterceptor",
         "args" :[2]
      },
      "dao" :{
         "type" :"org.nutz.dao.impl.NutDao",
         "args" :[{
            "refer" :"dataSource"
         }]
      },
      "registry" :{
         "type" :"com.alibaba.dubbo.config.RegistryConfig",
         "fields" :{
            "protocol" :"zookeeper",
            "address" :"zookeeper://127.0.0.1:2181",
            "file" :"../dubbo/dubbo-registry-capital.propertie"
         }
      },
      "defaultRecoverConfig" :{
         "type" :"org.mengyun.tcctransaction.spring.recover.DefaultRecoverConfig",
         "fields" :{
            "maxRetryCount" :"30",
            "recoverDuration" :"0/30 * * * * ?",
            "delayCancelExceptions" :["com.alibaba.dubbo.remoting.TimeoutException"]
         }
      }
   }
 

   "map" :{
      "capitalAccountRepository" :{
         "type" :"org.mengyun.tcctransaction.sample.capital.domain.repository.CapitalAccountRepository",
         "singleton" :true,
         "events" :{
         },
         "args" :[],
         "fields" :[{
            "name" :"capitalAccountDao",
            "value" :{
               "type" :"refer",
               "value" :"capitalAccountDao"
            },
            "optional" :false
         }],
         "scope" :"app"
      },
      "baseDao" :{
         "type" :"org.mengyun.tcctransaction.sample.dao.BaseDao",
         "singleton" :true,
         "events" :{
         },
         "args" :[],
         "fields" :[{
            "name" :"dao",
            "value" :{
               "type" :"refer",
               "value" :"dao"
            },
            "optional" :false
         }],
         "scope" :"app"
      },
      "capitalAccountService" :{
         "type" :"org.mengyun.tcctransaction.sample.dubbo.capital.service.CapitalAccountServiceImpl",
         "singleton" :true,
         "events" :{
         },
         "args" :[],
         "fields" :[{
            "name" :"capitalAccountRepository",
            "value" :{
               "type" :"refer",
               "value" :"capitalAccountRepository"
            },
            "optional" :false
         }],
         "scope" :"app"
      },
      "tradeOrderRepository" :{
         "type" :"org.mengyun.tcctransaction.sample.capital.domain.repository.TradeOrderRepository",
         "singleton" :true,
         "events" :{
         },
         "args" :[],
         "fields" :[{
            "name" :"tradeOrderDao",
            "value" :{
               "type" :"refer",
               "value" :"tradeOrderDao"
            },
            "optional" :false
         }],
         "scope" :"app"
      },
      "complexDatabase" :{
         "type" :"org.mengyun.tcctransaction.sample.dao.ComplexDatabase",
         "singleton" :true,
         "events" :{
         },
         "args" :[],
         "fields" :[{
            "name" :"dao",
            "value" :{
               "type" :"refer",
               "value" :"dao"
            },
            "optional" :false
         }],
         "scope" :"app"
      },
      "tradeOrderDao" :{
         "type" :"org.mengyun.tcctransaction.sample.capital.infrastructure.dao.TradeOrderDao",
         "singleton" :true,
         "events" :{
         },
         "args" :[],
         "fields" :[{
            "name" :"baseDao",
            "value" :{
               "type" :"refer",
               "value" :"baseDao"
            },
            "optional" :false
         }],
         "scope" :"app"
      },
      "capitalTradeOrderService" :{
         "type" :"org.mengyun.tcctransaction.sample.dubbo.capital.service.CapitalTradeOrderServiceImpl",
         "singleton" :true,
         "events" :{
         },
         "args" :[],
         "fields" :[{
            "name" :"capitalAccountRepository",
            "value" :{
               "type" :"refer",
               "value" :"capitalAccountRepository"
            },
            "optional" :false
         }, {
            "name" :"tradeOrderRepository",
            "value" :{
               "type" :"refer",
               "value" :"tradeOrderRepository"
            },
            "optional" :false
         }],
         "scope" :"app"
      },
      "capitalAccountDao" :{
         "type" :"org.mengyun.tcctransaction.sample.capital.infrastructure.dao.CapitalAccountDao",
         "singleton" :true,
         "events" :{
         },
         "args" :[],
         "fields" :[{
            "name" :"baseDao",
            "value" :{
               "type" :"refer",
               "value" :"baseDao"
            },
            "optional" :false
         }],
         "scope" :"app"
      }
   }
 
},
}
启动没有看到报错日志:
ALL Nutz Log via Log4jLogAdapter
[INFO ] 17:04:10.872 org.nutz.log.Logs.<clinit>(Logs.java:20) - Nutz is licensed under the Apache License, Version 2.0 .
Report bugs : https://github.com/nutzam/nutz/issues
[INFO ] 17:04:10.876 org.nutz.mvc.NutFilter.init(NutFilter.java:71) - NutFilter[nutz] starting ...
[DEBUG] 17:04:11.035 org.nutz.resource.Scans.<init>(Scans.java:484) - Locations for Scans:
[FileSystemResourceLocation [root=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\classes], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\bin\tomcat-juli.jar], JarResourceLocation [jarPath=D:\devtools\Java\jdk1.7.0_65\lib\tools.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\bin\bootstrap.jar], FileSystemResourceLocation [root=D:\devtools\eclipse], JarResourceLocation [jarPath=file:/D:/devtools/tomcat/tomcat7-tcctransation/webapps/tcc-transaction-dubbo-capital/WEB-INF/lib/nutz-1.b.51.jar]]
[DEBUG] 17:04:11.917 org.nutz.resource.Scans.init(Scans.java:75) - Locations for Scans:
[JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jackson-xc-1.9.12.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\cxf-rt-frontend-simple-2.6.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jedis-2.8.0.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jsr173_api-1.0.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\grizzly-portunif-2.1.4.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\resteasy-jaxb-provider-3.0.7.Final.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\javassist-3.15.0-GA.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\guava-19.0.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\tcc-transaction-nutz-1.2.4.20.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\nutz-1.b.51.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\dubbo-2.8.4.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\bin\tomcat-juli.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\nutz-integration-quartz-1.r.66.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\zkclient-0.1.jar], FileSystemResourceLocation [root=D:\devtools\eclipse], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\hessian-4.0.7.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\fastjson-1.2.29.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\slf4j-api-1.6.2.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\javax.ws.rs-api-2.0.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\aspectjrt-1.6.11.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\resteasy-netty-3.0.7.Final.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jaxb-impl-2.2.7.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\aopalliance-1.0.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\spring-aop-3.2.12.RELEASE.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\cxf-rt-databinding-jaxb-2.6.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\commons-codec-1.10.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\curator-client-2.5.0.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\slf4j-log4j12-1.6.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\xstream-1.4.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\byte-buddy-agent-1.5.3.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\commons-pool-1.6.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\spring-core-3.2.9.RELEASE.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\log4j-1.2.17.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\grizzly-core-2.1.4.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\commons-lang3-3.2.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\spring-expression-3.2.9.RELEASE.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\commons-logging-1.1.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\quartz-2.2.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\resteasy-jaxrs-3.0.7.Final.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\spring-web-3.2.12.RELEASE.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\spring-context-3.2.12.RELEASE.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\geronimo-javamail_1.4_spec-1.7.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\tcc-transaction-dubbo-capital-api-1.2.4.20.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\bsf-api-3.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\druid-1.0.26.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\netty-3.7.0.Final.jar], JarResourceLocation [jarPath=file:/D:/devtools/tomcat/tomcat7-tcctransation/webapps/tcc-transaction-dubbo-capital/WEB-INF/lib/nutz-1.b.51.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jackson-core-asl-1.9.12.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\tcc-transaction-sample-common-1.2.4.20.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jcip-annotations-1.0.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jaxb-api-2.2.7.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jaxb-core-2.2.7.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\cxf-rt-core-2.6.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\kryo-shaded-4.0.0.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\tcc-transaction-dubbo-1.2.4.20.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\resteasy-jackson-provider-3.0.7.Final.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\cxf-rt-bindings-soap-2.6.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\stax2-api-3.1.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\bin\bootstrap.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\httpcore-4.2.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\cxf-api-2.6.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jline-0.9.94.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\FastInfoset-1.2.12.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\httpclient-4.5.3.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\woodstox-core-asl-4.1.2.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\commons-pool2-2.3.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jboss-annotations-api_1.1_spec-1.0.1.Final.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\tcc-transaction-core-1.2.4.20.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\cxf-rt-transports-http-2.6.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\tcc-transaction-sample-captial-1.2.4.20.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\management-api-3.0.0-b012.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\zkclient-0.4.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\objenesis-2.4.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\activation-1.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\wsdl4j-1.6.2.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jackson-mapper-asl-1.9.12.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\xpp3_min-1.1.4c.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\xmlpull-1.1.3.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\gmbal-api-only-3.0.0-b023.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\resteasy-jdk-http-3.0.7.Final.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\mysql-connector-java-5.1.33.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\xmlschema-core-2.0.2.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\mockito-core-2.2.12.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\istack-commons-runtime-2.16.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\spring-beans-3.2.12.RELEASE.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\grizzly-framework-2.1.4.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\commons-io-2.1.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\zookeeper-3.4.6.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\curator-framework-2.5.0.jar], FileSystemResourceLocation [root=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\classes], JarResourceLocation [jarPath=D:\devtools\Java\jdk1.7.0_65\lib\tools.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\jaxrs-api-3.0.7.Final.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\aspectjweaver-1.6.8.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\grizzly-rcm-2.1.4.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\byte-buddy-1.5.3.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\resteasy-client-3.0.7.Final.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\validation-api-1.0.0.GA.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\cache-api-0.4.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\tcc-transaction-api-1.2.4.20.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\fst-1.55.jar], JarResourceLocation [jarPath=D:\devtools\tomcat\tomcat7-tcctransation\webapps\tcc-transaction-dubbo-capital\WEB-INF\lib\minlog-1.3.0.jar]]
[DEBUG] 17:04:11.922 org.nutz.mvc.config.AbstractNutConfig.getMainModule(AbstractNutConfig.java:119) - MainModule: <org.mengyun.tcctransaction.sample.dubbo.capital.MainModule>
[DEBUG] 17:04:11.934 org.nutz.mvc.config.AbstractNutConfig.createLoading(AbstractNutConfig.java:50) - Loading by class org.nutz.mvc.impl.NutLoading
[INFO ] 17:04:11.937 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:52) - Nutz Version : 1.b.51 
[INFO ] 17:04:11.937 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:53) - Nutz.Mvc[nutz] is initializing ...
[DEBUG] 17:04:11.938 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:57) - Web Container Information:
[DEBUG] 17:04:11.939 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:58) -  - Default Charset : UTF-8
[DEBUG] 17:04:11.939 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:59) -  - Current . path  : D:\devtools\eclipse\.
[DEBUG] 17:04:11.939 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:60) -  - Java Version    : 1.7.0_65
[DEBUG] 17:04:11.939 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:61) -  - File separator  : \
[DEBUG] 17:04:11.939 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:62) -  - Timezone        : Asia/Shanghai
[DEBUG] 17:04:11.939 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:63) -  - OS              : Windows 7 amd64
[DEBUG] 17:04:11.939 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:64) -  - ServerInfo      : Apache Tomcat/7.0.70
[DEBUG] 17:04:11.940 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:65) -  - Servlet API     : 3.0
[DEBUG] 17:04:11.940 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:67) -  - ContextPath     : /tcc-transaction-dubbo-capital
[DEBUG] 17:04:11.941 org.nutz.mvc.config.AbstractNutConfig.getMainModule(AbstractNutConfig.java:119) - MainModule: <org.mengyun.tcctransaction.sample.dubbo.capital.MainModule>
[DEBUG] 17:04:11.941 org.nutz.mvc.impl.NutLoading.createContext(NutLoading.java:214) - >> app.root = D:/devtools/tomcat/tomcat7-tcctransation/webapps/tcc-transaction-dubbo-capital
[DEBUG] 17:04:12.000 org.nutz.castor.Castors.reload(Castors.java:116) - Using 91 castor for Castors
[DEBUG] 17:04:12.005 org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:326) - @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*org.nutz.ioc.loader.json.JsonLoader", "ioc/", "*org.nutz.ioc.loader.annotation.AnnotationIocLoader", "org.mengyun.tcctransaction.sample"])
[DEBUG] 17:04:12.030 org.nutz.resource.Scans.scan(Scans.java:228) - Found 6 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
[DEBUG] 17:04:12.030 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:44) - loading ioc js config from [tcc-transaction.js]
[DEBUG] 17:04:12.035 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:44) - loading ioc js config from [beanConfig.js]
[DEBUG] 17:04:12.037 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:44) - loading ioc js config from [dao.js]
[DEBUG] 17:04:12.037 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:44) - loading ioc js config from [dubboxConfig.js]
[DEBUG] 17:04:12.038 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:44) - loading ioc js config from [tcc-transaction.js]
[DEBUG] 17:04:12.040 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:44) - loading ioc js config from [tcc.js]
[DEBUG] 17:04:12.041 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:52) - Loaded 22 bean define from path=[ioc/] --> [baseService, txREPEATABLE_READ, dataSource, protocol, transactionRepository, txNONE, service.basic.CapitalAccountService, provider.application, jedisPoolConfig, transactionRecovery, txSERIALIZABLE, transactionConfigurator, $aop, conf, txREAD_UNCOMMITTED, jedisPool, service.basic.CapitalTradeOrderService, reference, txREAD_COMMITTED, dao, registry, defaultRecoverConfig]
[DEBUG] 17:04:12.055 org.nutz.resource.Scans.scan(Scans.java:228) - Found 18 resource by src( org/mengyun/tcctransaction/sample/ ) , regex( ^.+[.]class$ )
[DEBUG] 17:04:12.072 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:70) - Found a Class with Ioc-Annotation : class org.mengyun.tcctransaction.sample.capital.domain.repository.CapitalAccountRepository
[DEBUG] 17:04:12.078 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:70) - Found a Class with Ioc-Annotation : class org.mengyun.tcctransaction.sample.dubbo.capital.service.CapitalAccountServiceImpl
[DEBUG] 17:04:12.094 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:70) - Found a Class with Ioc-Annotation : class org.mengyun.tcctransaction.sample.capital.domain.repository.TradeOrderRepository
[DEBUG] 17:04:12.095 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:70) - Found a Class with Ioc-Annotation : class org.mengyun.tcctransaction.sample.capital.infrastructure.dao.TradeOrderDao
[DEBUG] 17:04:12.096 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:70) - Found a Class with Ioc-Annotation : class org.mengyun.tcctransaction.sample.dao.ComplexDatabase
[DEBUG] 17:04:12.101 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:70) - Found a Class with Ioc-Annotation : class org.mengyun.tcctransaction.sample.dao.BaseDao
[DEBUG] 17:04:12.114 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:70) - Found a Class with Ioc-Annotation : class org.mengyun.tcctransaction.sample.dubbo.capital.service.CapitalTradeOrderServiceImpl
[DEBUG] 17:04:12.132 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:70) - Found a Class with Ioc-Annotation : class org.mengyun.tcctransaction.sample.capital.infrastructure.dao.CapitalAccountDao
[INFO ] 17:04:12.133 org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:47) - Scan complete ! Found 8 classes in 1 base-packages!
beans = ["baseDao", "capitalAccountRepository", "capitalAccountService", "tradeOrderRepository", "complexDatabase", "capitalTradeOrderService", "tradeOrderDao", "capitalAccountDao"]
[DEBUG] 17:04:12.141 org.nutz.mvc.config.AbstractNutConfig.getMainModule(AbstractNutConfig.java:119) - MainModule: <org.mengyun.tcctransaction.sample.dubbo.capital.MainModule>
[INFO ] 17:04:12.144 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:140) - Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
[DEBUG] 17:04:12.146 org.nutz.mvc.impl.NutLoading.createViewMakers(NutLoading.java:316) - @Views(DefaultViewMaker)
[DEBUG] 17:04:12.152 org.nutz.mvc.impl.NutLoading.createChainMaker(NutLoading.java:242) - @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
[DEBUG] 17:04:12.157 org.nutz.mvc.impl.Loadings.scanModules(Loadings.java:98) - module class location 'file:/D:/devtools/tomcat/tomcat7-tcctransation/webapps/tcc-transaction-dubbo-capital/WEB-INF/classes/'
[WARN ] 17:04:12.158 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:165) - None module classes found!!!
[WARN ] 17:04:12.158 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:198) - None @At found in any modules class!!
[DEBUG] 17:04:12.158 org.nutz.mvc.impl.NutLoading.evalLocalization(NutLoading.java:289) - @Localization not define
[INFO ] 17:04:12.159 org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:250) - Setup application...

ioc.getNames() 打印出来,没有那两个bean。
加载失败为什么不报错?加载成功为什么没有bean?

[dataSource, txREPEATABLE_READ, capitalAccountService, tradeOrderRepository, txNONE, transactionRepository, provider.application, service.basic.CapitalAccountService, txSERIALIZABLE, $aop, complexDatabase, jedisPool, service.basic.CapitalTradeOrderService, capitalAccountRepository, txREAD_COMMITTED, capitalTradeOrderService, baseService, baseDao, protocol, transactionRecovery, jedisPoolConfig, transactionConfigurator, txREAD_UNCOMMITTED, tradeOrderDao, reference, dao, registry, defaultRecoverConfig, capitalAccountDao]

有啊

baseDao, protocol, transactionRecovery, jedisPoolConfig, transactionConfigurator, txREAD_UNCOMMITTED,

噢,确实有。那为什么调用ioc.get(SpringTransactionConfigurator.class),会报错呢?

[DEBUG] 17:19:27.221 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:144) - Get 'springTransactionConfigurator'<class org.mengyun.tcctransaction.spring.support.SpringTransactionConfigurator>
[DEBUG] 17:19:27.222 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - 	 >> Load definition
org.nutz.ioc.IocException: For object [springTransactionConfigurator] - type:[class org.mengyun.tcctransaction.spring.support.SpringTransactionConfigurator]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:201)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:212)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:139)
	at org.mengyun.tcctransaction.sample.dubbo.capital.IFSSetup.init(IFSSetup.java:25)
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:253)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:112)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:78)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4939)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5633)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'springTransactionConfigurator' without define!
	at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:129)
	at org.nutz.ioc.loader.cached.CachedIocLoaderImpl.load(CachedIocLoaderImpl.java:47)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:169)
	... 19 more

ioc.get只认名字, 对不上就传正确的名字

明白了,是一个很低级的错误。其实已经报错,我没看清。
另外这里还有一个地方配错。

transactionConfigurator:{
			type : "org.mengyun.tcctransaction.spring.support.SpringTransactionConfigurator",
			create : "init"
		},

应该配置成:

springTransactionConfigurator:{
			type : 'org.mengyun.tcctransaction.spring.support.SpringTransactionConfigurator',
			events : {
				create : "init"
			}
		},

否则会把type 和 create当成bean的属性,找不到就报错。
感谢@wendal和@Wizzercn热心支持

添加回复
请先登陆
回到顶部