有没有直接的方法来获取 glassfish 的完整 ejb/servlet 应用示例

Is there a direct way to get a full ejb/servlet application example for glassfish

我有一个应用程序目前在 JBoss AS 上 运行,但不适用于 Glassfish。我正在尝试阅读文档 here but I'm having trouble figuring out things like what the file structure of the application should be and what (if any) additional files are needed. This documentation also refers to examples but to get the examples you need to install Netbeans and access an update tool tied to the glassfish instance installed with Netbeans. When I do this the server won't start, the update tool won't run, and I can't get the examples. Is there an easy way to get these examples (e.g. a simple download)? I've found other examples such as this one,但它们也依赖于 Netbeans。

是否有一个简单而完整的 ejb/servlet Glassfish 示例,可以简单地下载并且不依赖于 Netbeans 或其他 IDE?

最明显的例子是Java EE CargoTracker。它的编写是为了展示使用纯 Java EE API 的 "real" 应用程序的外观,因此应该在 JBoss 和 GlassFish 上工作。您将需要安装 Maven 来构建和 运行 它,但是项目的自述文件中有更完整的详细信息。请注意,某些信息有点过时(主要是指向 java.net 的链接,该链接已被 GitHub 网站取代),但应用程序本身仍然是 [=18= 的一个很好的例子] EE 7 API。

https://github.com/javaee/cargotracker

我在 github 上找到了示例:

https://github.com/javaee/glassfish-samples

要获取和构建示例,您需要 Git 和 Maven。这些示例很小、完整且简明。对我的特定问题有帮助的例子是这个例子:

glassfish-samples\ws\javaee5\enterprise\servlet-stateless-ear

它表明我需要更改项目的结构,使 servlet 位于 .war 文件中,而不是位于项目 lib 文件夹中的 .jar 文件中。