Page 2 of 32 Goals At the end of this exercise, you will be able to:
Install Oracle JDeveloper IDE Configure Java Cloud Service connections in JDeveloper Deploy a HelloWorld application to JCS
Time 30 minutes
Overview Oracle Java Cloud Service 13.2 currently supports Oracle JDeveloper, NetBeans and Oracle Enterprise Pack for Eclipse as an Integrated Development Environment to develop applications for Cloud. The scope of this workshop is the usage of Oracle JDeveloper IDE, so, in this practice you will first install JDeveloper 11.1.1.7.1 in your local environment. This version should be downloaded from an authorized Oracle site (i.e. cloud.oracle.com, Oracle Software Delivery Cloud, Oracle Technology Network). One requirement is to have network connectivity to the Oracle Cloud instances provided by your instructor (or previously arranged).
Page 3 of 32 Instructions
1. Go to the directory where you saved JDeveloper installation file and double-click on jdevstudio11117install.exe .
2. Wait while the Oracle Installer initialize.
Page 4 of 32 3. A Welcome Screen will be displayed. Click on Next to proceed to the installation.
4. Select Create a New Middleware Home directory. Specify the Middleware home directory, and then click on Next.
Page 5 of 32 5. Choose Complete installation. This will install JDeveloper with an embedded Weblogic Server and ADF. Then, click on Next.
6. Review the Middleware Home Directory, the location of JDeveloper and embedded Weblogic Server. Click on Next, confirming installation directories.
Page 6 of 32 7. Select All Users start menu folder in order to create the JDeveloper shortcuts for all users in your machine. Then click on Next.
8. Review the Installation Summary screen and confirm if you have the required hard disk space available for the installation. Then click on Next.
Page 7 of 32 9. Wait for the installation to complete.
10. After that, the Installation Complete screen will be displayed. There you have the option to uncheck the Run Quickstart option, otherwise you will be prompted by the Quickstart splash screen with an introduction to the JDeveloper IDE. If this is your first contact with JDeveloper, it is really recommended to leave the Run Quickstart option checked. Then click on Done.
Page 8 of 32 11. Now you will start working with JDeveloper. Go to Windows Start Menu -> All Programs -> Oracle Fusion Middleware 11.1.1.7.1 and click on JDeveloper Studio 11.1.1.7.1. 12. If you have any other JDeveloper installation in your machine, you might be prompted to import preferences from a previous JDeveloper installation. Click on No to ignore this option and open JDev.
13. On first JDeveloper startup, you will be prompted to select a Role. Depending on the role you choose, a set of features will become available in JDeveloper. For customizing an ADF application (MDS layer), you will be required to select Customization Layer. More information can be found in Oracle Fusion Middleware Fusion Developers Guide for Oracle Application Development Framework. For now you should select Default Role to enable all technologies and uncheck the option Always prompt for role selection on startup. Then click on Ok.
Page 9 of 32 14. Start using JDeveloper. Explore all the menu options available to become more familiar with the IDE.
15. Go back to JDeveloper and click on Tools -> Preferences:
16. Under Preferences window, select Oracle Cloud. You can also type in Oracle Cloud on Search textbox. Then confirm the location which Oracle SDK was installed. By default, JDeveloper 11.1.1.7.1 comes with SDK version 13.2, while the JCS instances of this workshop are 14.1. So it is necessary to download and set the new JCS SDK 14.1. Go to http://cloud.oracle.com and the go to Resources and then Download.
Page 10 of 32
17. Scroll down and find the SDK download link.
18. Download and save the new JCS SDK 14.1 and set Oracle Cloud preference accordingly through Toos | Preferences.
Page 11 of 32
19. Now you are ready to set up a connection to an instance of Oracle Java Cloud Service. Click on the menu View -> Resource Palette or use the shortcut Ctrl+Shift+O to open up the Resource Palette. 20. Right-click on Application Server, under IDE Connections, and then click on New Application Server Connection.
Page 12 of 32 21. On Create Application Server Connection Wizard, first step is to specify a Connection name and Select the Connection type. Please go to the next step before any question.
Page 13 of 32 22. Please note that you are not allowed to use spaces between names. You should follow Java identifier Conventions. So, type in JavaCloudService as a Connection Name (without the spaces).
23. Select Oracle Cloud as a Connection Type and then click on Next.
Page 14 of 32 24. Provide the username and password you previously received.
25. Provide the Data Center, Identity Domain and Service Name you previously received.
Page 15 of 32 26. Finally, test your connection to the server. If failed the test, review Authentication and Configuration settings and try again. You might have to set up JDeveloper proxy (Tools -> Preferences -> Web Browser and Proxy). Otherwise, click on Next.
27. Cloud Server connection is ready; we can now start creating our first Cloud Application. Click on Finish to close the window.
Page 16 of 32 28. Click on New Application
29. Set the application name to HelloWorldUserXX, where XX is a number assigned to you by your instructor. Select Java EE Web Application template and then click on Next.
Page 17 of 32 30. Now click on Next button from step 2 to 6 (last window) and leave all options with their default value.
Page 18 of 32
Page 19 of 32
31. Now your application was created with two projects: Model and ViewController.
Page 20 of 32 32. Right click on View Controller project and select Project Properties
33. We now need to setup the Java EE Web-Context Root and Application name. Click on Java EE Application option and type in HelloWorldUserXX (where XX is the number assigned to you) for both fields. Click on Ok to confirm and get back to the application. Save your application to confirm all the changes.
Page 21 of 32 34. Now its time to create our first page. Under ViewController project, go to Web Content folder, right click on that folder and choose New
35. At the New Gallery window, under Web Tier, JSP Categories, select JSP item.
Page 22 of 32 36. Enter the File Name hello.jsp and click on Ok.
37. The page should be displayed in JDev as per the image below.
38. At the bottom of the window, select the Source tab and add the following code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page contentType="text/html;charset=windows-1252"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/> <title>hello</title> </head> <body> <h1>Hello World</h1> </body> </html>
Page 23 of 32 Please note that JDeveloper has already provided to you most part of the code. You will just have to insert the code between <body> tag.
Page 24 of 32 39. Next step is to set up the deployment profile. Right click on ViewController project -> Deploy -> New Deployment Profile
40. At New Gallery Window, under Deployment Profiles, select WAR File.
Page 25 of 32 41. Type in HelloWorldUserXX (where XX is the number assigned to you by your instructor) as the Deployment Profile Name and click Ok.
42. Review all options and click Ok to confirm.
Page 26 of 32 43. HelloWorldUserXX will be available in Deployment section of the Project Properties. Click Ok to close the window.
44. In order to deploy your project to the Cloud Server, right click on ViewController project, select Deploy -> HelloWorldUserXX.
Page 27 of 32 45. Select Deploy to Application Server and click on Next.
46. Select the JavaCloudService server instance you previously created and then click on Next.
Page 28 of 32 47. Click on Finish to start deploying the Project into Java Cloud Service server.
48. Follow the deployment progress in the Deployment Log window. You can view the log file containing all the steps required to deploy an application to JCS and also you will have the URL address which your application will be available.
Page 29 of 32
49. Open up your browser and go to the URL which your application was deployed displayed on the previous step. Dont forget to include the name of the jsp file you are opening: i.e. https://java2-jcs.java.us1.oraclecloudapps.com/HelloWorldUser01/hello.jsp Please note that your server URL might be different than java2- jcs.java.us1.oraclecloudapps.com. Check that information with your instructor if you have any question. Since we were using default security settings, you will be prompted your security credentials in order to have access to the page.
Page 30 of 32 50. After login, you will be redirected to your page.
51. You can also manage your application in Java Cloud Service through the Java Cloud Service Console. Open your browser window and go to the URL which you previously received. Ie http://console.us1.cloud.oracle.com/em/faces/javaservice?serviceName=java2&identityGroup=jcs
Fill out the form with username, password and identity domain and click on Sig In.
Page 31 of 32
52. From the Java Cloud Services Control Home page you can manage your applications, connections, shared libraries, view logs, etc. More information related to Java Cloud Service can be found in documentation.
Page 32 of 32
Oracle PaaS Extending SaaS Workshop March 2014
Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065 U.S.A.
Copyright 2014, Oracle. All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Oracle, JD Edwards, PeopleSoft, Fatwire and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.