Skip to main content

Developing Java EE 6 Applications With TomEE and NetBeans

I've found that one of the most productive ways of developing Java EE applications is by using NetBeans and the TomEE application server.  For those of you that haven't used TomEE before, it's a Java EE 6 Web Profile certified stack that sits on top of Apache Tomcat.

As TomEE is Java EE 6 web profile certified, it supports the following technologies (all via Apache products) out of the box:
  • CDI
  • EJB
  • JPA
  • JSF
  • JSP
  • JSTL
  • JTA
  • Servlet
  • Javamail
  • Bean Validation

If you want / need to use JMS or JAX-RS/WS, then there's an additional distribution called TomEE+ that provides support for these features.

I prefer to use Maven for project management / builds / testing etc which integrates well with NetBeans.

Using NetBeans, you can easily create a TomEE compatible Maven project by creating a new Maven Project from Archetype within the NetBeans New Project wizard.


The "tomee-webapp-archetype" will create a basic Web Application that's defined and ready to deploy against TomEE.

Within the generated pom.xml file, we can see the important TomEE specific aspects are the use of OpenEJB for the EE api's

<dependency>
  <groupId>org.apache.openejb</groupId>
  <artifactId>javaee-api</artifactId>
  <version>6.0-4</version>
  <scope>provided</scope>
</dependency>

and the use of the TomEE Maven plugin

<plugin>
  <groupId>org.apache.openejb.maven</groupId>
  <artifactId>tomee-maven-plugin</artifactId>
  <version>1.0.1</version>
</plugin>

Using the TomEE Maven plugin allows the project to be built and deployed to TomEE (without having to download TomEE!). This is useful for building and compiling from the command line. To get Maven to download TomEE, deploy your project to it and then start TomEE up, use the command

mvn tomee:run

Having said that, I prefer to use NetBeans to control running my projects as this provides more advanced features such as hot deployment of JSP/JSF, controlled execution of tests etc.

To run the project from within NetBeans, simply open up the pom.xml from the File | Open Project wizard in NetBeans. NetBeans is clever enough to open Maven projects which then function just like a standard NetBeans project. Select the "Run" option and NetBeans will ask which application server to run the application on. The is no direct support for TomEE, (i.e. you don't see an Application Server of type TomEE in the NetBeans server configuration page) but since TomEE is based on Tomcat, to define a TomEE server, you just need to create a "Apache Tomcat" server and specify the server location to that of a previously downloaded TomEE instance.

That's pretty much all that is involved in getting up and running with TomEE and NetBeans. TomEE offers a fast Java EE 6 certified stack that provides for rapid development and deployment of applications, whereas NetBeans 7.3 provides excellent tooling to support TomEE and Java EE development.

Comments

  1. [...] I've found that one of the most productive ways of developing Java EE applications is by using NetBeans and the TomEE application server. For those of you that haven't used TomEE before, it's a Ja...  [...]

    ReplyDelete

Post a Comment

Popular posts from this blog

Creating a Joke Application in React

Introduction I've recently started learning React. I've been a backend developer for a long time, but have started to love doing client side work. As they say, the best way to learn is to practise. So here is a simple joke application that I've written in React. The source code for the application can be found on GitHub at: https://github.com/doobrie/react-joke Creating the project Whilst practising, I've quite often created projects from scratch, but this is quite tedious as the same steps need to be taken for each project. I needed to create the project structure, configure Babel, write some control scripts etc. Instead of doing that this time, I've used the create-react-app tool to scaffold the basics of an application. npx create-react-app This sets up everything that you need to get started with a React app. Coding As this is a simple project, I've created one react component, function app() . I've created this as a functional c...

Changing Default Search Provider in Firefox on Linux Mint

On Linux Mint, the default version of Firefox is installed and configured to allow the following search engines to be queried directly from the address bar: Yahoo! Startpage DuckDuckGo Wikipedia Mint defines these as the default available set of search engines based upon 3 criteria (funding to Linux Mint, privacy support and whether the search engine is non-commercial). Other search engines such as Google, Bing or Twitter, etc. can easily be added into the default version of Firefox however. To add a different search provider, browse to Search Engines At the bottom of the page, click on the icon of the requested search engine, then click on the ... button in the URL bar and select the Add Search Engine option. You then have the option to change the default search engine within Firefox preferences to your new choice.

The new Eclipse logo

In a blog post today, Ian Skerrett has announced the new logo for Eclipse. Last fall we [The Eclipse Foundation] started a process to  update the Eclipse logo . The existing logo had not been change since Eclipse was launched and it was showing its age. I am happy to announce we have finished the process and am pleased to introduce the updated Eclipse logo. The new logo has a fresh modern look to it, which I think is a good improvement and will stand Eclipse in good stead for the future. The new logo will be included with the next Eclipse release train, Luna, and gradually rolled out across the Eclipse site and projects. What do you think?  Do you like the new logo?  Add your comments below.