关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 14901|回复: 4

[环境搭建] Restful风格请求报错 Missing or invalid X-AUTH-TOKEN header

[复制链接]
发表于 2018-10-17 10:34:16 | 显示全部楼层 |阅读模式
@Api(value="TbSbtz",description="设备台帐",tags="tbSbtzController")
@Controller
@RequestMapping("/tbSbtzController")
public class TbSbtzController extends BaseController {//此类中有下面的根据id获得编号的方法:

@RequestMapping(value = "getZcbhBySbtzId2/{id}", method = RequestMethod.GET)
        @ResponseBody
        public String getZcbhBySbtzId2(@PathVariable("id") String id){
                StringBuffer sb = new StringBuffer();
                try{
                        if(StringUtils.isNotEmpty(id)) {
                                TbSbtzEntity tbSbtz = tbSbtzService.get(TbSbtzEntity.class, id);
                                sb.append(tbSbtz.getZcbh());
                        }
                }catch(Exception e){
                        e.printStackTrace();
                }
                return sb.toString();
        }

jeecg3.7.2版本  登陆系统后用下面restful风格url请求访问
http://192.168.1.79:8080/sdaf/re ... 799016660e129850044
报错信息如下:
javax.servlet.ServletException: Missing or invalid X-AUTH-TOKEN header.
        at org.jeecgframework.jwt.aop.RestAuthTokenInterceptor.preHandle(RestAuthTokenInterceptor.java:49)
        at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:134)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:932)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:111)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        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)


发表于 2018-10-17 12:11:09 | 显示全部楼层
看常见问题贴
 楼主| 发表于 2018-10-17 14:58:53 | 显示全部楼层
admin 发表于 2018-10-17 12:11
看常见问题贴

常见问题贴中 第41条: jeecg restful请求如何访问?
只说 control的请求需要加上“rest/”前缀,我请求路径中加了这个前缀  依然报上述错误,不知何故?
 楼主| 发表于 2018-10-18 13:49:04 | 显示全部楼层
admin 发表于 2018-10-17 12:11
看常见问题贴

还请帮解决为盼呐!!!
发表于 2018-10-18 16:41:52 | 显示全部楼层
http://jeecg3.mydoc.io/
看: 专项功能介绍  -- 平台JWT接口文档
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表