This
is the last part of 3 part series. As you already aware
In the first part I
talked about Prerequisites and setting up the environment. Please find Part 1 here.
In the second part I
talked about how to move database schema and corresponding data from local
JDeveloper to Oracle Database cloud service. Please find Part 2 here.
The purpose of this
section is to configure your ADF application in order to Deploy to Oracle Java
Cloud Service. Oracle Java Cloud Service provides a platform to develop and
deploy applications in the Oracle Cloud. You can deploy any Java EE
applications to Oracle Cloud.
. If you want to
learn more about Oracle Java Cloud Service then Click here
Step1:
Creating connection to the Oracle cloud server in the JDeveloper
1.
In your JDeveloper just navigate to
View -> Resource Palette -> IDE Connections -> Right click on
Application server -> Create New Application server connection
In the Create Application Server
Connection window, provide Connection name, select connection type as ‘Oracle
Cloud’ and Click next. In the next step provide your Oracle cloud credentials
details and click on next
In the third step, you
have to provide information about, Data Center, identity domain, and service
name as shown below.
Are you aware of where this information will be available? If
answer is “No” then no problem
Just open your Java Cloud Service and you will get all the
required information as shown below.
2.
In the last step, click on Test
Connection button to verify the connection is valid.
Suppose the connection to the Oracle cloud is failed and
throws the below error.
Then don’t worry, I have faced the same issue and OTN helped me to find solution and here it is
Please check all the required details like username,
password, service name, identity domain name. If everything is fine and still
you are getting the same issue then problem might be with your Cloud SDK
version.
If the Cloud SDK version is not latest then download the
latest Cloud SDK by referring [4] in the References section below
And then unzip it somewhere and point your Java cloud service
SDK location to the new version.
Cloud SDK location can be found by navigating to
Tools ->
preferences->Oracle cloud ->Java cloud service SDK.
If your connection is valid, you can
see new connection to cloud server under Application server connection.
Step2:
Preparing code to deploy to Oracle java cloud service
Oracle
Cloud does not directly support JDBC connections, but it does support JDBC data
source connections. So, we need to modify the application to use a JDBC data
source and provide the name of the Oracle Database Cloud Service instance.
In
order to know Data source name which Oracle Cloud provides, open Java Cloud
service console page and note down JNDI name
3.
Now in your model project right click
on your application module and click on configurations, In the Manage Configurations
window click on Edit button and in the Edit business configurations window
change the JDBC Data Source name as shown below
If you want your application to be publicly
available on the Oracle Cloud and not requiring any login credentials then add
an empty login-config entry to the web.xml file:
|
......
<!-- empty logon-config to allow anonymous
access on Oracle Cloud -->
<login-config/>
</web-app>
|
I also added a welcome-file to the web.xml so requests to xxx.oraclecloudapps.com/Application get redirected to xxx.oraclecloudapps.com/Application/faces/defaultPage:
|
......
<!-- set welcome file so requests to / get
redirected to the default page -->
<welcome-file-list>
<welcome-file>/faces/DeptEmpPage.jspx
</welcome-file>
</welcome-file-list>
</web-app>
|
4.
Now Deploy the Application to your
Oracle Cloud server
i.
Click on the application ->Deploy
ii.
Deploy to Application Server
iii.
Select your Oracle Cloud Application
server and click on finish
In the Deployment log, you will see something like as shown
below
Once the Deployment is done, go to your Java Service Console
and you can see your new application present in your Oracle Java cloud service
console.
In the Application URL’s Window click on the Application URL
to Test the application
Once you click on the link, you can able to see the application
If the Deployment is not successful, then you can verify log
file to know the issue. In order to see the log files
Open your Java Cloud Services Control and scroll down; you
can able to see the Java Cloud Service Jobs section
As soon as you clicked on the log, the text file which
contains log information will get downloaded automatically.
That’s it.
Here are some important links to invest yourself more on Oracle
Cloud java service and Oracle cloud database service