Quantcast
Channel: Oracle Blogs | Oracle Shay Shmeltzer's Blog
Viewing all articles
Browse latest Browse all 200

Deploying Oracle ADF Essentials Applications to Glassfish

$
0
0

With the new Oracle ADF Essentials offering you can now deploy applications that leverage Oracle ADF on the open source Glassfish 3.1 server.

Deployment is documented in the official JDeveloper and ADF documentation (here) but below is a summary of the steps and a video of the steps you'll need to take to get a basic Oracle ADF Essentials application to work on GlassFish.

Note - to make starting/stopping GlassFish easier for my demo I used my GlassFish extension that you can get here.

First we'll install some ADF Runtime libraries on GlassFish

  1. Download and install Glassfish (Note - if you also have an Oracle DB on the same machine, you'll want to switch GlassFish's HTTP port to something else instead of 8080).
  2. Download the Oracle ADF Essentials packaging - this will get you an adf-essentials.zip file.
  3. Copy the adf_essentials.zip to the lib directory of your Glassfish domain - on a default windows install this would be: C:\glassfish3\glassfish\domains\domain1\lib
  4. Go the the above lib directory and issue a unzip -j adf_essentials.zip

This will extract the ADF libraries to the directory. Now you can start the Glassfish server.

Now let's configure Glassfish to handle applications of the ADF type:

    1. Invoke the admin console of glassfish (http://localhost:4848) and log into your admin account.
    2. Go to Configurations->Server-config->JVM Settings and choose the JVM Options tab
    3. Add the following entries:
      • -XX:MaxPermSize=512m (note this entry should already exist so just make sure it has a big enough value)
      • -Doracle.mds.cache=simple

    While we are in the admin console, we can also define JDBC connections that will be used by our application.

      1. Go into Resources->JDBC->JDBC Connection Pools and click to create a New one
      2. Give it a name and choose the resource type to be javax.sql.XADataSource and choose Oracle as the Database Driver vendor. Click Next
      3. Scroll down to the Additional Properties section and start filling in the information for your database. The values for an Oracle XE will be (user=hr, databaseName = XE, Password=hr, ServerName=localhost, DriverType=thin, PortNumber=1521)
      4. Click Finish
      5. Click Ping to check your connection works.
      6. Now define a new JDBC Resource that will use the pool you just defined. In my example I called the resource jdbc/HRDS

        You will need this name to match the name in your Application Module connection configuraiton.

        Now you can re-start the Glassfish server for the changes to take effect.
        1. Get an ADF application going (you can use the regular Fusion Application template for this)
        2. Go into the project properties of your viewController project, under the deployment section click to edit the deployment profile that is defined there.
        3. Go to Platform and choose Glassfish 3.1 from the drop down list. Click ok to go back to your project.
        4. Go to Application -> Application Properties-> Deployment
        5. Go to Platform and choose Glassfish 3.1 from the drop down list. Click ok to go back to your project.
        6. This step will make sure that JDeveloper will autoamtically add the necessary ADF libraries to the EAR file that is being generated for deployment on Glassfish
        7.  Go to your Application->Deploy and deploy either to an EAR file or directly to a Glassfish server connection that you created.

        Things should just work, but if they don't then look up the server.log in the log directory and check out what error is in there.

        Here is a video demo of the various steps:

        Note - right now the deployment of an ADF application takes about 2 minutes on my machine we are hoping to be able to improve this timing in the future. People who are more familiar with Glassfish might want to explore using exploded directory deployment and see if they can get it to work.

         FAQ - some common questions/problems that people posted on comments:

        • "The zip in the video is 70mb, OTN's zip is 20mb" - that's fine. The video was recorded with a pre-production version of the zip. The 20mb zip of adf-essentials is all you need.
        • "My JDeveloper log window show an error on deployment - "status of 400 Deployment cancelled." " - To better understand where the problem is check your server.log file in under your GlassFish server. This will give you the actual error message. 
        • "I'm getting a class not found error in the server.log when trying to deploy" - this usually means one of two things:
          • 1 - you didn't use a -j when unzipping the adf-essentials.zip file - so you ended up with sub directories in your lib directory. -j will get all the jar files to be extracted into a single directory.
          • 2 - you didn't specify Glassfish as the platform in the deployment profile for both the viewController project and your application level. Without doing this JDeveloper won't know to include all the needed jars in the EAR file it is producing. Check the EAR file you got from JDeveloper - if it is smaller than 30MB - you probably skipped this step. 



        Viewing all articles
        Browse latest Browse all 200

        Trending Articles



        <script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>