liukefu2050 opened a new issue, #10459: URL: https://github.com/apache/dubbo/issues/10459
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy --> ### Environment * Dubbo version: 3.0.10 * Operating System version: win7 * Java version: 1.8 ### Steps to reproduce this issue ```java @SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class) @Slf4j @EnableJpaRepositories(basePackages = "com.xiushang") //用于扫描Dao @Repository @EntityScan("com.xiushang.entity") //用于扫描JPA实体类 @Entity @ServletComponentScan(basePackages = {"com.xiushang.filter"}) @EnableRedisHttpSession @EnableDubbo @EnableTransactionManagement(proxyTargetClass = true) public class AdminApplication extends SpringBootServletInitializer { public static void main(String[] args) throws Exception { ConfigurableApplicationContext application = SpringApplication.run(AdminApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(AdminApplication.class); } } ``` ``` @DubboService(interfaceClass=CustomService.class,filter = "userFilter",retries = 0) public class CustomServiceImpl extends BaseServiceImpl<CustomEntity> implements CustomService { @Transactional(readOnly = true) public PageTableVO findPageList(CustomSearchVo searchPageVo) { ... Page<CustomEntity> page = findPageList(ex, searchPageVo.createPageRequest(new Sort.Order(dir, "lastContactDate"))); LazyLoadUtil.fullLoad(page); PageTableVO vo = new PageTableVO(page, searchPageVo); return vo; } } ``` 代码使用了JPA,CustomEntity 中有延迟加载的属性,因此需要session ### Expected Behavior 能正常返回,并延迟加载 CustomEntity中所有属性 <!-- What do you expect from the above steps?--> ### Actual Behavior could not initialize proxy - no Session <!-- What actually happens? --> If there is an exception, please attach the exception trace: ``` amic=true, service.filter=userFilter, anyhost=true},}, cause: org.apache.dubbo.remoting.RemotingException: Failed to send response: Response [id=6, version=2.0.2, status=20, event=false, error=null, result=AppResponse [value=com.xiushang.framework.entity.vo.PageTableVO@6fc8a7cf, exception=null]], cause: java.lang.RuntimeException: failed to lazily initialize a collection of role: com.xiushang.entity.shop.ShopEntity.images, could not initialize proxy - no Session Java field: private java.util.List com.xiushang.entity.shop.ShopEntity.images Java field: private com.xiushang.entity.shop.ShopEntity com.xiushang.entity.custom.CustomGroupEntity.belongShop Java field: private java.util.List com.xiushang.entity.custom.CustomEntity.groupList Java field: private java.util.List com.xiushang.framework.entity.vo.PageTableVO.rowData java.lang.RuntimeException: failed to lazily initialize a collection of role: com.xiushang.entity.shop.ShopEntity.images, could not initialize proxy - no Session Java field: private java.util.List com.xiushang.entity.shop.ShopEntity.images Java field: private com.xiushang.entity.shop.ShopEntity com.xiushang.entity.custom.CustomGroupEntity.belongShop Java field: private java.util.List com.xiushang.entity.custom.CustomEntity.groupList Java field: private java.util.List com.xiushang.framework.entity.vo.PageTableVO.rowData at com.alibaba.com.caucho.hessian.io.JavaSerializer$FieldSerializer.serialize(JavaSerializer.java:304) at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeInstance(JavaSerializer.java:284) at com.alibaba.com.caucho.hessian.io.JavaSerializer.writeObject(JavaSerializer.java:251) at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:412) at org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectOutput.writeObject(Hessian2ObjectOutput.java:92) at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.encodeResponseData(DubboCodec.java:225) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeResponse(ExchangeCodec.java:309) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:73) at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:47) at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:69) at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ``` 请问最新版本dubbo 不是已经解决了DubboService 和 @Transactional 的问题吗,我是缺少了什么配置吗 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
