NutzCN Logo
问答 nutz-sqltpl在nutzboot中使用无法获取到SqlsTplHolder的实例
发布于 1772天前 作者 qq_6c186ef5 2139 次浏览 复制 上一个帖子 下一个帖子
标签:

sqlsTplHolder为null

@IocBean(args = {"refer:dao"}, name = "testService")
@SqlsXml("TestService.xml")
public class TestService extends EntityService<User> implements ISqlDaoExecuteService {
  
    @Inject private SqlsTplHolder sqlsTplHolder;
    public TestService(Dao dao){
        super(dao);
    }

    @Override
    public SqlsTplHolder getSqlsTplHolder() {
        return sqlsTplHolder;
    }

    @Override
    public Dao getDao() {
        return super.dao();
    }

    @Override
    public Entity getEntity() {
        return super.getEntity();
    }

    @Override
    public Class getEntityClass() {
        return super.getEntityClass();
    }

    public List<User> queryAll(String id, NutMap params){
        Pager pager = dao().createPager(1, 20);
        pager.setRecordCount(dao().count(getEntityClass()));
        Sql sql = sqlsTplHolder.getSql(id, params);
        sql.setPager(pager);
        sql.setEntity(getEntity());
        dao().execute(sql);
        return sql.getList(getEntityClass());
    }

}

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Sqls PUBLIC "nutz-sqltpl" "https://threefish.gitee.io/nutz-sqltpl/nutz-sqltpl.dtd">
<Sqls class="com.risun.nutzBeetl.service.TestService">
    <!--var是当前文件的共享变量,var中不能有表达式-->
    <var name="tableName">t_user</var>

    <sql id="queryAll" wrap="true">
        select * from ${tableName} where 1=1
        <exp>if(isNotEmpty(name)){</exp>
        and name = @name
        <exp>}</exp>
    </sql>

</Sqls>
16 回复

如何测试的?

通过请求接口的方式

@IocBean
@Ok("json")
@At("/test")
public class TestBeetl  {

    @Inject private TestService testService;

    @At("/ctx")
    @Ok("beetl:/test.html")
    public Context withContext() {
        Context ctx = Lang.context();
        List<User> list = testService.queryAll("queryAll",null);
        ctx.set("list", list);
        return ctx;
    }
}

service中的 Sql sql = sqlsTplHolder.getSql(id, params);报错,sqlsTplHolder为null;
我看了nutz-sqltpl在mvc中使用的示例,都有ioc的配置,我想问一下nutzboot中怎么配置?估计是ioc中的SqlTplIocEventListener等都没有注册

[INFO ] 15:21:48.914 org.apache.tomcat.util.http.parser.Cookie.logInvalidHeader(Cookie.java:590) - A cookie header was received [1579222570,1581577223,1581642275] that contained an invalid cookie. That cookie will be ignored.
 Note: further occurrences of this error will be logged at DEBUG level.
[DEBUG] 15:21:48.939 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/test/ctx : TestBeetl.withContext(TestBeetl.java:24)
[DEBUG] 15:21:48.941 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'testBeetl'<class com.risun.nutzBeetl.module.TestBeetl>
[DEBUG] 15:21:48.941 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=testBeetl
[DEBUG] 15:21:48.942 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(testBeetl) in AnnotationIocLoader(packages=[com.risun.nutzBeetl])
[DEBUG] 15:21:48.942 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'testBeetl'<class com.risun.nutzBeetl.module.TestBeetl>
[DEBUG] 15:21:48.942 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'testBeetl' to [app] 
[DEBUG] 15:21:48.943 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class com.risun.nutzBeetl.module.TestBeetl without AOP
[DEBUG] 15:21:48.945 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'testService'<class com.risun.nutzBeetl.service.TestService>
[DEBUG] 15:21:48.946 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=testService
[DEBUG] 15:21:48.946 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(testService) in AnnotationIocLoader(packages=[com.risun.nutzBeetl])
[DEBUG] 15:21:48.946 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'testService'<class com.risun.nutzBeetl.service.TestService>
[DEBUG] 15:21:48.947 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'testService' to [app] 
[DEBUG] 15:21:48.948 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'dao'<>
[DEBUG] 15:21:48.948 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class com.risun.nutzBeetl.service.TestService without AOP
[DEBUG] 15:21:48.949 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'dao'<>
[DEBUG] 15:21:49.020 org.nutz.service.EntityService.<init>(EntityService.java:41) - Get TypeParams for self : com.risun.nutzBeetl.bean.User
[DEBUG] 15:21:49.021 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - SELECT COUNT(*) FROM t_user 
[WARN ] 15:21:49.024 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/test/ctx :
java.lang.NullPointerException
	at com.risun.nutzBeetl.service.TestService.queryAll(TestService.java:52)
	at com.risun.nutzBeetl.module.TestBeetl.withContext(TestBeetl.java:25)
	at com.risun.nutzBeetl.module.TestBeetl$FM$withContext$56e741e3b6003f3096ffff0e78925e96.invoke(TestBeetl.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:38)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:171)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
[DEBUG] 15:21:49.036 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:76) - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@5d06e734:org.apache.tomcat.util.net.NioChannel@96af19a:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:49266]], Status in: [OPEN_READ], State out: [OPEN]
[DEBUG] 15:21:49.037 org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:1001) - Pushed Processor [org.apache.coyote.http11.Http11Processor@13134113]
[DEBUG] 15:22:12.597 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:712) - Processing socket [org.apache.tomcat.util.net.NioChannel@1f57f5b6:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:49267]] with status [OPEN_READ]
[DEBUG] 15:22:12.598 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:724) - Found processor [null] for socket [org.apache.tomcat.util.net.NioChannel@1f57f5b6:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:49267]]
[DEBUG] 15:22:12.598 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:793) - Popped processor [org.apache.coyote.http11.Http11Processor@13134113] from cache
[DEBUG] 15:22:12.598 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:711) - Error parsing HTTP request header

@IocBy(args="sqltpl")

加在MainLauncher上试试

加上之后还是报错

[WARN ] 16:58:19.722 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/test/ctx :
org.nutz.ioc.IocException: IocBean[testBeetl] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:153)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:171)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: IocBean[testBeetl] fail at field=[testService]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 35 more
Caused by: org.nutz.ioc.IocException: IocBean[testService] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:153)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 37 more
Caused by: java.lang.RuntimeException: IocBean[testService] fail at field=[sqlsTplHolder]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 40 more
Caused by: org.nutz.ioc.IocException: IocBean[class:com.github.threefish.nutz.sqltpl.SqlsTplHolder] none ioc bean match class=com.github.threefish.nutz.sqltpl.SqlsTplHolder
	at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:461)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 42 more
[DEBUG] 16:58:19.738 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:76) - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@10593d69:org.apache.tomcat.util.net.NioChannel@6674e556:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2852]], Status in: [OPEN_READ], State out: [OPEN]
[DEBUG] 16:58:19.738 org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:1001) - Pushed Processor [org.apache.coyote.http11.Http11Processor@ac7d98e]
[DEBUG] 16:58:33.402 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:712) - Processing socket [org.apache.tomcat.util.net.NioChannel@3efc4a3e:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2853]] with status [OPEN_READ]
[DEBUG] 16:58:33.403 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:724) - Found processor [null] for socket [org.apache.tomcat.util.net.NioChannel@3efc4a3e:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2853]]
[DEBUG] 16:58:33.403 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:793) - Popped processor [org.apache.coyote.http11.Http11Processor@ac7d98e] from cache
[DEBUG] 16:58:33.403 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:711) - Error parsing HTTP request header

上面的错误信息是由于private SqlsTplHolder sqlsTplHolder;加了@Inject 注解,但是去掉之后这个对象还是空的,

@IocBean(create="init", depose="depose")
@Views(value={RisunBeetlViewMarker.class})
@IocBy(args="sqltpl")
public class MainLauncher {
    
    @Inject
    protected PropertiesProxy conf;
    @Inject
    protected Dao dao;
    @At("/")
    @Ok("->:/index.html")
    public void index() {}
    
    public void init() {

        //实例化Ioc事件
        SqlTplIocEventListener iocEventListener = new SqlTplIocEventListener(Mvcs.getIoc());



        // NB自身初始化完成后会调用这个方法
        dao.create(User.class, false);
        if (dao.count(User.class) == 0) {
            User user = new User();
            user.setName("wendal");
            user.setAge(18);
            user.setLocation("广州");
            dao.insert(user);
         }
    }
    public void depose() {}

    public static void main(String[] args) throws Exception {
        new NbApp().setArgs(args).setPrintProcDoc(true).run();
    }

}

少了个星号

@IocBy(args="*sqltpl")
C:\Jdk\Java\jdk1.8.0_131\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:13659,suspend=y,server=n -javaagent:E:\idea\ideaConf\.IntelliJIdea2018.2\system\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:\Jdk\Java\jdk1.8.0_131\jre\lib\charsets.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\deploy.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\access-bridge-64.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\cldrdata.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\dnsns.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\jaccess.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\jfxrt.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\localedata.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\nashorn.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\sunec.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\sunjce_provider.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\sunmscapi.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\sunpkcs11.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\ext\zipfs.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\javaws.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\jce.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\jfr.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\jfxswt.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\jsse.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\management-agent.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\plugin.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\resources.jar;C:\Jdk\Java\jdk1.8.0_131\jre\lib\rt.jar;I:\projects\intelliJIdea-pro\Nutz-beetl\target\classes;E:\maven-jar\m2\repository\org\nutz\nutzboot-starter-swagger\2.3.8.v20191031\nutzboot-starter-swagger-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\io\swagger\swagger-servlet\1.5.18\swagger-servlet-1.5.18.jar;E:\maven-jar\m2\repository\io\swagger\swagger-core\1.5.18\swagger-core-1.5.18.jar;E:\maven-jar\m2\repository\org\apache\commons\commons-lang3\3.2.1\commons-lang3-3.2.1.jar;E:\maven-jar\m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.3\jackson-annotations-2.9.3.jar;E:\maven-jar\m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.3\jackson-databind-2.9.3.jar;E:\maven-jar\m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.3\jackson-core-2.9.3.jar;E:\maven-jar\m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml\2.9.3\jackson-dataformat-yaml-2.9.3.jar;E:\maven-jar\m2\repository\org\yaml\snakeyaml\1.18\snakeyaml-1.18.jar;E:\maven-jar\m2\repository\io\swagger\swagger-models\1.5.18\swagger-models-1.5.18.jar;E:\maven-jar\m2\repository\io\swagger\swagger-annotations\1.5.18\swagger-annotations-1.5.18.jar;E:\maven-jar\m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;E:\maven-jar\m2\repository\org\reflections\reflections\0.9.11\reflections-0.9.11.jar;E:\maven-jar\m2\repository\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;E:\maven-jar\m2\repository\com\google\guava\guava\20.0\guava-20.0.jar;E:\maven-jar\m2\repository\org\nutz\nutzboot-core\2.3.8.v20191031\nutzboot-core-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;E:\maven-jar\m2\repository\org\nutz\nutzboot-starter-nutz-mvc\2.3.8.v20191031\nutzboot-starter-nutz-mvc-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\org\nutz\nutzboot-starter-nutz-dao\2.3.8.v20191031\nutzboot-starter-nutz-dao-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\org\nutz\nutz-plugins-daocache\1.r.68.v20191031\nutz-plugins-daocache-1.r.68.v20191031.jar;E:\maven-jar\m2\repository\org\nutz\nutzboot-starter-jdbc\2.3.8.v20191031\nutzboot-starter-jdbc-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\com\alibaba\druid\1.1.20\druid-1.1.20.jar;E:\maven-jar\m2\repository\org\nutz\nutzboot-starter-tomcat\2.3.8.v20191031\nutzboot-starter-tomcat-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.46\tomcat-embed-core-8.5.46.jar;E:\maven-jar\m2\repository\org\apache\tomcat\tomcat-annotations-api\8.5.46\tomcat-annotations-api-8.5.46.jar;E:\maven-jar\m2\repository\org\nutz\nutzboot-servlet3\2.3.8.v20191031\nutzboot-servlet3-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\org\nutz\nutz-plugins-websocket\1.r.68.v20191031\nutz-plugins-websocket-1.r.68.v20191031.jar;E:\maven-jar\m2\repository\javax\annotation\javax.annotation-api\1.2\javax.annotation-api-1.2.jar;E:\maven-jar\m2\repository\org\gandon\tomcat\juli-to-slf4j\1.1.1\juli-to-slf4j-1.1.1.jar;E:\maven-jar\m2\repository\org\nutz\nutzboot-starter-beetlsql\2.3.8.v20191031\nutzboot-starter-beetlsql-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\com\ibeetl\beetlsql\2.11.7\beetlsql-2.11.7.jar;E:\maven-jar\m2\repository\com\github\threefish\nutz-sqltpl\1.3.9.RELEASE\nutz-sqltpl-1.3.9.RELEASE.jar;E:\maven-jar\m2\repository\org\nutz\nutz\1.r.68.v20191031\nutz-1.r.68.v20191031.jar;E:\maven-jar\m2\repository\org\antlr\antlr4-runtime\4.7.1\antlr4-runtime-4.7.1.jar;E:\maven-jar\m2\repository\org\nutz\nutzboot-starter-beetl\2.3.8.v20191031\nutzboot-starter-beetl-2.3.8.v20191031.jar;E:\maven-jar\m2\repository\com\ibeetl\beetl\2.9.10\beetl-2.9.10.jar;E:\maven-jar\m2\repository\com\h2database\h2\1.4.196\h2-1.4.196.jar;E:\maven-jar\m2\repository\mysql\mysql-connector-java\5.1.44\mysql-connector-java-5.1.44.jar;E:\maven-jar\m2\repository\org\slf4j\slf4j-log4j12\1.7.28\slf4j-log4j12-1.7.28.jar;E:\maven-jar\m2\repository\org\slf4j\slf4j-api\1.7.28\slf4j-api-1.7.28.jar;E:\maven-jar\m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;I:\services\IDE\intelliJIdea\IntelliJ IDEA 2019.3.3\lib\idea_rt.jar" com.risun.nutzBeetl.MainLauncher
Connected to the target VM, address: '127.0.0.1:13659', transport: 'socket'
[INFO ] 17:53:13.119 org.nutz.boot.banner.SimpleBannerPrinter.printBanner(SimpleBannerPrinter.java:34) - 
 _   _ ______                                      ___   
| \ | || ___ \  ______ ______ ______ ______ ______| \ \  
|  \| || |_/ / |______|______|______|______|______| |\ \ 
| . ` || ___ \  ______ ______ ______ ______ ______| | > >
| |\  || |_/ / |______|______|______|______|______| |/ / 
\_| \_/\____/                                     |_/_/  
  
:: Nutz Boot ::   (2.3.8.v20191031)

[DEBUG] 17:53:13.274 org.nutz.resource.Scans.printLocations(Scans.java:527) - Locations count=68 time use 134ms
[DEBUG] 17:53:13.289 org.nutz.resource.Scans.scan(Scans.java:280) - Found 1 resource by src( custom/ ) , regex( ^.+[.]properties$ )
[DEBUG] 17:53:13.289 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:106) - load properties from jar:file:/E:/maven-jar/m2/repository/org/nutz/nutzboot-core/2.3.8.v20191031/nutzboot-core-2.3.8.v20191031.jar!/custom/emtry.properties
[DEBUG] 17:53:13.291 org.nutz.boot.config.impl.PropertiesConfigureLoader.init(PropertiesConfigureLoader.java:38) - load I:\projects\intelliJIdea-pro\Nutz-beetl\target\classes\application.properties
[DEBUG] 17:53:13.380 org.nutz.resource.Scans.scan(Scans.java:280) - Found 1 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
[DEBUG] 17:53:13.381 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:49) - loading [emtry.json]
[DEBUG] 17:53:13.382 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:57) - Loaded 0 bean define from path=[ioc/] --> []
[DEBUG] 17:53:13.485 org.nutz.castor.Castors.reload(Castors.java:116) - Using 107 castor for Castors
[DEBUG] 17:53:13.524 org.nutz.ioc.aop.SimpleAopMaker.<init>(SimpleAopMaker.java:79) - Load AopConfigure for anno=org.nutz.aop.interceptor.async.Async by type=org.nutz.aop.interceptor.async.AsyncAopIocLoader
[INFO ] 17:53:13.539 org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:51) -  > scan 'com.risun.nutzBeetl'
[DEBUG] 17:53:13.559 org.nutz.resource.Scans.scan(Scans.java:280) - Found 7 resource by src( com/risun/nutzBeetl/ ) , regex( ^.+[.]class$ )
[INFO ] 17:53:13.585 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) -    > add 'mainLauncher                            ' - com.risun.nutzBeetl.MainLauncher
[INFO ] 17:53:13.598 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) -    > add 'testBeetl                               ' - com.risun.nutzBeetl.module.TestBeetl
[INFO ] 17:53:13.610 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) -    > add 'timeModule                              ' - com.risun.nutzBeetl.module.TimeModule
[INFO ] 17:53:13.626 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) -    > add 'userModule                              ' - com.risun.nutzBeetl.module.UserModule
[INFO ] 17:53:13.656 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:103) -    > add 'testService                             ' - com.risun.nutzBeetl.service.TestService
[ERROR] 17:53:13.682 org.nutz.boot.NbApp.execute(NbApp.java:224) - something happen!!
java.lang.ClassNotFoundException: sqltpl
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at org.nutz.lang.Lang.loadClass(Lang.java:2090)
	at org.nutz.ioc.loader.combo.ComboIocLoader.createIocLoader(ComboIocLoader.java:122)
	at org.nutz.ioc.loader.combo.ComboIocLoader.<init>(ComboIocLoader.java:98)
	at org.nutz.boot.NbApp.prepareIocLoader(NbApp.java:418)
	at org.nutz.boot.NbApp.prepare(NbApp.java:289)
	at org.nutz.boot.NbApp.execute(NbApp.java:201)
	at org.nutz.boot.NbApp.run(NbApp.java:182)
	at com.risun.nutzBeetl.MainLauncher.main(MainLauncher.java:50)
Disconnected from the target VM, address: '127.0.0.1:13659', transport: 'socket'

Process finished with exit code 0

这是SqlsTplHolder的构造方法,

public SqlsTplHolder(FileResource fileResource, ISqlTemplteEngine sqlTemplteEngine) {
        this.fileResource = fileResource;
        this.sqlTemplteEngine = sqlTemplteEngine;
        this.load();
    }

    public SqlsTplHolder(JarResource jarResource, ISqlTemplteEngine sqlTemplteEngine) {
        this.jarResource = jarResource;
        this.sqlTemplteEngine = sqlTemplteEngine;
        this.inJar = true;
        this.load();
    }

哦, 我知道了。。。

移除@IocBy. 在src/main/resources/ioc 目录下, 建一个文件叫 sqltpl.json, 内容就是

var ioc = {
   sqlTplIocEventListener: {
           type: "com.github.threefish.nutz.sqltpl.SqlTplIocEventListener",
           args: [{refer: '$ioc'}]
       },
       beetlSqlTemplteEngineImpl: {
           type: "com.github.threefish.nutz.sqltpl.BeetlSqlTemplteEngineImpl",
           events: {
               create: "init"
           },
           fields: {
                statementStart : "<exp>",//可修改(如需要使用xmltag的只支持<exp></exp> xml tag,不支持其他xml tag)
                statementEnd :"</exp>"//可修改
            }
       }
    }
}

报空的问题解决了,现在有一个问题是在
SqlTplIocEventListener类中调用
private SqlsTplHolder getSqlsTplHolder(Class klass, String fileName, ISqlTemplteEngine sqlTemplteEngine)时

String xmlPath = klass.getPackage().getName().replace(".", File.separator) + File.separator + fileName;
        URL url = klass.getClassLoader().getResource(xmlPath);

url为null,在service的同级目录下创建了TestService.xml(com\risun\nutzBeetl\service\TestService.xml),取到的xmlPath的路劲是相对路劲,

[DEBUG] 09:07:43.631 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:712) - Processing socket [org.apache.tomcat.util.net.NioChannel@58192f43:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2609]] with status [OPEN_READ]
[DEBUG] 09:07:43.631 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:724) - Found processor [null] for socket [org.apache.tomcat.util.net.NioChannel@58192f43:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2609]]
[DEBUG] 09:07:43.632 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:793) - Popped processor [org.apache.coyote.http11.Http11Processor@42cdc9ee] from cache
[DEBUG] 09:07:43.636 org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:402) - Received [GET /test/ctx HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: sid=rr1n58asl0hvroap9udhq782sm; Hm_lvt_d3f0f80430e686f09e671b88b927fa01=1579158716,1579222570,1581577223,1581642275

]
[DEBUG] 09:07:43.638 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/test/ctx : TestBeetl.withContext(TestBeetl.java:24)
[DEBUG] 09:07:43.638 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'testBeetl'<class com.risun.nutzBeetl.module.TestBeetl>
[DEBUG] 09:07:43.638 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=testBeetl
[DEBUG] 09:07:43.639 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(testBeetl) in AnnotationIocLoader(packages=[com.risun.nutzBeetl])
[DEBUG] 09:07:43.639 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'testBeetl'<class com.risun.nutzBeetl.module.TestBeetl>
[DEBUG] 09:07:43.639 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'testBeetl' to [app] 
[DEBUG] 09:07:43.641 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class com.risun.nutzBeetl.module.TestBeetl without AOP
[DEBUG] 09:07:43.641 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'testService'<class com.risun.nutzBeetl.service.TestService>
[DEBUG] 09:07:43.641 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=testService
[DEBUG] 09:07:43.641 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(testService) in AnnotationIocLoader(packages=[com.risun.nutzBeetl])
[DEBUG] 09:07:43.641 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'testService'<class com.risun.nutzBeetl.service.TestService>
[DEBUG] 09:07:43.642 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'testService' to [app] 
[DEBUG] 09:07:43.642 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'dao'<>
[DEBUG] 09:07:43.647 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class com.risun.nutzBeetl.service.TestService without AOP
[DEBUG] 09:07:43.647 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'dao'<>
[DEBUG] 09:07:43.647 org.nutz.service.EntityService.<init>(EntityService.java:41) - Get TypeParams for self : com.risun.nutzBeetl.bean.User
[DEBUG] 09:07:43.648 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'beetlSqlTemplteEngineImpl'<class com.github.threefish.nutz.sqltpl.BeetlSqlTemplteEngineImpl>
[DEBUG] 09:07:45.845 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'testService' from [app] 
[DEBUG] 09:07:45.845 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'testBeetl' from [app] 
[WARN ] 09:07:45.846 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/test/ctx :
org.nutz.ioc.IocException: IocBean[testBeetl] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:153)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:171)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: IocBean[testBeetl] fail at field=[testService]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 35 more
Caused by: org.nutz.ioc.IocException: IocBean[testService] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:153)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 37 more
Caused by: com.github.threefish.nutz.error.NutzSqlTemplateXmlNotFoundError: sqls xml [TestService.xml] is not exists!!!
	at com.github.threefish.nutz.sqltpl.SqlTplIocEventListener.getSqlsTplHolder(SqlTplIocEventListener.java:96)
	at com.github.threefish.nutz.sqltpl.SqlTplIocEventListener.afterCreate(SqlTplIocEventListener.java:44)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:92)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
	... 40 more
[DEBUG] 09:07:45.860 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:76) - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@304d535c:org.apache.tomcat.util.net.NioChannel@58192f43:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2609]], Status in: [OPEN_READ], State out: [OPEN]
[DEBUG] 09:07:45.860 org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:1001) - Pushed Processor [org.apache.coyote.http11.Http11Processor@42cdc9ee]
[DEBUG] 09:07:53.665 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:712) - Processing socket [org.apache.tomcat.util.net.NioChannel@36ae86ea:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2610]] with status [OPEN_READ]
[DEBUG] 09:07:53.665 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:724) - Found processor [null] for socket [org.apache.tomcat.util.net.NioChannel@36ae86ea:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2610]]
[DEBUG] 09:07:53.666 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:793) - Popped processor [org.apache.coyote.http11.Http11Processor@42cdc9ee] from cache
[DEBUG] 09:07:53.666 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:711) - Error parsing HTTP request header
java.io.EOFException
	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1289)
	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1223)
	at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:737)
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:368)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:682)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
[DEBUG] 09:07:53.666 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:76) - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@6e6dd25f:org.apache.tomcat.util.net.NioChannel@36ae86ea:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:2610]], Status in: [OPEN_READ], State out: [CLOSED]
[DEBUG] 09:07:53.667 org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:1001) - Pushed Processor [org.apache.coyote.http11.Http11Processor@42cdc9ee]

要放在resoures目录

java文件放在src/main/java,资源文件放src/main/resources,maven基本规则

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