tiankongzhichenglyf
tkzc_shark
采纳率0%
2021-04-08 12:23

jeecgboot 使用SAAS多租户开发环境正常,部署生产环境报错

20
已结题

 报错信息

Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in file [/usr/local/tomcat/webapps/gas/WEB-INF/classes/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml]
### The error may involve org.jeecg.modules.system.mapper.SysDictMapper.queryTableDictItemsByCode
### The error occurred while executing a query
### Cause: java.lang.NullPointerException
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
        at sun.reflect.GeneratedMethodAccessor2583.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
        ... 133 common frames omitted
Caused by: java.lang.NullPointerException: null
        at net.sf.jsqlparser.expression.LongValue.<init>(LongValue.java:25)
        at org.jeecg.config.mybatis.MybatisPlusConfig$1.getTenantId(MybatisPlusConfig.java:82)
.
.
.
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in URL [jar:file:/usr/local/tomcat/webapps/gas/WEB-INF/lib/hibernate-re-2.3.01.jar!/org/jeecg/modules/online/cgform/mapper/xml/OnlCgformFieldMapper.xml]
### The error may involve org.jeecg.modules.online.cgform.mapper.OnlCgformFieldMapper.selectPageBySql
### The error occurred while executing a query
### Cause: java.lang.NullPointerException
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
        at sun.reflect.GeneratedMethodAccessor2583.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
        ... 135 common frames omitted
Caused by: java.lang.NullPointerException: null
        at net.sf.jsqlparser.expression.LongValue.<init>(LongValue.java:25)
        at org.jeecg.config.mybatis.MybatisPlusConfig$1.getTenantId(MybatisPlusConfig.java:82)

tenant_id设值,JwtFilter.java

/**
     * 对跨域提供支持
     */
    @Override
    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
        if(allowOrigin){
            httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin"));
            httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE");
            httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers"));
            //update-begin-author:scott date:20200907 for:issues/I1TAAP 前后端分离,shiro过滤器配置引起的跨域问题
            // 是否允许发送Cookie,默认Cookie不包括在CORS请求之中。设为true时,表示服务器允许Cookie包含在请求中。
            httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true");
            //update-end-author:scott date:20200907 for:issues/I1TAAP 前后端分离,shiro过滤器配置引起的跨域问题
        }
        // 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态
        if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) {
            httpServletResponse.setStatus(HttpStatus.OK.value());
            return false;
        }
        //update-begin-author:taoyan date:20200708 for:多租户用到
        String tenant_id = httpServletRequest.getHeader(CommonConstant.TENANT_ID);
        TenantContext.setTenant(tenant_id);
        //update-end-author:taoyan date:20200708 for:多租户用到
        return super.preHandle(request, response);
    }

报错位置

 

  • 点赞
  • 收藏
  • 复制链接分享

4条回答

  • zhangxin0w0 BCS-点心 8天前

    jeecgboot的问题比较小众了,建议你先去官方问问看,我还没用到租户

    点赞 1 评论 复制链接分享
  • tiankongzhichenglyf tkzc_shark 8天前

    没办法,重新改造多租户

    点赞 评论 复制链接分享
  • QA_Assistant 有问必答小助手 8天前

    您好,我是有问必答小助手,你的问题已经有小伙伴为您解答了问题,您看下是否解决了您的问题,可以追评进行沟通哦~

    如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

    ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

    点赞 评论 复制链接分享
  • qq_23126581 郭老师的小迷弟雅思莫了 8天前

    SysDictMapper.xml   这个queryTableDictItemsByCode   这个查询空指针了,你参数没传进来

     

    点赞 评论 复制链接分享

为你推荐