This article (updated for Eclipse Mars) looks at using WebSphere Developer Tools for Eclipse (typically known as WDT because it’s short and not a mile wide). Like in other articles in this series (see the sidebar for links), we’ll use a simple Hello World application so that we can show how to develop it using various development tools.

  1. The first steps are to download and install Eclipse IDE for Java EE Developers with WDT (don’t create a server yet).
  2. Once you have WDT installed (and the IDE running) the next step is to create a project. This is simple to do from the Web or Java EE perspectives using File > New > Web Project.
  3. In the new Project wizard, enter Hello World as the project name, ensure that the project template is Simple and the Programming Model is Java EE, and then click Next.

    Getting Started 1
  4. Ensure Deployment is selected and by Target Runtime click New….
  5. Select WebSphere Application Server Liberty Profile and click Next.

    Getting Started 2
  6. Enter the path to your WAS Liberty installation and click Finish. If you don’t yet have WAS Liberty installed, you can select Install from an archive or a repository then click Next.

    Getting Started 3
  7. Enter the location in which you would like to install WAS Liberty then select where you would like to install it from. If you have not downloaded it already, select Download and install a new runtime environment from: to display the runtime options available from the Liberty Repository. Select the V8.5.5.x version then click Next.
    If you select Full Platform, you will have to configure the server.xml file in the server you create in Step 17.

    Getting Started 4
  8. You don’t need to install any add-ons for this application so just click Next again, then accept the licence and click Finish. When WAS Liberty has been installed and the server created, you’re returned to the New Web Project wizard.
  9. Clear the Add project to an EAR check box and click Finish.
    Getting Started 5
  10. To create the simple JSP used in this example, right-click the Hello World project and click New > Web Page.
  11. Enter index.jsp as the File name and ensure that Basic Templates > JSP is selected. Click Finish.

    Getting Started 6

    WDT will create and open the JSP for you.
  12. First of all, let’s give the JSP an appropriate title. To do this, update index to be Hello World
  13. Between the <body> and </body> tags add:
    <h1>Good <% if (new GregorianCalendar().get(Calendar.HOUR_OF_DAY) < 12) {%><br />Morning<br /><% } else { %><br />Afternoon<br /><% } %></h1>

    WDT will automatically add imports to the JSP for the Java classes being used if you press CTRL-Space (CMD-Space on a mac) after typing the class name. This will add the following imports at the top of the jsp file:

    <%@page import="java.util.Calendar"%>
    <%@page import="java.util.GregorianCalendar"%>
  14. Save the file. We are now ready to deploy our application.
  15. Right click on Hello World and select Run As > Run on Server.
  16. Since no server has been defined to the IDE we need to define one. Select Manually define a new server and select IBM > WebSphere Application Server Liberty Profile and click Next.

    Getting Started 7
  17. Click Finish.

    Getting Started 8

WDT will launch deploy the application, start the server, and open the web page in the integrated web browser for you:


Screenshot from 2015-01-21 18:37:11

Not only that but it’ll run the application from the Eclipse workspace, to give you the fastest edit, compile, run, debug cycle possible.

49 Comments on "Get started with a Hello World app on Liberty using WebSphere Developer Tools for Eclipse"

  1. Tried to drag and drop installer on toolbar of Eclipse Kepler JEE and get the following errors during install:

    Cannot complete the install because one or more required items could not be found.
    Software being installed: WebSphere® Application Server Liberty Tools 16.0.3000.v20160908_1547 (com.ibm.websphere.wdt.server.tools.main.feature.group 16.0.3000.v20160908_1547)
    Missing requirement: Swagger REST API UI plug-in 1.1.100.v20160602_2252 (com.ibm.etools.restapi.documentation.swagger.ui 1.1.100.v20160602_2252) requires ‘bundle org.eclipse.wst.server.core [1.6.0,2.0.0)’ but it could not be found
    Missing requirement: Swagger REST API UI plug-in 1.1.200.v20160908_1547 (com.ibm.etools.restapi.documentation.swagger.ui 1.1.200.v20160908_1547) requires ‘bundle org.eclipse.wst.server.core [1.6.0,2.0.0)’ but it could not be found
    Cannot satisfy dependency:
    From: Swagger REST API Definition Tools Feature 1.0.100.v20160602_2252 (com.ibm.etools.restapi.documentation.feature.feature.group 1.0.100.v20160602_2252)
    To: com.ibm.etools.restapi.documentation.swagger.ui [1.1.100.v20160602_2252]
    Cannot satisfy dependency:
    From: Swagger REST API Definition Tools Feature 1.0.200.v20160908_1547 (com.ibm.etools.restapi.documentation.feature.feature.group 1.0.200.v20160908_1547)
    To: com.ibm.etools.restapi.documentation.swagger.ui [1.1.200.v20160908_1547]
    Cannot satisfy dependency:
    From: Swagger REST API Discovery Tools 1.0.0.v20151130_1844 (com.ibm.wdt.restapi.documentation.feature.feature.group 1.0.0.v20151130_1844)
    To: com.ibm.etools.restapi.documentation.feature.feature.group 0.0.0
    Cannot satisfy dependency:
    From: WebSphere® Application Server Liberty Tools 16.0.2000.v20160602_2252 (com.ibm.websphere.wdt.server.tools.feature.group 16.0.2000.v20160602_2252)
    To: com.ibm.wdt.restapi.documentation.feature.feature.group 1.0.0
    Cannot satisfy dependency:
    From: WebSphere® Application Server Liberty Tools 16.0.3000.v20160908_1547 (com.ibm.websphere.wdt.server.tools.feature.group 16.0.3000.v20160908_1547)
    To: com.ibm.wdt.restapi.documentation.feature.feature.group 1.0.0
    Cannot satisfy dependency:
    From: WebSphere® Application Server Liberty Tools 16.0.3000.v20160908_1547 (com.ibm.websphere.wdt.server.tools.main.feature.group 16.0.3000.v20160908_1547)
    To: com.ibm.websphere.wdt.server.tools.feature.group 16.0.2000

    Any suggestions would be appreciated!

  2. Hi,
    Issue “Could not connect to any download sites. Check your internet connection and try again.” when step-7 is being followed.

    Please help on that.

    Note: Internet connection is working fine

  3. Getting to this tutorial wasn’t easy, but this tutorial was well written!

  4. Excellent tutorial – thank you! Instructions were clear, everything worked great for me.

  5. On Mac OSX I used Control+Space because Command+Space launches Spotlight Search.

  6. There was no selection for Simple Web Project (only Static or Dynamic) – after several iterations I settled for setting the server first then selecting Dynamic Web Project – that worked.

    • It sounds like you were on the File > New > Other dialog looking for a Simple Web Project to be listed, which isn’t what the article was leading you through. There should be choices for Static Web Project, Dynamic Web Project and Web Project within Eclipse once you have WDT installed. Once you select Web Project and click Next you should get the Simple Web Project option.

  7. Frederic Simard November 20, 2015

    It worked, but I had to change the address to:
    http://localhost:9080/HelloWorld/HelloWorld.jsp

    Otherwise, I was getting this error:

    Error 404: SRVE0190E: File not found: /

    Is it normal, should I be worried? I’m going to have to do some serious stuff with this and I’m afraid that I will run into a wall later, because of this apparently simple issue.

    • It looks like in step 11 you entered HelloWorld.jsp rather than index.jsp which is why it didn’t come up so this is perfectly normal. If the jsp isn’t listed as a welcome page then it wont be served from /. By default index.jsp is in the welcome page list which is why that would come up and your run through didn’t.

  8. 我在eclipse luna(windows7、oracle jdk8)下尝试了本例,成功了。但是liberty是离线下载的,下载地址:https://developer.ibm.com/wasdev/downloads/#asset/runtimes-8.5.5-wlp-javaee7,文件是wlp-javaee7-8.5.5.7.zip。

  9. I tried to follow the instructions to the letter (except for the buttons which seem to be in a different place in my eclipse) and at the end of it I failed to run due to the following error:

    [ERROR   ] CWWKS9582E: The [defaultSSLConfig] sslRef attributes required by the orb element with the defaultOrb id have not been resolved within 10 seconds. As a result, the applications will not start. Ensure that you have included a keyStore element and that Secure Sockets Layer (SSL) is configured correctly. If the sslRef is defaultSSLConfig, then add a keyStore element with the id defaultKeyStore and a password.

    I am new to WAS and Liberty so I’m not sure what to do with this and how to fix it.
    I searched for the error code but it got me nowhere.

    • You need to add configuration for a keystore. The server.xml for your server explains this. We are working to remove this need. Add this but enter your own password.

    • Working with Liberty version 8.5.5.6. I encountered same problem when I first performed tutorial by selecting the Liberty Full Profile (~95 MB download) for the runtime environment. I retried but downloaded the smaller Liberty Web Profile (~65 MB) runtime, which as of this date, does not appear to have the security component configured by default. Tutorial worked as published.

  10. Using eclipse Mars
    after the license terms I always get stuck with “New Remote Liberty Profile Server” and it is asking for authorization credentials. This happens even if I choose the Kernel or Runtime option and don’t select application security. Stuck.

    • Sorry, figured it out. If another adaptor (say Pivotal) was selected first, it might set the hostname to “Cloud”. When the adaptor “Websphere Liberty” is selcted on the first panel, you are NOT allowed to change the hostname. But if you select the folder name (such as IBM) you can change the name from Cloud to something else.

      If the hostname is localhost, all works. If the hostname isnt’ localhost, you get asked for credentials.

  11. Very good tutorial but in my case, Ctrl+Space didn’t work.
    What I had to add manually before html tag:

    • You can change your ctrl space to ctrl 6. becasue there is a conflict between Languadge setting and Content Asist

  12. Vijay Murugesan February 05, 2015

    Very nice. Worked perfectly. I just started to learn WAS/Java and this is a very good material.

    Thanks

    • Y1VG_Vivek_Kumar June 14, 2015

      Hi Vijay, I am trying to learn JAVA and trying my hand at pushing the code to Bluemix. I stumbled upon this article and found that you were or are learning the same. Did you have success in pushing applications or code apart from the one mentioned here to local server or Bluemix, if yes would you mind sharing some resources or any learning or any tips ?

      Thanks
      Vivek

  13. Worked nicely.

    Thank you
    Jason

Join The Discussion

Your email address will not be published. Required fields are marked *