Sunday, April 6, 2014

MongoDB not able to start :cause of : exception in initAndListen: 12596 old lock file, terminating

Some times when you start the mongo db server then it is not able to start because of following exception:

exception in initAndListen: 12596 old lock file, terminating

Solution

In this case just use the mongo db "--repair" command fix this issue.

  1. Go to bin directory in mongo db folder i.e E:\MongoDB\bin
  2. Delete the mongod.lock file. (this step is optional)
  3. Now open the command prompt and run this command i.e. "E:\mongodb\bin>mongod.exe --repair --dbpath=E:\mongoData\data\db"
  4. Now start the mongo db service.
  5. Verify that mongo db is running successfully.

Saturday, April 5, 2014

Oracle SOA : How to deploy multiple composite in oracle soa

Yesterday I just completed the SOA development and next thing I have to move all the deployed composite on to the UAT enviornment and then production. But I think it is very cumbersome to deploy each composite one by one on to the soa server, so to overcome this problem I am using the different SOA bundles, each soa bundle consist of multiple composite of particular partition.

Steps to create SOA Bundle
  1. In the jdeveloper create a New Deployment Profile.
  2. Select Soa Bundle from the list.
  3. Name the soa bundle, "MongodbRestBundle" in this case.
  4. Click Ok. Choose dependencies on this bundle, so check all those composites that you want to deploy in single partition.
  5. Click Ok and finish the wizard. SOA bundle is configured now.

How to deploy SOA bundle on SOA server

  1. Just click on the deployment profile that you have created in above steps.
  2. select "Deploy to Application Server" and click next.
  3. Attached the config plans, select appropriate plans like UAT plan in this case similarly select for other composite by navigating through the tabs.And click next
  4. Select application server connection and click next.
  5. Select the soa server and partition in which you want to deploy the bundle.
  6. Click next and finish the wizard.
Note: you can also deploy the soa bundle by creating the SAR file and deploy on to the soa server using em console. Use this guide for further information on deployment : http://docs.oracle.com/cd/E12839_01/integration.1111/e10224/sca_lifecycle.htm



Friday, April 4, 2014

Error: could not open "\OBI_INS\lib\amd64\jvm.cfg"

I was working on installation of weblogic server and I was extracting the weblogic jar setup using the command "java -D64 -jar wls_generic_1036.jar" but I got the following error

Error: could not open "\OBI_INS\lib\amd64\jvm.cfg"

Solution

  1. Check the JAVA_HOME and Path variable in environment variables i.e the value of these variables for java is changed to "c:\'program files\java" or "c:\java". So correct the path of jdk in these variables.
  2. The files java.exe, javaw.exe and javaws.exe are copied in the folder "c"\windows\system32", so remove all those files.
  3. Now just proceed everything is on the track.

Saturday, March 29, 2014

MongoDB: Convert data getting from MongoDB into JSON Format

Today I am working on one of the use case in which I have to integrate MongoDB with Oracle SOA and expose a rest service from Oracle SOA which output the response as a JSON String. As Oracle does not provide any out of box functionality or adapters to connect with mongoDB,  so I am using the mongodb java drivers library to access the Mongo database in SOA using Java embedding activity.
In general we use the json data to interact with mongo db and I am using the same in Oracle SOA to interact with mongo db.

This blog post is about the problem faced by many developers to convert the data getting from mongo db to JSON String. Now query for getting the whole data for particular collection is :
DBCursor cursor = collection.find();
here collection is a object of class com.mongodb.DBCollection and cursor is an object of class 
com.mongodb.DBCursor
Now one way to iterate over all the data is to use following:

DBCursor cursor = collection.find( query );
 if( cursor.hasNext() )
 DBObject obj = cursor.next();

or another way is to convert cursor object into the json string using serialize method of  com.mongodb.util.JSON class and return back this json string as a response.

Please find below the example to convert DBCursor into JSON String.


package poc.nile.test;

import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.MongoClient;
import com.mongodb.util.JSON;

import java.net.UnknownHostException;

public class DBTest {
    public static void main(String arg[]){
       
         MongoClient mongoClient;
         String host= "localhost";
         int port=27017;
         String dbName="test";
        try {
           mongoClient = new MongoClient(host,port);
           DBCollection collection = mongoClient.getDB(dbName).getCollection("products");
          DBCursor cursor = collection.find();
         JSON json =new JSON();
        String serialize = json.serialize(cursor);
        System.out.println(serialize);
       } catch (UnknownHostException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
        }
    }
     
}

Wednesday, March 19, 2014

Jdeveloper not able to start: Caused by: org.xml.sax.SAXParseException: : XML-20108: (Fatal Error) Start of root element expected.

Some times it happened that Jdeveloper is not able to start or you create a new application/project in Jdeveloper you are getting the following error:

Caused by: org.xml.sax.SAXParseException: <Line 1, Column 1>: XML-20108: (Fatal Error) Start of root element expected.

And application/project is not created.
I got this error while creating the SOA project in jdeveloper 11.1.1.7.0.

Solution:

  1. Go to the system folder i.e C:\Users\username\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93
  2. Delete the system folder.
  3. Restart Jdeveloper.
Note: This is just a workaround of this problem. After deleting the system folder you will loose some information like database connection details, MDS connection details, in that case you have to create all those required connection again.

Friday, March 14, 2014

ORA-01110: data file 6: Database not open and can't find the path of data file ""

Reason: Sometimes by mistake you have deleted the DBF files and while accessing the database you get the following exception:

ORA-01110: data file 6: Database not open. Can't find the path of data file "C:\oraclexe\xe\oradata\weblogic_Data01.DBF"

Solution:

offline drop of datafile:
In Oracle if you wish to delete DBF file and tablespace or schema you run the drop command to delete tablespace and physically remove the DBF file from the disk.
But sometimes you don't need to physically remove the file and just delete the tablespace offline i.e. Oracle will not access the tablespace or DBF file anymore but the file is still on the disk.

In the above problem, you have deleted the physical DBF file from the disk but oracle is still accessing that DBF file. In that case delete the DBF file offline by running the following command:

alter database datafile 'C:\oraclexe\xe\oradata\weblogic_Data01.DBF' offline drop;

then restart the database.

Note: Offlining of datafile is used when you have to delete the tablespace and also you can recover the data file on later date.

Thursday, March 13, 2014

ORA-00838: Specified value of MEMORY_TARGET is too small, needs to be at least 180 M

Reason: This exception occurs when the user is trying to allocate an SGA or PGA size more than what is allocate to the database. This may also occur when the user is trying to allocate the database less memory than the minimum requirement.

Solution:

1)      First create a temporary pfile from current spfile:
2)      Sql command : Create  pfile=<filepath>/filename from spfile;
3)      Open the pfile and edit value of MEMORY_TARGET and set to required value, then create spfile from this modified pfile:
4)      Sql command: create spfile from pfile=<filepath>/filename
5)      Restart the database using SQL command: Startup