简体   繁体   English

Java EE App Server Hello World

[英]Java EE App Server Hello World

I am fairly comfortable with standalone Java app development, but will soon be working on a project using a Java EE application server. 我对单独的Java应用程序开发非常熟悉,但很快就会使用Java EE应用程序服务器开发项目。

Does anyone know of a straightforward how-to tutorial to getting a hello-world type application working in an application server? 有没有人知道在应用服务器中使用hello-world类型应用程序的直接操作指南? I'm (perhaps naievly) assuming that the overall approach is similar between different frameworks, so I'm more interested in finding out the approach rather than getting bogged down in differences between the different frameworks. 我(也许是天真地)假设不同框架之间的整体方法是相似的,所以我更感兴趣的是找出方法而不是陷入不同框架之间的差异。

If you are not aware of a good guide, then could you post bullet-point type steps to getting a hello-world running?, ie 如果你不知道一个好的指南,那么你可以发布一个项目符号的步骤来让你的世界运行吗?

  1. Download XX 下载XX
  2. Write some code to do YY 写一些代码来做YY
  3. Change file ZZ 更改文件ZZ
  4. Other steps... 其他步骤......

Note: Just because I have a windows machine at home, I would prefer to run if this could be run on windows, but in the interest of a better answer, linux/mac based implementations are welcome. 注意:仅仅因为我家里有一台Windows机器,如果可以在Windows上运行,我宁愿运行,但为了更好的答案,基于linux / mac的实现是受欢迎的。

I would choose JBoss AS or GlassFish for a start. 我会选择JBoss AS或GlassFish作为开始。 However I'm not sure what you mean by Java EE "Hello World". 但是我不确定Java EE“Hello World”是什么意思。 If you just want to deploy some JSP you could use this tutorial (for JBoss): 如果您只想部署一些JSP,可以使用本教程(对于JBoss):

http://www.centerkey.com/jboss/ http://www.centerkey.com/jboss/

If you want to get further and do the EJB stack and/or deploy an ear-file, you could read the very good JBoss documentation: 如果你想进一步做EJB堆栈和/或部署ear-file,你可以阅读非常好的JBoss文档:

Installation Guide 安装指南

Getting started 入门

Configuration Guide 配置指南

In general you could also just do the basic installation and change or try the pre-installed example applications. 通常,您也可以执行基本安装并更改或尝试预安装的示例应用程序。

I currently have JBoss installed (on windows). 我目前安装了JBoss(在Windows上)。 I develop with Eclipse and use the Java EE server integration to hot deploy or debug my code. 我使用Eclipse开发并使用Java EE服务器集成来热部署或调试我的代码。 After you get your first code running you realy should have a look at the ide integration since it makes development/deploy roundtrips so much faster. 在您运行第一个代码之后,您应该看看ide集成,因为它可以更快地进行开发/部署往返。

The JavaEE (they dropped the 2) space is pretty big. JavaEE(他们放弃了2)空间非常大。 A good tutorial to start is the one from Sun . 一个很好的教程就是来自Sun的教程。 For a simple hello world application, the web container only would suffice. 对于一个简单的hello world应用程序,web容器就足够了。 A well known servlet jsp container is tomcat. 一个众所周知的servlet jsp容器是tomcat。 See here for installation instructions. 请参阅此处获取安装说明。 Try installing it with eclipse and create a web project. 尝试使用eclipse安装它并创建一个Web项目。 This will generate some files for you that you can look at and edit. 这将为您生成一些您可以查看和编辑的文件。 Also starting and stopping the application server is simpler. 启动和停止应用程序服务器也更简单。

Another option is to get Oracle JDeveloper (free to download and use - it's a full featured IDE that includes some neat extras like the SQL workbench and BPEL designer). 另一个选择是获得Oracle JDeveloper (免费下载和使用 - 它是一个功能齐全的IDE,包括一些简洁的附加功能,如SQL工作台和BPEL设计器)。

As a learning tool, it is quite good, not only for the tutorials available from Oracle, but it includes a range of "cue-card" lessons in the tool itself to teach many common techniques. 作为一种学习工具,它非常好,不仅适用于Oracle提供的教程,而且它还包含一系列“提示卡”课程,用于教授许多常用技术。

cue card view http://tardate.heroku.com/images/jdev-cuecards.jpg 提示卡视图http://tardate.heroku.com/images/jdev-cuecards.jpg

If you haven't gone near NetBeans in a while its catching up with Eclipse very fast and worth a look, especially when starting Java EE. 如果你有一段时间没有接近NetBeans,那么赶快使用Eclipse并且值得一看,特别是在启动Java EE时。

Version 6.x installs Tomcat and/or Glassfish for you and then provides wizards to create/deploy/redeploy applications. 版本6.x为您安装Tomcat和/或Glassfish,然后提供用于创建/部署/重新部署应用程序的向导。

The initial tutorial on Web Applications is here and a more complex example here . 在Web应用程序的初始教程是在这里和更复杂的例子在这里

As JeroenWyseur puts it, Java EE is a fairly big space. 正如JeroenWyseur所说,Java EE是一个相当大的空间。 In addition to what he said, you should try to get more details of what exactly you'll be doing: servelts & co, EJB (entity, session, message beans?) and try to get familiar with that. 除了他所说的,你应该尝试获得更多关于你将要做什么的细节:servelts&co,EJB(实体,会话,消息bean?)并尝试熟悉它。

It should be clear for you that your code runs in a managed environment, which imposes a lot of constraints. 您应该清楚,您的代码在托管环境中运行,这会产生很多约束。 in order to make sure you understand what happens you should get familiar with the concept of deployment. 为了确保您了解会发生什么,您应该熟悉部署的概念。 Then, if you do EJBs, transaction management is important too. 然后,如果您执行EJB,事务管理也很重要。 If you don't understand exactly what happens when a bean or a servlet is deployed, how transactions are managed, how beans are invoked, you're going to have a hard time. 如果您不完全了解在部署bean或servlet时会发生什么,管理事务的方式,如何调用bean,那么您将会遇到困难。

A book that helped me a lot back in the time is Mastering EJB, by Ed Roman. 一本帮助我很多时光的书是由Ed Roman掌握的Mastering EJB。

Also, getting familiar with RMI will help you understand EJBs. 此外,熟悉RMI将帮助您理解EJB。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM