当前位置: 代码迷 >> 综合 >> com.alibaba.dubbo.rpc.RpcException: Forbid consumer 192.168.25.1 access service com.test.service.Use
  详细解决方案

com.alibaba.dubbo.rpc.RpcException: Forbid consumer 192.168.25.1 access service com.test.service.Use

热度:29   发布时间:2023-12-04 23:36:22.0

导致这个问题的原因是alibaba的@Service注解和@Transactional冲突

解决办法

1、将@Service注解修改为spring提供的@Service

2、添加如下配置文件

applocationContext_dubbo.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.2.xsdhttp://code.alibabatech.com/schema/dubbohttp://code.alibabatech.com/schema/dubbo/dubbo.xsd"><!-- 声明需要暴露的服务接口 --><!-- <dubbo:service interface="com.huarui.cart.service.CartService" ref="CartServiceImpl" timeout="600000"/> --><!-- <dubbo:service interface="com.huarui.sso.service.TbUserService" ref="TbUserServiceImpl" timeout="600000"/> --><!-- <dubbo:service interface="com.huarui.search.service.SearchItemService" ref="SearchItemServiceImpl" timeout="600000"/> --><dubbo:service interface="com.test.service.UserService" ref="userServiceImpl" timeout="600000"/></beans>

3、在入口程序添加如下注解,去扫描配置文件

 

  相关解决方案