NutzCN Logo
问答 微信自动回复信息报错希望得到帮助
发布于 2067天前 作者 wx_2jk6i7mpius707s625cs 1797 次浏览 复制 上一个帖子 下一个帖子
标签:

private static Logger logger = Logger.getLogger(UserDao.class);
2019-03-27 11:39:54,147 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN - Error@/weixin/msgin :
java.lang.NullPointerException
at org.nutz.weixin.repo.com.qq.weixin.mp.aes.WXBizMsgCrypt.(WXBizMsgCrypt.java:57)
at org.nutz.weixin.impl.BasicWxHandler.getMsgCrypt(BasicWxHandler.java:39)
at org.nutz.weixin.util.Wxs.handle(Wxs.java:688)
at net.wendal.nutzbook.weinModel.WeixinModule.msgin(WeixinModule.java:26)
at net.wendal.nutzbook.weinModel.WeixinModule$FM$msgin$b806526ae658790edc3fc063949c9d61.invoke(WeixinModule.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:30)
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:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
春天的风 13:24:15

import org.apache.log4j.Logger;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.weixin.bean.WxInMsg;
import org.nutz.weixin.bean.WxOutMsg;
import org.nutz.weixin.impl.BasicWxHandler;
import org.nutz.weixin.util.Wxs;

import net.wendal.nutzbook.dao.UserDao;

@IocBean(create="init", name="WxHandler")
public class DefaultWxHandler extends BasicWxHandler {
private static Logger logger = Logger.getLogger(UserDao.class);
@Inject
protected PropertiesProxy conf; // 注入配置信息加载类

public void init() {
// 将读取 weixin.token/weixin.aes/weixin.appid, 他们通常会写在weixin.properties或从数据库读取.
configure(conf, "weixin.");

// 如果你不知道conf是啥, 完全搞不清楚状况,
// 请将protected PropertiesProxy conf注释掉,configure也注释掉
// 把下面这行取消注释.
// token = "1234567890";

}

public WxOutMsg text(WxInMsg msg) {
logger.info(msg.getContent());
if ("1".equals(msg.getContent())) {
return Wxs.respText("广告法说不能自称第一");
}
else if ("2".equals(msg.getContent())) {
return Wxs.respText("就是这么2");
}
return super.text(msg);
}
}

import javax.servlet.http.HttpServletRequest;

import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.View;
import org.nutz.mvc.annotation.At;
import org.nutz.weixin.util.Wxs;

import net.wendal.nutzbook.WxHandler.DefaultWxHandler;

@IocBean
@At("/weixin")
public class WeixinModule { // 并不要求你继承任何东西
/*
wxHandler是被动请求的主要处理类, 里面写的1234567890就是"接口配置信息"里面提到的"token",
*/
@Inject
protected DefaultWxHandler defaultWxHandler;

@At // 拼起来的全路径就是 /weixin/msgin
public View msgin(HttpServletRequest req) throws IOException {
    return Wxs.handle(defaultWxHandler, req, "default"); // 最后面的default,可以不写,只是个标识符.
}

}

23 回复

用"插入代码"按钮啊

import org.apache.log4j.Logger;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.weixin.bean.WxInMsg;
import org.nutz.weixin.bean.WxOutMsg;
import org.nutz.weixin.impl.BasicWxHandler;
import org.nutz.weixin.util.Wxs;

import net.wendal.nutzbook.dao.UserDao;

@IocBean(create="init", name="WxHandler")
public class DefaultWxHandler extends BasicWxHandler {
	private static Logger logger = Logger.getLogger(UserDao.class);
	@Inject
	protected PropertiesProxy conf; // 注入配置信息加载类

public void init() {
    // 将读取 weixin.token/weixin.aes/weixin.appid, 他们通常会写在weixin.properties或从数据库读取.
    configure(conf, "weixin.");

    // 如果你不知道conf是啥, 完全搞不清楚状况,
    // 请将protected PropertiesProxy conf注释掉,configure也注释掉
    // 把下面这行取消注释.
    // token = "1234567890";
}

public WxOutMsg text(WxInMsg msg) {
	logger.info(msg.getContent());
    if ("1".equals(msg.getContent())) {
        return Wxs.respText("广告法说不能自称第一");
    }
    else if ("2".equals(msg.getContent())) {
        return Wxs.respText("就是这么2");
    }
    return super.text(msg);
}
}

import javax.servlet.http.HttpServletRequest;

import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.View;
import org.nutz.mvc.annotation.At;
import org.nutz.weixin.util.Wxs;

import net.wendal.nutzbook.WxHandler.DefaultWxHandler;

@IocBean
@At("/weixin")
public class WeixinModule { // 并不要求你继承任何东西
    /*
    wxHandler是被动请求的主要处理类, 里面写的1234567890就是"接口配置信息"里面提到的"token",
    */
	@Inject
	protected DefaultWxHandler defaultWxHandler;

    @At // 拼起来的全路径就是 /weixin/msgin
    public View msgin(HttpServletRequest req) throws IOException {
        return Wxs.handle(defaultWxHandler, req, "default"); // 最后面的default,可以不写,只是个标识符.
    }
}

2019-03-27 11:39:54,147 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) WARN  - Error@/weixin/msgin :
java.lang.NullPointerException
	at org.nutz.weixin.repo.com.qq.weixin.mp.aes.WXBizMsgCrypt.<init>(WXBizMsgCrypt.java:57)
	at org.nutz.weixin.impl.BasicWxHandler.getMsgCrypt(BasicWxHandler.java:39)
	at org.nutz.weixin.util.Wxs.handle(Wxs.java:688)
	at net.wendal.nutzbook.weinModel.WeixinModule.msgin(WeixinModule.java:26)
	at net.wendal.nutzbook.weinModel.WeixinModule$FM$msgin$b806526ae658790edc3fc063949c9d61.invoke(WeixinModule.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:30)
	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:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

是不是写了weixin.aes?

微信后台用了加密模式?

那得配上weixin.aes

有没有关于微信回复信息这块的解读。weixin.aes的配置方法

就是微信后台的那个加密字符串

我把消息加密改成明文之后再微信发信息控制台没反应了

我把消息加密改成明文之后再微信发信息控制台没反应了,访问/nutzbook/weixin/msgin

 2019-03-27 14:18:07,827 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/weixin/msgin : WeixinModule.msgin(WeixinModule.java:26)
2019-03-27 14:18:07,836 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'weixinModule'<class net.wendal.nutzbook.weinModel.WeixinModule>
2019-03-27 14:18:07,838 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=weixinModule
2019-03-27 14:18:07,838 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(weixinModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,839 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'weixinModule'<class net.wendal.nutzbook.weinModel.WeixinModule>
2019-03-27 14:18:07,840 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'weixinModule' to [app] 
2019-03-27 14:18:07,842 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class net.wendal.nutzbook.weinModel.WeixinModule without AOP
2019-03-27 14:18:07,889 org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:64) DEBUG - name=defaultWxHandler not found, search for type=net.wendal.nutzbook.WxHandler.DefaultWxHandler
2019-03-27 14:18:07,890 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,891 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(dao) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,906 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,907 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(userAction) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,907 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(weixinModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,908 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(userModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,908 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(WxHandler) in AnnotationIocLoader(packages=[et.wendal.nutzbook])
2019-03-27 14:18:07,910 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'WxHandler'<class net.wendal.nutzbook.WxHandler.DefaultWxHandler>
2019-03-27 14:18:07,910 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=WxHandler
2019-03-27 14:18:07,911 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(WxHandler) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,912 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'WxHandler'<class net.wendal.nutzbook.WxHandler.DefaultWxHandler>
2019-03-27 14:18:07,913 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'WxHandler' to [app] 
2019-03-27 14:18:07,913 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class net.wendal.nutzbook.WxHandler.DefaultWxHandler without AOP
2019-03-27 14:18:08,141 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'conf'<class org.nutz.ioc.impl.PropertiesProxy>
2019-03-27 14:18:08,141 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=conf
2019-03-27 14:18:08,142 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:08,143 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'conf'<class org.nutz.ioc.impl.PropertiesProxy>
2019-03-27 14:18:08,144 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'conf' to [app] 
2019-03-27 14:18:08,147 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2019-03-27 14:18:08,419 org.nutz.resource.Scans.scan(Scans.java:280) DEBUG - Found 1 resource by src( custom/weixin.properties ) , regex( ^.+[.]properties$ )
2019-03-27 14:18:08,425 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:114) DEBUG - load properties from File[D:\worker\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbookTest\WEB-INF\classes\custom\weixin.properties]
2019-03-27 14:18:08,793 org.nutz.weixin.util.Wxs.check(Wxs.java:246) WARN  - bad check : signature=null,timestamp=null,nonce=null
2019-03-27 14:18:08,793 org.nutz.weixin.util.Wxs.handle(Wxs.java:676) INFO  - token is invalid

token is invalid

token没配好哦

我把消息加密改成明文之后再微信发信息控制台没反应了,访问/nutzbook/weixin/msgin

 2019-03-27 14:18:07,827 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/weixin/msgin : WeixinModule.msgin(WeixinModule.java:26)
2019-03-27 14:18:07,836 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'weixinModule'<class net.wendal.nutzbook.weinModel.WeixinModule>
2019-03-27 14:18:07,838 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=weixinModule
2019-03-27 14:18:07,838 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(weixinModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,839 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'weixinModule'<class net.wendal.nutzbook.weinModel.WeixinModule>
2019-03-27 14:18:07,840 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'weixinModule' to [app] 
2019-03-27 14:18:07,842 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class net.wendal.nutzbook.weinModel.WeixinModule without AOP
2019-03-27 14:18:07,889 org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:64) DEBUG - name=defaultWxHandler not found, search for type=net.wendal.nutzbook.WxHandler.DefaultWxHandler
2019-03-27 14:18:07,890 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,891 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(dao) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,906 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,907 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(userAction) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,907 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(weixinModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,908 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(userModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,908 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(WxHandler) in AnnotationIocLoader(packages=[et.wendal.nutzbook])
2019-03-27 14:18:07,910 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'WxHandler'<class net.wendal.nutzbook.WxHandler.DefaultWxHandler>
2019-03-27 14:18:07,910 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=WxHandler
2019-03-27 14:18:07,911 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(WxHandler) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,912 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'WxHandler'<class net.wendal.nutzbook.WxHandler.DefaultWxHandler>
2019-03-27 14:18:07,913 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'WxHandler' to [app] 
2019-03-27 14:18:07,913 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class net.wendal.nutzbook.WxHandler.DefaultWxHandler without AOP
2019-03-27 14:18:08,141 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'conf'<class org.nutz.ioc.impl.PropertiesProxy>
2019-03-27 14:18:08,141 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=conf
2019-03-27 14:18:08,142 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:08,143 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'conf'<class org.nutz.ioc.impl.PropertiesProxy>
2019-03-27 14:18:08,144 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'conf' to [app] 
2019-03-27 14:18:08,147 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2019-03-27 14:18:08,419 org.nutz.resource.Scans.scan(Scans.java:280) DEBUG - Found 1 resource by src( custom/weixin.properties ) , regex( ^.+[.]properties$ )
2019-03-27 14:18:08,425 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:114) DEBUG - load properties from File[D:\worker\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbookTest\WEB-INF\classes\custom\weixin.properties]
2019-03-27 14:18:08,793 org.nutz.weixin.util.Wxs.check(Wxs.java:246) WARN  - bad check : signature=null,timestamp=null,nonce=null
2019-03-27 14:18:08,793 org.nutz.weixin.util.Wxs.handle(Wxs.java:676) INFO  - token is invalid

我把消息加密改成明文之后再微信发信息控制台没反应了,访问/nutzbook/weixin/msgin

 2019-03-27 14:18:07,827 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/weixin/msgin : WeixinModule.msgin(WeixinModule.java:26)
2019-03-27 14:18:07,836 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'weixinModule'<class net.wendal.nutzbook.weinModel.WeixinModule>
2019-03-27 14:18:07,838 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=weixinModule
2019-03-27 14:18:07,838 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(weixinModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,839 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'weixinModule'<class net.wendal.nutzbook.weinModel.WeixinModule>
2019-03-27 14:18:07,840 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'weixinModule' to [app] 
2019-03-27 14:18:07,842 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class net.wendal.nutzbook.weinModel.WeixinModule without AOP
2019-03-27 14:18:07,889 org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:64) DEBUG - name=defaultWxHandler not found, search for type=net.wendal.nutzbook.WxHandler.DefaultWxHandler
2019-03-27 14:18:07,890 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,891 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(dao) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,906 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:07,907 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(userAction) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,907 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(weixinModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,908 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(userModule) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,908 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(WxHandler) in AnnotationIocLoader(packages=[et.wendal.nutzbook])
2019-03-27 14:18:07,910 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'WxHandler'<class net.wendal.nutzbook.WxHandler.DefaultWxHandler>
2019-03-27 14:18:07,910 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=WxHandler
2019-03-27 14:18:07,911 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(WxHandler) in AnnotationIocLoader(packages=[net.wendal.nutzbook])
2019-03-27 14:18:07,912 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'WxHandler'<class net.wendal.nutzbook.WxHandler.DefaultWxHandler>
2019-03-27 14:18:07,913 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'WxHandler' to [app] 
2019-03-27 14:18:07,913 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class net.wendal.nutzbook.WxHandler.DefaultWxHandler without AOP
2019-03-27 14:18:08,141 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'conf'<class org.nutz.ioc.impl.PropertiesProxy>
2019-03-27 14:18:08,141 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:191) DEBUG - 	 >> Load definition name=conf
2019-03-27 14:18:08,142 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2019-03-27 14:18:08,143 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:222) DEBUG - 	 >> Make...'conf'<class org.nutz.ioc.impl.PropertiesProxy>
2019-03-27 14:18:08,144 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'conf' to [app] 
2019-03-27 14:18:08,147 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) DEBUG - Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2019-03-27 14:18:08,419 org.nutz.resource.Scans.scan(Scans.java:280) DEBUG - Found 1 resource by src( custom/weixin.properties ) , regex( ^.+[.]properties$ )
2019-03-27 14:18:08,425 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:114) DEBUG - load properties from File[D:\worker\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbookTest\WEB-INF\classes\custom\weixin.properties]
2019-03-27 14:18:08,793 org.nutz.weixin.util.Wxs.check(Wxs.java:246) WARN  - bad check : signature=null,timestamp=null,nonce=null
2019-03-27 14:18:08,793 org.nutz.weixin.util.Wxs.handle(Wxs.java:676) INFO  - token is invalid

我是手动访问/nutzbook/weixin/msgin 并没有报文的所以没有token

没有达到预期自动回复方法里的消息的效果

那是不行的, 得打开调试模式, 在MainSetup/MainLuancher的init方法加一句 Wxs.DEV_MODE = true;

}
2019-03-27 14:30:43,954 net.wendal.nutzbook.WxHandler.DefaultWxHandler.text(DefaultWxHandler.java:33) INFO  - 1
2019-03-27 14:30:43,959 org.nutz.weixin.util.Wxs.asXml(Wxs.java:567) DEBUG - Outcome >>
<xml>
<ToUserName><![CDATA[oiDue5nKkbHxoD2b2buU9XJXQkYI]]></ToUserName>
<FromUserName><![CDATA[gh_f764b24e147f]]></FromUserName>
<CreateTime>1553668243</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[广告法说不能自称第一]]></Content>
</xml>
2019-03-27 14:31:13,846 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [POST] path=/weixin/msgin : WeixinModule.msgin(WeixinModule.java:26)
2019-03-27 14:31:13,847 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - Get 'weixinModule'<class net.wendal.nutzbook.weinModel.WeixinModule>
2019-03-27 14:31:13,866 org.nutz.weixin.util.Wxs.convert(Wxs.java:225) DEBUG - Income >> 
{
   "toUserName": "gh_f764b24e147f",
   "fromUserName": "oiDue5nKkbHxoD2b2buU9XJXQkYI",
   "createTime": "1553668029",
   "msgType": "text",
   "content": "2",
   "msgId": "22243176879343649"
}
2019-03-27 14:31:13,869 net.wendal.nutzbook.WxHandler.DefaultWxHandler.text(DefaultWxHandler.java:33) INFO  - 2
2019-03-27 14:31:13,870 org.nutz.weixin.util.Wxs.asXml(Wxs.java:567) DEBUG - Outcome >>
<xml>
<ToUserName><![CDATA[oiDue5nKkbHxoD2b2buU9XJXQkYI]]></ToUserName>
<FromUserName><![CDATA[gh_f764b24e147f]]></FromUserName>
<CreateTime>1553668273</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[就是这么2]]></Content>

填上这段代码就能出来

填上这段代码就能出来debug模式

DEBUG模式不校验token和签名

好的谢谢。大概知道什么问题了我怎么定义这种系统原有的例如 输入帮助 回应消息内容模板呢。有文档吗?

BasicWxHandler 有多个帮助方法

例如 text方法, 微信发文本信息的时候就会调用它, 返回的内容, 用Wxs.respXXX系列方法组装就行

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