Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Thursday, February 16, 2017

Oracle Linux 7 docker image update

Today I added few more utilities to my oracle linux 7 with utilities docker image.

New additions are:  jdk 1.8 and groovy 2.4.8

To pull you can use

docker pull vikceo/oraclelinux7withutils

Enjoy!

Friday, February 10, 2017

Docker for Beginners

Docker is the hottest celebrity in the tech World. Everyone around you might be jumping over it. And you might wonder what the hype is about?

In simplest form, I would say it is much like a virtulbox or vm but very light weight. Reason? It eliminates an entire OS layer and uses most of the required components from the host OS. I would let you read more firm definition from official docker documentation

I started playing with it very recently and thought to put up some very basic getting started steps. I am using a mac pro with Sierra 10.12.3 as host OS.

Installation


  1. Head over to https://docs.docker.com/engine/getstarted/step_one/#/docker-for-mac and just hit "Get Docker for Mac".
  2. Install like any other OSX app and you are done.
  3. As a confirmation you should see a whale icon in your mac toolbar.

Create Your First Image

Before you create your first docker image, lets check what we already have. 

images

This list out all the docker images you already have. e.g.
Above lists out the repository where image exists (if not pushed then local), a tag which works like a version, the unique image id. Instead of re-inventing the wheel you should first check if someone already created an image you need and published on docker hub. If not exactly what you want but may be a starting point that you can extend further.  To mention docker hub is like a marketplace where you can look for images built by other devs like you. You can simply pull these images if there exists one that does your job. Likewise, once you extend or customize and existing image, then you can push your flavor for other's use. To push or pull you would need to create a docker hub account.



For this post, we are extending a Oracle Enterprise Linux 7 image with some of the handy utilities/scripts. To do that, you need to pull the base image as the first step and then start downloading and installing the required utils/scripts. This sequence of steps need to be defined in a file called Dockerfile. To store your docker file and any additional resources, lets start with a new dir.


Create a text file and name it Dockerfile using your favorite editor. I use sublime. The very first instruction would be to pull the base image (Oracle Enterprise Linux 7 in this case). The file will look like:
Save it and lets build our first image. In this case, we are literally pulling and building an image as is.

build

The -t option is to give a tag to the image you just built. The first line sends the data to docker demon.  2nd line prints the step from Dockerfile it executed. 3rd line is a layer identifier (every step is executed as a layer and cached for reuse when you rebuild). Final line shows the image built with its image id.

Let's check what images do we have now:

You will notice a new image (2nd last) which we just created. Next step is to run it. And we run an image by initiating a  docker container.  Let's do that

run

So, the last word bash here along with option i and t makes the container interactive with bash open. Lets try to run some simple commands.
If you notice ls worked just fine as it's a base linux image. However, unzip did not. The reason? Well Oracle Linux 7 docker image that you pulled doesn't include that. Options? You have 2 options. First, you go ahead install in the container. Secondly, you can extend this original image and have instructions to install unzip and build an image.

Though both options will work but 2nd option helps you avoid installing manually every time you have a new container. And this becomes super productive when you need a complete development environment for multiple developers to build and test their work. For example, you can configure with some additional utilities and a node or have a docker container for hosting a db.

Assuming you are convinced with the requirement of having your own image, lets extend our image and rebuild. The modified Dockerfile will look like below:
And on building, and starting a new container and trying the same will look like below:
So, this time you have an enhanced image with unzip installed. Before we go ahead and push it to docker hub lets see how to see all the running containers and stop any if we want.

stop

So, that how we list and stop a container by its id. Lets now push the image to docker hub. For pushing there are 3 steps. 1 tag your image 2 login 3 push


That's it. Your new image is ready for you and World (if you like) to consume. To see how it appears on docker hub here is a screenshot:


Congratulations!!! Hope you find it useful.


Thursday, October 29, 2015

Oracle ADF Jdeveloper 12c Groovy Expression to Generate Sequence no longer works

Until Jdeveloper 12c for supplying primary key to your entity creation you could simply add a groovy expression in the primary key attribute's default expression like:

(new oracle.jbo.server.SequenceImpl("", adf.object.getDBTransaction())).getSequenceNumber()

However, running the same code in Jdeveloper 12 will throw following runtime exception:

General error during semantic analysis: JBO-25152: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.

Solution:

  • Open EO in the source view.
  • Search for trustMode="untrusted"
  • Change it to trustMode="trusted"
This should work now.

Tuesday, October 27, 2015

Installing Oracle XE on Virtual Box and Accessing it on Mac OS X Yosemite

Oracle XE  is not yet supported on Mac OS X and if you are planning to do any development and required a local DB then you are pretty much out of luck to install it.

Solution?  Install Virtual Box with linux or windows machine and run oracle XE on it. Access it locally from your host os Yosemite in this case. There are two major steps in this.

  1. Installing Virtual box, guest OS and Oracle XE
  2. Configuring it to access Oracle XE from the Mac Yosemite. 

Step 1


  1.  Download latest version of virtual box
  2. For the guest OS and DB either you can individual download the images and install all that or you can use one of the Oracle prebuilt images. They will be a bit larger in size due to some more stuff but will do the job as one step solution. I used Downloads and Instructions
  3. Once you have a everything installed and the image imported you will need to make sure that you can run your XE DB in the guest OS first. Do the following:
    1. from the Applications menu click on "Oracle XE DB --> Start Oracle Database". Wait for few min.
    2. From the same place click on "Run SQL lite terminal"
    3. In the terminal type  connect / sysdba  and this should connect if DB is up and running. 
    4. by default HR schema is installed and locked. So run the following 
      1. alter user hr account unlocked identified by hr
    5. This should do the job and will ensure that it all works fine.

Step 2

  1. Click on the top right corner and enable network on your guest OS (eth0 by default)
  2. Go to Virtual box and installed image settings. Click Network tab and click on Port Forwarding.
  3. Add a new entry here marking as: Host ip: 127.0.0.1 port 1522 guest ip: blank port: 1521 and do ok.
  4. This should now connect to the XE running in guest OS as  hr/hr@localhost:1522:XE (service name)
NOTE: The pre-built image I used in step 1 has the port 1521 unblocked by default. If you are manually doing the step 1 then you would need to unblock the 1521 port by guest OS firewall. You can do that following: http://www.thatjeffsmith.com/archive/2014/03/connecting-to-oracle-from-your-host-to-a-virtualbox-oel-guest/


Thursday, November 7, 2013

Fusion Concepts: Fusion Database Schemas

I authored another post at our official blog FADEVREL on explaining different Fusion Database Schemas.
You can read on this at https://blogs.oracle.com/fadevrel/entry/fusion_concepts_fusion_database_schemas

Friday, July 12, 2013

ADF How-To #1: Exposing an Existing VO Attribute in the UI

A post to describe step by step how to add a new attribute to af:table from a VO using JDeveloper design time customizations

https://blogs.oracle.com/fadevrel/entry/adf_how_to_1_exposing

Saturday, April 13, 2013

Tip of the Week#2

A new tip is posted on Fusion Applications Developer Relations blog at:

https://blogs.oracle.com/fadevrel/entry/tip_of_the_week_2

Saturday, March 23, 2013

Fusion Applications: Tip of the Week #1

A reference to the Fusion Apps Developer Relations blog's new post Tip of the week ...

https://blogs.oracle.com/fadevrel/entry/tip_of_the_week_1

Friday, March 22, 2013

How to find if weblogic server is running in production or development mode

With only weblogic console access if you wish to find if the weblogic server is running in development or production mode then here is the way:

1. Login to weblogic console at http://server:port/console
2. On the left side under domain structure click on the domain name
3 Click on Configuration --> General tab on the right side
4. There will be a check box Production Mode. If is unchecked then it means it is running in development mode.

Tuesday, March 12, 2013

Tailor, Customize, Extend, Personalize, Localize, and Integrate – All Explained

Oracle Fusion Developer Relations Team has posted a new entry on their blog at https://blogs.oracle.com/fadevrel/entry/tailor_customize_extend_personalize_localize talking about various terms used in Fusion Applications.

Please do read and leave a comment there.

Thursday, March 7, 2013

Secrets of Google IO 13 Home Page Codes #io13

Though this is not the place where I post these things but there was no point to create a new blog for just one such post.

Here are all the graphical mystery pages that gets generated from google i/o 2013 home page live at http://google.com/io

A space animation

The hotdog and the burger
The space
Random graphics
the bowling
The console
A simple game to control ball using the paddle
The amazing frequency control
The Omelette  
Nice follow me game to test your memory
Funky music band
Caturday :)









Thursday, February 28, 2013

Tailoring Fusion Applications in the Cloud Explained

Here is an another useful post from Fusion Apps Developer Relations Team about tailoring fusion applications in the cloud

https://blogs.oracle.com/fadevrel/entry/tailoring_fusion_applications_in_the

Tuesday, December 4, 2012

ADF 11g: Lessons Learned in View Object refactoring

Though this is not a common usecase and a lot of you might think why someone will ever do that? But, while implementing solutions which are not tried earlier by developer there might be switches from creating a entity based view object to transient view object or other way round that is, starting with a transient view object and then later decide to make it entity based. Lets take the later case:

Converting a Transient View Object to Entity base View Object: Overall not a very commonly done activity but for those who may need to do it in future to save some efforts. It is just to go to 'Entity Objects' section on your view definition and then to shuttle the required entity object on which you want to base your view object. After this you may add required attributes from your entity using the option 'Add from entity' and can delete the transient attributes no longer needed.

So, what't the issue?

Well, if you go ahead with that view object definition and create a table based on a view instance of this view object you will see if coming nice. Try CRUD operations like create, update etc. and should be working as expected.  However, when I tried deleting a row it didn't work at all! So, I decided to debug it and one of the obvious way is set a debug point at remove() method of View object's row impl class and entity object's impl class. On debugging, what I found was: it was hitting the remove method in View Object's row Impl but was not stopping at entity object's impl. This indicated me some sort of configuration issues and I decided to create another view object based on the same entity object but this time in the natural expected way. On doing so in less than 2 minutes and spending some 5 minutes in comparing both the VO definitions carefully I found that in my original view object a property is set in the EntityUsages as follows:


    Name="CreditReceiverEO"
    Entity="myapps.model.entity.CreditReceiverEO"
    DeleteParticipant="false"/>

And this explained everything. So, this property was probably set during the transient view creation and didnt get removed when I switched the VO to base on an entity object.

Conclusions:  

1. Avoid shortcuts in creating ADF BC objects unless you really understand the in and out of xml files generated.

2. Whenever you see and awkward behavior try to do the things in natural way by keeping a backup of your existing app so that you can revert back later if needed.

3. If point 2 is not a valid option all the time then just to create a copy or sample project with the same setup but in the natural manner and compare the generated xmls to see if you can find a clue.

Thursday, November 29, 2012

ADF 11g: Deleting customizations metadata from MDS

ADF 11g offers powerful ways to change or override the pieces of fusion applications via customization and personalization. It can be done in many ways like by administrator at run time to show hide certain components at different levels or layers like at site level, global lever etc. For meeting more specific needs the consultants can do the design time customizations by opening jdeveloper and then bundle them to override the behavior or application flow. Another interesting possibility is to extend fusion applications. One of the example for extension is say the application offers a Task flow showing employee and department data in a tree table structure.  You may want to manipulate this data in a totally different way and hence this may not be satisfied by customizing. At this point, extension comes to the rescue. What you can do is simply create a new bounded task flow with a new view activity as per your requirements. Then you can  customize the existing task flow by dropping your created bounded task flow and making it a default activity. To be able to ship it you will need to package your task flow artifacts as a adf library jar and the customization done as a mar file. Then the packaged adf library jar will be required to place in the exploded ear of your application in the WEB-INF/lib folder (assuming you only created a UI artifacts and reused existing model).

For the mar file deployment, you will need to login to Enterprise Manager of your application server which is usually at http://your server:port/em location. In the em, after choosing your deployed application you will need to select MDS from the menu and have to import the mar file. On bouncing the server the newly created task flow will be launched instead of the one that was earlier present.

There are situations when you may have to revert back to the original task flow so to be able to do you will need to delete the imported metadata. Two of the ways to do that is by:
1. Customization Manager which can be accessed by anyone with administrator privileges.
2. By using the wlst console

The focus of this post is on point 2 and here is how you can do that:

To start the wlst console use:
/wlst.sh 

There are many places where wlst.sh may exist depending upon the weblogic version. Fusion applications also provide its own version of wlst.sh through the shipped libraries during the installation. Some of the typical locations are in


atgpf/common/bin/wlst.sh
DefaultDomain/config/fmwconfig/wlst.sh

wlst commands need either online or offline mode for them to work. So, the one being discussed here to delete metadata it needs the online mode. Which means you need to connect to the server on wlst console before running the command. So to connect you need to use:

connect('weblogic userna,e','weblogic1 password,'t3://server name:port')

Once connected you can first see the imported meta data and then delete it. To get the metadata imported into the app you can use:




exportMetadata(application='You Deployed App name',server='wls server name',toLocation='/tmp/myrepos',docs='/**')

This will export all the mds meta data . You can selectively export by changing the docs option. 


Finally, to delete the metadata like in this case we want to delete just for the customized task flow you can use:

deleteMetadata(application='You Deployed App name',server='wls server name', docs='/WEB-INF/.../ExistingTaskFlow.xml.xml')

This should do the job and as I mentioned earlier the docs option can be changed to delete more than one artifact or all by using /**

Reference: http://docs.oracle.com/cd/E14571_01/web.1111/e13813/custom_mds.htm


Wednesday, November 21, 2012

ADF 11g: Getting Selected values from a LOV

I had a table in the UI where one of the column is a LOV. The requirement was to default another field say PayeeName in the  same row based on value selected from the LOV only when the PayeeName field does not have a value already.

To accomplish that the simplest idea is to bind the ReturnPopupEvent to a managed bean method and some how get one of the returned value from LOV in this method. Then check if the PayeeName field is null. If yes then update it otherwise just ignore. This can be done quite easily as follows:

1. Go to the ReturnPopupEvent property of the LOV and bind it to a manged bean method.
2. In the bean method you can write the code as below:


public void myLOVListener(ReturnPopupEvent returnPopupEvent) {    
        List lst= (List)returnPopupEvent.getReturnValue();
       String value = null;
       for(Object obj : lst{
                        value  = ((Map)obj).get("RoleName"));
                       if(value != null)
                           break;
        }
     
//get the iterator binding to get handle of the current row    
  DCBindingContainer bc =
            (DCBindingContainer)BindingUtils.getBindingContext().getCurrentBindingsEntry();
        DCIteratorBinding profItr =
            bc.findIteratorBinding("MyTableVOIterator");
        Row rw = profItr.getViewObject().getCurrentRow();
        if(rw != null &&  rw.getAttribute("PayeeName") == null){
            rw.setAttribute("PayeeName", value);
        }
    }


Please note that I am not really checking for null etc. as my intention is just to show how to use returned values from the returnPopupEvent.


Another important point to note down is that the LOV must have RoleName as one of the return attributes in its configuration in the model.

Thursday, November 8, 2012

Mass Refactoring ADF Application

There are occasions when you may need to refactor the entire adf application including model and view projects to align to certain standards based on your organizational requirements or as a developmental decision.

Dev guide already covers on how to refactor different BC4J and UI artifacts like entity objects, task flows etc. You may refer the fusion applications developer guide for the individual refactoring requirements at http://docs.oracle.com/cd/E15051_01/web.1111/b31974/refactoring.htm

However, doing this object based refactoring could be just too painful depending upon the size of your application and yes of course time consuming as well. So, to make a change everywhere like converting the package name com.mycompany.app.blawblaw  to com.mycompany.newapp.blawblaw it will be required to change all the references of app to newapp in all the application files and also to rename the physical directory structure of the directory app to newapp. Here, are the steps you may find useful:

Assumptions
1. Used jdeveloper 11g version 11.1.1.6.2
2. Used on windows 7
3. Your JDeveloper is closed (not essentially harmful to keep it open but not recommended)

1. Take a good backup of your application before you start. Source control is a good way. However, I will still recommend to take a physical backup by just copy paste the app folder to somewhere else. Sometimes, source control might get crazy to figure out mass changes from outside the jdeveloper.
2. Download a good search and replace tool like I used http://www.divlocsoft.com/index.htm
3. Browse the tool to the root of your adf workspace and do a search with a filter mask *.jpr; *.jpx; *.java; *.xcfg; *.xlf; *.xml; *.cpx; *.adfc_diagram;  *.dcx
4. Above will make sure to capture all the relevant files from workspace from model and view controller project. Then search and replace the following:

  • .app. to .newapp.   for fixing all the packages
  • _app_ to _newapp_ to fix databindings.cpx with correct usageIds 
  • /app/ to /newapp/ to fix taskflow path references etc
5. Once file content refactoring is done there comes a bit manual work. Now, you need to rename all the directories with name app to newapp

Now, start your jdeveloper and you should be all set. 
A point to not forget is to use jdeveloper based refactoring if there are very less number of artifacts and not really a need of moving jpx, jpr files etc.

Saturday, October 27, 2012

Jdeveloper 11g: Enabling SVN

If you are using RUP1 or RUP3(Rel4) versions of jdeveloper from edelivery.oracle.com for the development and wish to use svn (subversion) for the source control (which you must unless you are using another version control program). Then you will find that svn is disabled by default. You will see it in preferences as available but no way to use it.

This is intentionally done to fix some bugs in the past about startup hanging issues for jdeveloper. Here, is the solution for the same.


  • Go to /jdeveloper/jdev/roles/oracle.apps.role.xml
  • Delete line 17 which disables subversion
  • Restart jdeveloper 
Now, you should see the options to provide svn repository.

Friday, October 19, 2012

Jdeveloper 11g: Could not reserve enough space for object heap

Today morning, all of sudden my application running on jdeveloper 11.1.1.5.3 on a windows 7 64 bit machine stopped running. To be more precise I was hitting the following exception during the application deployment:

GC overhead exceeded

So, the natural answer was to look for permgen space and related memory jvm parameters for the possible issues. On looking into setDomain.env at jdeveloper//DefaultDomain/bin I found the following:


MEM_MAX_PERM_SIZE_64BIT="-XX:MaxPermSize=256M"
export MEM_MAX_PERM_SIZE_64BIT


So, I bumped it to 1024M.  I started my server again and it did not help. So, next thing to look was to check the jvm parameters at wls startup in jdev console and I found as follows:

C:\Oracle\Middleware11153\jdk160_24\bin\java -client   -Xms32M -Xmx512M -XX:CompileThreshold=8000 -XX:PermSize=64M  -XX:MaxPermSize=1024M -D

Looking into it string gave me another hint on parameter -Xmx512M which is also not quite enough and could be the cause of issue. So, I decided to bump it to 1024M. To change this parameter I had options to update it in my jdev launch script which looks like as follows:

myjdev.cmd
============================

set MW_HOME=C:\Oracle\Middleware11153
set JAVA_HOME=%MW_HOME%\jdk1.6.0_34
set PATH =%JAVA_HOME%\bin;%PATH%
set JDEV_USER_HOME=C:\Users\vskumar\AppData\Roaming\JDeveloper
set FADEV_VERBOSE=true
set USER_MEM_ARGS=-Xms256m -Xmx256m -XX:MaxPermSize=1024m -XX:CompileThreshold=8000
%MW_HOME%\jdeveloper\jdeveloper.exe


So, I went ahead and modified the line starting with set USER_MEM_ARGS to look like as follows:
set USER_MEM_ARGS=-Xms256m -Xmx1024m -XX:MaxPermSize=1024m -XX:CompileThreshold=8000

and fired this command. After jdev launch I started the integrated wls and it failed with error as follows:


Error occurred during initialization of VM
Could not reserve enough space for object heap


as I had changed Xmx param as the last thing so kind of guessed it as the issue and reduced it to 768M. And the same problem. So, I reduced it further to 640M and this I did not see the error. Though 640M was not satisfactory but was higher than previous 512M so, I thought its ok to go ahead and hopefully the error will go away as well. And, after couple of minutes later against my expectations it failed again with a new error this time. It was as follows:



**************************************************************************
The WebLogic Server encountered a critical failure
Reason: unable to create new native thread
***************************************************************************
 
Throwing I/O exception: "MapViewOfFile: handle=7212 hiOffset=0 loOffset=0 size=1114112, Not enough storage is available to process this command., errno=8" errno = 8
Throwing I/O exception: "MapViewOfFile: handle=7212 hiOffset=0 loOffset=0 size=1114112, Not enough storage is available to process this command., errno=8" errno = 8
Throwing I/O exception: "MapViewOfFile: handle=7212 hiOffset=0 loOffset=0 size=1048576, Not enough storage is available to process this command., errno=8" errno = 8

This kind of indicated me a physical memory issue with RAM or harddisk. I have 8gb ram on my machine with no app running so was sure that certainly I do not have low memory. I had more than 10 gig free space on my c drive where all this was running. So, what to do next? I reviewed my setDomain.env, ide.conf and jdev.conf files and changed all the places mem related parameters to 1024M but all with no results. I then changed my cmd script Xmx parameter back to 1024M as I thought this error is just an effect of error above it and will go away if I can fix that one. Hence, I was back to error


Error occurred during initialization of VM
Could not reserve enough space for object heap


I decided to google for it and bumped into a thread talking about the possible reason that windows tries to allocate a contiguous memory to run vm and it fails to do so due to fragmentation etc and hence causes it. One of the solution in the same thread suggested to switch to a 64 bit jdk as a possible fix. Having no other options I downloaded jdk6 64bit at location c:\proram files\java\jdk1.6.0_34 and updated my launch script JAVA_HOME line as follows:

set JAVA_HOME = C:\Program Files\Java\jdk1.6.0_34

Hoping all goes well i started jdev and then integrated wls. During startup I observed it is still picking up the old 32 bit version which was strange. So, I started looking again what is the issue for not picking the 64 bit jdk. I looked into jdev.conf and found an entry like:

SetJavaHome C:\Program Files\Java\jdk1.6.0

So, thinking this could be the issue I closed my jdev and commented this line. I kicked my jdev again and on startup as expected it asked me to provide java.exe location. I provided the 64 bit version java.exe location and finally jdev started. However, on starting the integrated WLS I was seeing the same old 32 bit version picked. I thought it might be picking it from setDomain.env and opened it but found its referring JAVA_HOME param rather a hard coded value. I thought to give it a try and added the value manually to it as follows:

set JAVA_HOME = "C:\Program Files\Java\jdk1.6.0_34"

I kicked my domain startup again but was still seeing the old jdk used and was frustrated on whats going on. I had no guesses left here and all of a sudden a friend suggested could it be that it doesn't like spaces? With no other options left we thought to give that too a try and i removed spaces to look it like:

set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_34"

And, that was the culprit here! The spaces which my friend discovered as a possible issue was the least expected thing to be causing this particular issue. So, I then removed this hardcoded value and fixed my script launcher values as well accordingly.

Needless to say, all my issues related memory got resolved and things worked fine after spending almost a day on this issue.

Key Takeaways
===========================
1. Make sure not to have extra spaces in the set parameters in case of using windows.
2. It is strongly recommended to use a 64 bit jdk. I am not sure why oracle ships 32 bit jdk with jdeveloper when this is recommended in dev guide as well.
3. Have a launcherScript to set jvm params on startup rather launching jdev directly from program menu.

Tuesday, October 16, 2012

ADF 11g: Entity Object (EO) Insert cycle

It is quite important to understand entity lifecycle which involved different types of validations firing at different stages. It typically starts when an entity is created in the middletier when you invoke a vo.createRow() via UI or programmatically. The entity lifecyle is over at the time it is properly committed to the database. This cycle gets quite complex if there are multiple entities involved. If entities are associated like in a master-detail then validation cycles are extended to validate child entity as well during master entity validation. The best way to depict this is via a diagram as below:

I am not really spending time to explain each and every phase of this lifecycle as documentation does a good job for that. This post should be useful as a quick reference to the readers and quite important to understand to be able to handle some situations where it is required to decide where to place certain code.

ADF 11g: CreateAndInitRow


This one is rather a quite small post but might be useful for people quickly looking for a way to initialize a vo row at the time of creation. This method like createRow() only creates a new row but does not actually inserts into the vo. So, you will still need to call vo.insertRow(row). Here, is the syntax

            Row myRow = ruleAttrIter.createAndInitRow(new NameValuePairs(new String[] { "AttributeName" }, new Object[] { "AttributeValue" }));

More than one attribute can be supplied comma separated.