如何在 NetBeans 8.2 和 GlassFish 4.1.1 中同时部署 EJB 和 War 模块

How to deploy EJB and War modules at same time in NetBeans 8.2 and GlassFish 4.1.1

我在 GlassFish 4.1.1 上的 NetBeans 8.2 中同时部署 EJB 和 WAR 模块时遇到问题。显示以下消息:

[[ Exception Occurred :Error occurred during deployment: Exception while preparing the app : Could not resolve a persistence unit corresponding to the persistence-context-ref-name [ejb.NewMessage/em] in the scope of the module called [TestEJB-ejb]. Please verify your application.. Please see server.log for more details.]]

当我检查 GlassFish 服务器的 server.log 文件时,我遇到了以下错误消息:

[2018-07-28T12:59:45.406+0430] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=427 _ThreadName=admin-listener(7)] [timeMillis: 1532766585406] [levelValue: 1000] [[
  Exception while preparing the app : Could not resolve a persistence unit corresponding to the persistence-context-ref-name [ejb.NewEntityFacade/em] in the scope of the module called [TestEJB-ejb]. Please verify your application.]]

有解决办法吗?

感谢您的帮助。

如果您没有开始创建您的应用程序或者如果您没有选择您的编程框架,您可以切换到 Java Spring 以减少头痛!

阅读以下第一段link: https://en.wikipedia.org/wiki/Spring_Framework