电商项目遇到的问题

  1. 500错误

    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException

    暂时没明白,可能跟dubbo中间件有关,重启下服务器就好了

  2. 400错误

    The server cannot or will not process the request due to something that is perceived to be a client error

    参数类型问题,在传参过程中,后台接收的代码是

    @RequestBody TbBrand brand

    而前端传递的是空值。

  3. 前端js中发送post请求后无法调用success方法,原因:js的Service中定义了方法没有返回值(没有return);

  4. 配置Spring Security后启动tomcat一直失败,两个原因,第一:xml文件中配置登录页面时前面少了“/”。第二,web.xml配置文件中过滤器的名称一定要为springSecurityFilterChain。

  5. Spring Security配置form-login标签时,最好把username-parameter和password-parameter都指定一下

  6. 重大bug:idea里改完js文件后先保存下(其他文件也一样把),否则可能会没有更新。

  7. 在dubbo框架中,通过配置的方式注入远程的bean。主要为了解决在Web层配置Spring Security时,在自定义认证类中需要用到Service,但使用@Reference注解无法注入,采用配置的方式,在Security的xml配置文件中先引用dubbo服务

    <dubbo:application name=“pinyougou-shop-web”/>
    <dubbo:registry address=“zookeeper://192.168.200.131:2181”/>

    然后配置远程的Service

    <dubbo:reference interface=“com.pinyougou.sellergoods.service.SellerService” id=“sellerService”></dubbo:reference>

    最后使用set方式注入

    < bean id=“userDetailsService” class=“com.pinyougou.shop.service.UserDetailsServiceImpl”>
    < property name=“sellerService” ref=“sellerService”></ property>
    </ bean>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值