引入cuba-core-7.2.13.jar 后 项目就一直报EntityOp 找不到的问题 启动不起来??

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/D:/StudioProjects/wechat/deploy/tomcat/shared/lib/cuba-core-7.2.13.jar!/com/haulmont/cuba/security/app/role/FilterRoleDefinition.class]; nested exception is java.lang.NoClassDefFoundError: [Lcom/haulmont/cuba/security/entity/EntityOp;

怎么引入的?

最开始的问题是在task定时任务里 加入dataManager.loadValue();
报No security context bound to the current thread

后面通过
方法一:
build.gradle()中runtime(‘com.haulmont.cuba:cuba-core:7.2.13’)

authentication.begin();与end()

问题没解决

方法二:手动加入

UserSession anonymousSession = trustedClientService.getAnonymousSession(restApiConfig.getTrustedClientPassword(),
                restApiConfig.getSecurityScope());

        AppContext.setSecurityContext(new SecurityContext(anonymousSession));

问题没解决

然后就出现目前缺少 EntityOP的问题

代码都回退 缺少 EntityOP的问题依然存在 项目已清理缓存 开发工具也重启了 问题还在

cuba-core 这个包不需要在 build.gradle 里显式引入,删掉 gradle 中引入的那行试试。

方法二应该是对的。

如果还不解决问题,用下面的方法把测试项目打包传上来,我们给你看看
image

你可能需要执行 CUBA->Build Tasks->Undeploy 然后再运行。我针对你的项目做了点修改,可以参考我的附件:

  1. 数据库我改成 HSQL 了。如果你直接用我的项目,需要手动改回来。
  2. 将 datamanager 加载数据的部分放到了 Service 里面。这样耦合度低一些,也是 cuba 推荐的使用方式。
  3. 在 backupWeChat() 里面加上了 security 部分的代码。

目前是可以正常运行的,但是我的数据库没有数据,输出如下:

Apr 08, 2021 4:53:25 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Apr 08, 2021 4:53:25 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [22097] milliseconds
16:53:26.363 INFO  c.d.wechat.task.AutoBackUpAuditTask     - logback start backup seq start with:-1,corp id:1
16:53:26.371 INFO  c.d.wechat.task.AutoBackUpAuditTask     - logback start backup seq start with:-1,corp id:2
16:53:26.378 INFO  c.d.wechat.task.AutoBackUpAuditTask     - logback start backup seq start with:-1,corp id:3

wechat.zip (2.5 MB)

好的 感谢支持