javax.persistence.Persistence.createEntityManagerFactory 不与 ClassGuard 一起使用

发布于 2024-10-14 07:28:54 字数 673 浏览 4 评论 0原文

我只是看了一下ClassGuard(虽然我知道一些反对)。

但是,我得到一个 javax.persistence.PersistenceException: [PersistenceUnit: MyPU] class or package not found ,如果没有 ClassGuard,我就不会得到这个异常。

当找不到我的 @PersistenceUnit(unitName = "MyPU") 带注释的类时,该异常是由 java.lang.ClassNotFoundException 引起的。

ClassGuard 重写类加载器来加载加密的类文件。因此这可能是一个问题。

我可以将 ClassGuard 与 JPA 一起使用吗?

不幸的是,我在网络上找不到任何相关信息或邮件列表。由于 ClassGuard 在这里被推荐了几次,我想我应该尝试一下......

谢谢
麦克风

I just take a look at ClassGuard (although I know some objection to it).

However I get a javax.persistence.PersistenceException: [PersistenceUnit: MyPU] class or package not found that I do not get without ClassGuard.

The Exception is caused by a java.lang.ClassNotFoundException when my @PersistenceUnit(unitName = "MyPU") annotated class is not found.

ClassGuard overrides the class loader to load encrypted class files. Hence this may be a problem.

Can I even use ClassGuard together with JPA?

Unfortunately I could not find any related information or mailing lists on the web. And since ClassGuard was recommended here on SO a few times, I thought I give it a try...

Thanks
Mike

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

错爱 2024-10-21 07:28:54

classguard 不存在您在“反对”链接中提到的问题,因为加密是在本机代码中进行的。唯一的破解方法是通过本机调试器。但是,通过围绕它们构建良好的许可解决方案,并以核心业务逻辑驻留在服务器库中的方式对可分发程序进行分层,我想这应该不是什么太大的问题。

希望您将 JVM arg 设置为使用 ClassGuard 类加载器。
java ........ -Djava.system.class.loader=net.jsecurity.classguard.bootstrap.ClassGuard .......

但是,如果您使用大量反射并混合加密和加密,未加密的类您可能最终会遇到麻烦,我目前正在与它们一起解决。

classguard does not have the problem you have mentioned in "objection" link since the encryption is in native code. Only way to hack is through native debugger. But with good licensing solution built around them and layering the distributable in such a way that core business logic resides in server library, it should not be too much of an issue I guess.

Hope you are setting the JVM arg to use ClassGuard classloader.
java ........ -Djava.system.class.loader=net.jsecurity.classguard.bootstrap.ClassGuard .......

However, if you use heavy reflection and mix up encrypted & un-crypted classes you might end up in trouble which I am currently sorting out with them.

嗳卜坏 2024-10-21 07:28:54

这就是它最终所做的。 (剧透:这不是一个解决方案,而是一个解决方案。)

我将持久性内容分解到另一个 .jar 文件中,并且让 ClassGuard 不打乱它。工作得很好。

So here is what it did in the end. (Spoiler: Not a solution more a work around.)

I factored out the persistence stuff into another .jar file and had ClassGuard just not scramble it. Worked pretty well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文