NutzCN Logo
问答 nutz项目启动时,开始一个tcp链接
发布于 2567天前 作者 ahrvk 1755 次浏览 复制 上一个帖子 下一个帖子
标签:

想在nutz项目启动时同时开启一个tcp的链接,使用了servlet的init方法,但是取不到注入的service类,怎么办。

6 回复

@wendal
org.nutz.ioc.IocException: create ioc bean fail name=warnService ioc define:

报这个错是怎么回事

完整报错信息

@wendal

org.nutz.ioc.IocException: create ioc bean fail name=warnService ioc define:
{
   "type" :"com.sctele.service.WarnService",
   "singleton" :true,
   "events" :{
   },
   "args" :[],
   "fields" :[{
      "name" :"dao",
      "value" :{
         "type" :"refer",
         "value" :"dao"
      },
      "optional" :false
   }],
   "scope" :"app"
}
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:132)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:212)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:139)
	at com.sctele.servlet.TCPClient.reciveData(TCPClient.java:74)
	at com.sctele.servlet.TCPClient.init(TCPClient.java:56)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5266)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5554)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.ioc.IocException: create ioc bean fail name=dao ioc define:
{
   "type" :"org.nutz.dao.impl.ext.LazyNutDao",
   "singleton" :true,
   "args" :[{
      "type" :"refer",
      "value" :"ds"
   }],
   "fields" :[],
   "scope" :"app"
}
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:132)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)
	at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:123)
	... 17 more
Caused by: org.nutz.ioc.IocException: create ioc bean fail name=ds ioc define:
{
   "type" :"com.alibaba.druid.pool.DruidDataSource",
   "singleton" :true,
   "events" :{
      "create" :"init",
      "depose" :"close"
   },
   "args" :[],
   "fields" :[{
      "name" :"jdbcUrl",
      "value" :{
         "type" :"java",
         "value" :"$config.get('db-url')"
      },
      "optional" :false
   }, {
      "name" :"username",
      "value" :{
         "type" :"java",
         "value" :"$config.get('db-user')"
      },
      "optional" :false
   }, {
      "name" :"password",
      "value" :{
         "type" :"java",
         "value" :"$config.get('db-pass')"
      },
      "optional" :false
   }, {
      "name" :"testWhileIdle",
      "value" :{
         "type" :"normal",
         "value" :true
      },
      "optional" :false
   }, {
      "name" :"testOnBorrow",
      "value" :{
         "type" :"normal",
         "value" :true
      },
      "optional" :false
   }, {
      "name" :"testOnReturn",
      "value" :{
         "type" :"normal",
         "value" :false
      },
      "optional" :false
   }, {
      "name" :"maxActive",
      "value" :{
         "type" :"normal",
         "value" :10
      },
      "optional" :false
   }, {
      "name" :"initialSize",
      "value" :{
         "type" :"normal",
         "value" :1
      },
      "optional" :false
   }, {
      "name" :"validationQuery",
      "value" :{
         "type" :"normal",
         "value" :"select 1 from dual"
      },
      "optional" :false
   }, {
      "name" :"validationQueryTimeout",
      "value" :{
         "type" :"normal",
         "value" :1
      },
      "optional" :false
   }, {
      "name" :"timeBetweenEvictionRunsMillis",
      "value" :{
         "type" :"normal",
         "value" :30000
      },
      "optional" :false
   }, {
      "name" :"numTestsPerEvictionRun",
      "value" :{
         "type" :"normal",
         "value" :10
      },
      "optional" :false
   }],
   "scope" :"app"
}
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:132)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)
	at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:73)
	... 22 more

nutz啥版本? 感觉没有把错误信息贴全

大哥,你解决了么?给个小demo看下呗

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