An Oracle blog about Middlware

  • December 19, 2017

Deploy Oracle JET Application to Weblogic Server

Arda Eralp
Principal Consultant

Step by step create sample Oracle JET application, built as .war file and deploy it to Weblogic Server.

Step 1: Install Yeoman
nodejs is prerequisite (https://nodejs.org/en/download/)
npm install -g yo
npm install -g generator-oraclejet

Step 2: Gerenate App with using Yo
yo oraclejet DemoApp --template=navbar

Other Yo Templates:
yo oraclejet app1 --template=blank
yo oraclejet app2 --template=basic
yo oraclejet app3 --template=navbar
yo oraclejet app4 --template=navdrawer

Step 3: Install Grunt-War
Change to the project folder and then install the grunt-war plugin same as before:
npm install grunt-war --save-dev

Step 4: Creating War.js file

module.exports =  {
   * Build a WAR (web archive) without Maven or the JVM installed.
   * Template strings in the <%= %> tags are set in the data section of Gruntfile.js,
   *  or you can hardcode the strings here instead
        target: {
          options: {
            war_dist_folder: '<%= distdir %>',      /* Folder to generate the WAR into, set in data section of Gruntfile.js */
            war_name: '<%= appname %>',            /* The name for the WAR file (.war will be the extension) */
            webxml_webapp_version: '2.5', /* I needed this older version for JCS-SX */  
            war_extras: [ {filename: 'grunt-war-credits.txt', data: 'This line will appear in the file!\n see http://likeahouseafire.com/2017/08/09/updated-using-grunt-to-create-war-jet3x/ '},
                          {filename: 'WEB-INF/weblogic.xml', data: '<?xml version="1.0" encoding="UTF-8"?>\n<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">\n  <jsp-descriptor>\n    <keepgenerated>true</keepgenerated>\n    <debug>true</debug>\n  </jsp-descriptor>\n  <context-root>/<%= appname %></context-root>\n</weblogic-web-app>'}],
             /* the war_extras are extra files to be generated, needed since grunt-war doesn't create a weblogic.xml */
             /* also notice that we're using the <%= appname %> variable in there */  
            webxml_welcome: 'index.html', /* to point web.xml to the default page */
            webxml_webapp_extras: [ '<login-config />\n', '<session-config>\n    <session-timeout>\n    30\n    </session-timeout>\n</session-config>\n' ]  
             /* some extra settings for web.xml to work with JCS-SX */
          files: [
              expand: true,
              cwd: '<%= appdir %>',             /* find the source files for the WAR in the /web folder, set in Gruntfile.js */
              src: ['**'],
              dest: ''

Step 5: Modifying Gruntfile.js

'use strict';
var path = require('path');
module.exports = function(grunt) {

  require('load-grunt-config')(grunt, {
    configPath: path.join(process.cwd(), 'scripts/grunt/config'),
    data: {
      appname: path.basename(process.cwd()),  // same as project directory name, accessible with '<%= appname %>'
      appdir: 'web',  // accessible with '<%= appdir %>'
      distdir: 'dist'  // accessible with '<%= distdir %>'
  grunt.registerTask("build", "Public task. Calls oraclejet-build to build the oraclejet application. Can be customized with additional build tasks.", function (buildType) {
    grunt.task.run([`oraclejet-build:${buildType}`, 'war']);
  grunt.registerTask("serve", "Public task. Calls oraclejet-serve to serve the oraclejet application. Can be customized with additional serve tasks.", function (buildType) {

Step 6: Grunt Build
grunt build:release

Step 7: Deploy to Weblogic

Step 8: Test



Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.