用于在 NetBeans 中对指向错误域的会话 bean 进行单元测试的嵌入式 GlassFish 容器
我已经为我创建的几个会话 bean 编写了单元测试。然而,当我尝试运行它们时,NetBeans 给出以下错误:
没有可用的 EJBContainer 提供程序。以下提供程序:org.glassfish.ejb.embedded.EJBContainerProviderImpl 从 createEJBContainer 调用返回 null。
我高度怀疑这是问题的根本原因:
严重:EJB6004:指定的应用程序服务器安装位置 [C:\Development\GlassFish\3.1\glassfish\domains\domain1] 不存在。
是的。域 1 不存在。我自己创建了一个“开发”域并删除了domain1,但似乎有一个挥之不去的参考,我不知道在哪里修改它。嵌入式容器所引用的非嵌入式容器也在 NetBeans 中注册,并正确连接到开发域。项目正常部署没有问题。
非常感谢任何帮助!
I have written unit tests for several session beans I have created. When I try to run them, however, NetBeans gives me the following error:
No EJBContainer provider available. The following providers: org.glassfish.ejb.embedded.EJBContainerProviderImpl returned null from createEJBContainer call.
I highly suspect that this is the root cause of the issue:
SEVERE: EJB6004:Specified application server installation location [C:\Development\GlassFish\3.1\glassfish\domains\domain1] does not exist.
It's right. Domain1 does not exist. I created a "development" domain myself and deleted domain1 but it seems there is a lingering reference of which I have no clue where to modify it. The non-embedded container the embedded container is referring to is registered in NetBeans as well and correctly hooked up to the development domain. There are no problems with regular deployments of the project.
Any help very much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信分散战争已经过时了。经过大量搜索后,我发现了这篇非常有用的帖子 GlassFish 开源版本 3.1 的嵌入性快速介绍,其中提供了以下代码片段:
import org.glassfish.embeddable.;
导入 org.glassfish.embeddable.archive.;
其他文档:Oracle GlassFish Server 3.1 嵌入式服务器指南 和更新后的 API。
I believe ScatteredWar is outdated. After a bunch of searching I found the incredibly helpful post Quick introduction to Embeddability of GlassFish Open Source Edition 3.1, which gives this snippet:
import org.glassfish.embeddable.;
import org.glassfish.embeddable.archive.;
Other docs: Oracle GlassFish Server 3.1 Embedded Server Guide and The updated API.
Adam Bien 和 Arun Gupta 谈论嵌入方法用于单元测试的 GlassFish。
主要部分是这样的:
另一种方法是使用 OpenEJB 进行单元测试,如下所示这将确保您遵守标准。 Adam 有一个关于设置的条目。
Adam Bien and Arun Gupta speak about ways to embed GlassFish for unit testing.
The main piece is this:
An alternative approach would be to use OpenEJB to do your unit testing, as this will ensure that you're sticking to standards. Adam as has has an entry on setting that up.