Search This Blog

Thursday, March 25, 2010

How to JailBreak and Unlock iphone

I recently bought an iphone 3g in ebay. The phone came up AT&T sim card and locked.

The phone is having 3.1.2(7D11) firmware and 05.11.07 baseband.

I initially tried to use the blackra1n. I used the following article to
jailbreak and unlock my iphone 3g version. It is extremely easy to use this utility. You just need to connect your iphone to the computer and run the blackrain utility.

http://www.iphonedownloadblog.com/2009/11/03/tutorial-jailbreak-iphone-3-1-2-blackra1n/

But after unlocking I found various problems like GPS not working and ssh to the iphone is not working etc. I found that all these problems are due to some bugs in the blackra1n jail breaking code.

Because of these problems I decided to use some other jail broken solutions so that I can get back my GPS and other stuff that were broken with the blackra1n.

Here is the procedure that I followed for this.

First I downloaded the utility from the site
http://downloads.ih8sn0w.com/f0recast-1.1.exe

Connect your iphone to the computer and run this utility.

Here is the screen shot from that utility.

screenshot.8

From here I found that I can use any jail broken utility so I decided
use redsn0w for this as this is from iphone dev team.

As my phone was already jailbroken I want to restore to the base settings.

I downloaded the 3.1.2 firmware from the location given below ( Please note that you need to check your firmware version from iphone using Settings-> General -> Version , my version is 3.1.2(7D11) and download the correct version only.


so I downloaded the corresponding the firmware version from the location

http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7468.20100202.pbnrt/iPhone1,2_3.1.3_7E18_Restore.ipsw

After downloading connect your iphone to the itunes and Press the Shift button and Click on Restore button , this will ask
for the iphone firmware file and here select the file iPhone1,2_3.1.3_7E18_Restore.ipsw.

iTunes will automatically put the iphone in the restore mode and reboots the iphone. After this operation iphone will be in the factory condition with locked. In this mode you will be only able to make emergency calls only. Do not get panic at thing point of time. We need to jailbreak this to get the iphone screen back.

Download redsnow 9.2 from the following link

http://xs1.iphwn.org/rs//redsn0w-win_0.9.2.zip

extract this file to a directory and copy the file iPhone1,2_3.1.3_7E18_Restore.ipsw  to the same directory.

Now run the program redsn0w.exe and click on the browse button and select the  iPhone1,2_3.1.3_7E18_Restore.ipsw
file.

Here is the screen shot for that ,

screenshot.9

Now click on the next button and select the option's
Install Cydia etc.

screenshot.14

After this follow the exact steps mentioned in the screen, You need to enter the iphone in to DFU mode and the redSn0w does the rest. If you are not a expert of iphone you may need to try this 3 or 4 times.

screenshot.15

screenshot.16

After this operation your phone is Jail Broken.

Now you need to unlock the phone. Please use the following link to unlock the phone using the blacksn0w.

Ensure that you have a wi-fi connection in your home before trying this. Enable the wi-fi connection on your iphone so that you can download the unlock utility using this wi-fi connection.

This is also extremely easy you , you can follow the url given below for more details on this.

http://www.aboutonlinetips.com/unlock-iphone-3g-3gs-os-3-1-2-using-blacksn0w-via-cydia/

Step 1 - Start ‘Cydia’ on your iPhone springboard.
Step 2 - Select ‘Manage’ tab at the bottom of your iPhone screen and then select ‘Sources’.
Step 3 - Select ‘Edit’ and then select ‘Add’. Now enter a url source. Type ‘http://blackra1n.com’ and select on ‘Add Source’. Once Cydia has added the source click on ‘Return to Cydia’ button.
Step 4 – Once the installation is completed. Search for ‘blacksn0w’ in Cydia and install it.
Step 5 - Reboot your iPhone. Your iPhone 3G or 3GS on 3.1.2 firmware will be unlocked automatically.

Disabling Windows 2003 Internet explorer security settings

Windows Server 2003 shipped with security locked down by default.  Part of this locking down is Internet Explorer Enhanced Security which is an extra layer of protection when surfing the internet using Internet Explorer (more information can be found by going here on a Windows Server 2003 [test] machine). 

Click Start, put your mouse over Control Panel, and click Add/Remove Programs

Now click Add/Remove Windows Components

After a few seconds a window will pop-up.  Click the check mark next to Internet Explorer Enhanced Security Configuration (to make it unchecked).  If you'd like to only disable it for Administrators or only for Users you can click Details and do so.

Press Next, after this internet explorer will work in the same way that is used to work with Windows XP.

Monday, March 22, 2010

How to use Custom ringtones in iPhone

1. Get access to the mp3 or wav file that you want to convert to a ringtone. In my example, I am looking for a rock drummer loop as a ringtone for my friend who is a monkey percussionist.

2. Drag the file into iTunes

3. Select the file in iTunes and then select Convert Selection to AAC in the Advanced menu.

4. Select your new AAC file and select Show in Finder in the File menu

5. In finder, select the file and select Get Info from the File menu and iPhone features

6. Change the file extension from .m4a to .m4r

7. Confirm when the dialog asks if you really want to make the change

8. Drag the new file back into iTunes. The original files will remain but the ringtone will disappear. (It is actually being moved to following location: ~/Music/iTunes/iTunes Music/Ringtones )

9. Connect your iPhone and select the Ringtone tab in iTunes. Select the new ringtone that has been created.

10. Now simply sync your iphone with iTunes.

11. Now you can select the Ringtone you wish.

Monday, March 08, 2010

How to find out the OIM code that gets executed when you click a link on the OIM WebConsole

1. Most of the code is present in the file
C:\oim9102-Jboss\oim-server\xellerate\webapp\xlWebApp.war

2. Extract this file to a temporary directory

3. From the WebConsole note down the URL
i.e.  http://localhost:8080/xlWebApp/AboutXl.do

4. Open the file tiles-defs.xml and look for the entry "AboutXl" in this file

From this we can find out that this is the JSP tjspAboutXlTiles.jsp that gets executed

<definition name="site.AboutXl.page" extends="site.mainLayout">
        <put name="title" value="global.window.title.aboutOIM" />
        <put name="body" value="/tiles/tjspAboutXlTiles.jsp" />
  </definition>

5. Open the file struts-config.xml and look for the entry "tjspAboutXl"

Here you will find the entries as

  <action type="com.thortech.xl.webclient.actions.tcAboutXlAction"
           name="AboutXlForm"
           scope="request"
                 path="/AboutXl" >
    <forward name="success" path="/pages/tjspAboutXl.jsp" />           
    </action>
6. Open the com.thortech.xl.webclient.actions.tcAboutXlAction.class file and here you will find this is
calling some EJB code

if (localActionForward != null)
        return localActionForward;
      HttpSession localHttpSession = paramHttpServletRequest.getSession();
      tcAboutXlForm localtcAboutXlForm = (tcAboutXlForm)paramActionForm;
      Hashtable localHashtable = new Hashtable();
      tcHelpOperationsIntf localtcHelpOperationsIntf = getHelpOperIntf(paramHttpServletRequest.getSession(), null);
      localHashtable = (Hashtable)localtcHelpOperationsIntf.getHelpAbout();
      localtcAboutXlForm.setAboutXl(localHashtable);
      logger.debug(LoggerMessages.getMessage("LeftMethodDebug", "tcAboutXlAction/execute"));
      return paramActionMapping.findForward("success");
7. tcHelpOperationsIntf is the Interface and the corresponding class for this is
tcHelpOperationsBean.java file.

This is actual EJB code it is calling

public Map getHelpAbout()
    throws tcAPIException
  {
    logger.debug(LoggerMessages.getMessage("EnteredMethodDebug", "tcHelpOperationsBean/getHelpAbout"));
    Hashtable localHashtable = new Hashtable();
    localHashtable.put("Version", "9.1.0.1865.28");
    localHashtable.put("Build", "1865.28");
    String str = "select xsd_value as build from xsd where xsd_code='XL_BUILD_NUMBER'";
....
..

How OIM find's out the Version Details

OIM checks the version information from 3 places

1. It checks from the database by issuing the following query

select XSD_VALUE from XSD where XSD_CODE='XL_BUILD_NUMBER';

XSD_VALUE
--------------------------------------------------------------------------------
9.1.0.1866.25

2.  OIM-HOME\config\Version.prop file , this file contains the following entries

#Wed Feb 17 21:14:42 PST 2010
build.number=9.1.0.1866.25
product.version=9.1.0.2

3. There is a third place where this information is hardcoded in the EJB code.

When you click on the OIM WebConsole Help->About this is the EJB code that gets executed. This class is present in the xlDataObjectBeans.jar file.

Check the file tcHelpOperationsBean.java in the com.thortech.xl.ejb.beansimpl package.

com.thortech.xl.ejb.beansimpl.tcHelpOperationsBean.class file contans the version info

public Map getHelpAbout()
    throws tcAPIException
  {
    logger.debug(LoggerMessages.getMessage("EnteredMethodDebug", "tcHelpOperationsBean/getHelpAbout"));
    Hashtable localHashtable = new Hashtable();
    localHashtable.put("Version", "9.1.0.1866.25");
    localHashtable.put("Build", "1866.25");
    String str = "select xsd_value as build from xsd where xsd_code='XL_BUILD_NUMBER'";

....
..

Friday, March 05, 2010

OIM is accepting connections from local host only

1. Open the file C:\oim9102-Jboss\jboss-4.2.3.GA\server\default\deploy\jboss-web.deployer\server.xml
2. Change the line 
<Connector port="8080" address="${jboss.bind.address}" 
to 
<Connector port="8080" address="0.0.0.0" 
After this restart the JBoss server

Friday, February 26, 2010

How to TRACE JDBC Statements from a JDBC Program

1. Copy the jar file ojdbc14_g.jar in to the classpath. In the case of JBOSS application Server copy the file in to the directory D:\OIM9101-Jboss\jboss-4.2.3.GA\server\default\lib.

Please note that if there is a ojdbc14.jar you need to remove this file first.

2. Add the following java arguments to your java program

-Doracle.jdbc.Trace=true -Djava.util.logging.config.file=OracleLog.properties 

If you are using JBOSS App Server then use the following

set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx1024m -XX:PermSize=128m -Doracle.jdbc.Trace=true -Djava.util.logging.config.file=OracleLog.properties 

3. The OracleLog.properties  file contains the following entries

#### Console Handler ######

#java.util.logging.ConsoleHandler.level = ALL
#java.util.logging.ConsoleHandler.formatter =
#java.util.logging.SimpleFormatter
#handlers = java.util.logging.ConsoleHandler

#### File  Handler ######

oracle.jdbc.handlers=java.util.logging.FileHandler
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.pattern=jdbc.log
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter

# Uncomment and/or change the levels for more detail
#oracle.jdbc.level = FINEST
#oracle.jdbc.connector.level = FINE
#oracle.jdbc.driver.level = FINEST
#oracle.jdbc.internal.level = FINEST
#oracle.jdbc.oci.level = FINE
#oracle.jdbc.oracore.level = FINE
#oracle.jdbc.pool.level = FINE
#oracle.jdbc.rowset.level = FINEST
#oracle.jdbc.util.level = FINEST
#oracle.jdbc.xa.level = FINE
#oracle.jdbc.xa.client.level = FINE
#oracle.jpub.level = FINE
#oracle.net.level = FINE
#oracle.sql.level = FINEST
#.level=CONFIG
#oracle.level=CONFIG
# This is the setting needed for sql debug
oracle.jdbc.driver.level=CONFIG
#oracle.jdbc.pool.level=CONFIG
#oracle.jdbc.util.level=CONFIG
#oracle.sql.level=CONFIG

#oracle.jdbc.driver.level=FINE

6. Run your JDBC Program , assuming you statement is

select pty_key , pty_value from pty  where pty_keyword = :1

This is the Bind Parameter value

INFO: OraclePreparedStatement.setString(paramIndex=1, x=XL.MaxLoginAttempts)

Feb 27, 2010 12:00:41 PM oracle.jdbc.driver.PhysicalConnection getDefaultFixedString
INFO: PhysicalConnection.getDefaultFixedString() returning false
Feb 27, 2010 12:00:41 PM oracle.jdbc.driver.OraclePreparedStatement setString
INFO: OraclePreparedStatement.setString(paramIndex=1, x=XL.MaxLoginAttempts)
Feb 27, 2010 12:00:41 PM oracle.jdbc.driver.OracleStatement doExecuteWithTimeout
CONFIG: SQL: "select pty_key , pty_value from pty  where pty_keyword = :1"
Feb 27, 2010 12:00:41 PM oracle.jdbc.driver.T4CPreparedStatement allocateTmpByteArray
SEVERE: oracle.jdbc.driver.T4CPreparedStatement.allocateTmpByteArray : Re-allocate byte array of size : 80
Feb 27, 2010 12:00:41 PM oracle.jdbc.driver.OracleResultSetImpl findColumn
INFO: OracleResultSetImpl.findColumn(columnName=pty_value)
Feb 27, 2010 12:00:41 PM oracle.jdbc.driver.OracleResultSetImpl getString
INFO: OracleResultSetImpl.getString(columnIndex=2)
Feb 27, 2010 12:00:41 PM oracle.jdbc.driver.OracleResultSetImpl close
INFO: OracleResultSetImpl.close()

Friday, December 04, 2009

How do you find whether a Java file is compiled with the debugging info or not

Open the file using the JD-GUI utility
http://java.decompiler.free.fr/?q=jdgui
Click on a particular .class file , after this go to the menu option
Navigate -> Go to Line option
If this option is not grayed out then that particular jar file has the debug info included.
To find the line info you can also use the following
javap -l SearchJars
This will display LineNumberTable
LineNumberTable:
line 13: 0
line 14: 16
line 15: 27
If this comes up then that means the debugging info is included in to the class file.

Wednesday, November 11, 2009

Windows Mobile Programming Tips

How to start the Windows Mobile Emulators from the command line.

"C:\Program Files\Microsoft Device Emulator\1.0\DeviceEmulator.exe"   "C:\Program Files\Windows Mobile 6 SDK\PocketPC\Deviceemulation\0409\PPC_USA.BIN" /memsize 128 /s "d:\EmulatorState_prof.dess"

"C:\Program Files\Microsoft Device Emulator\1.0\DeviceEmulator.exe"   "C:\Program Files\Windows Mobile 6 SDK\Smartphone\Deviceemulation\0409\SP_USA_GSM_QVGA_LS_VR.bin" /memsize 128 /s "d:\EmulatorState_std.dess"

Monday, November 02, 2009

How to use the same server session with the Terminal Server's

1. First try to run the command mstsc /v:fmwbde
(If you are lucky you will be connected to the same session)
2. If you are not able to connect to the same session then run the command mstsc /v:fmwbde /admin
This will connect to the admin server console.
3. Open the terminal service manager and select a particulr session and try to connect to this session.

Monday, October 05, 2009

Deployment Management Links are not working On Weblogic 10. 3.1.0

When trying to access the Deployment Management Links Export and Import are not working with the Weblogic 10.3.1.0 version. This fails with the following error
Either Your Session timed out or you are trying to access a page without logging in.
How ever this works fine on WebLogic 10.3.0.0 version.

There is some change in the functionality due to cross-site scripting vulnerability reasons. Please refer to the Note 866405.1 Applet/Javascript does not have access to JSESSIONID (httponly) cookie for more details on this.

For the Deployment Management Links to work you need to edit the file

C:\oim_server\xellerate\OIMApplications\WLXellerateFull.ear\xlWebApp.war\WEB-INF\weblogic.xml

and add the following entries

<session-descriptor>

<cookie-http-only>false</cookie-http-only>

</session-descriptor>

After the changes the weblogic.xml should look like this ,

<?xml version='1.0' encoding='UTF-8'?> 
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> 
<security-role-assignment> 
<role-name>User</role-name> 
<principal-name>User</principal-name> 
</security-role-assignment> 
<jsp-descriptor> 
<encoding>UTF-8</encoding> 
</jsp-descriptor> 
<container-descriptor> 
<filter-dispatched-requests-enabled>false</filter-dispatched-requests-enabled> 
</container-descriptor> 
<session-descriptor> 
<cookie-http-only>false</cookie-http-only> 
</session-descriptor> 
</weblogic-web-app> 

Restart the weblogic server after the above changes.

Friday, September 04, 2009

How to Install OIM On WebLogic

This summary is not available. Please click here to view the post.

Friday, August 14, 2009

Sorting the files on the drive (USB Drive)

Sony music system in my car reads files in the order they are stored on the flash drive , which is very stupid in my opinion. Ideally it
should read the file in some alphabetical order or based on the last modified date. I found a program call DriveSort which reorganizes the files on a drive so they are in alphabetical order.

Download this program from the location http://www.anerty.net/software/file/DriveSort.php
and open the drive. After this sort the files and save the directory.

Please also refer to this URL for more details on this

http://www.murraymoffatt.com/software-problem-0010.html

Monday, July 27, 2009

Vncviewer clipboard operations like copy/cut+paste suddenly stops on linux

Many times you must have observed that clipboard operations like copy/cut and paste suddenly stops workings with the vncviewer. The main reason for this there is a program called as vncconfig responsible for these clipboard transfers. Some times the program may get closed because of some bug in vnc or some other reasons like you closed that window.

To get those clipboard operations back you need to run the program "vncconfig &".

After this your clipboard actions should work fine with out any problems.

Friday, July 24, 2009

Set up environment for linux to install Oracle Software

// Change sysctl.conf file to add the kernel parmeters

cat >> /etc/sysctl.conf << EOF
#This sets SEMMSL, SEMMNS, SEMOPM, SEMMNI
kernel.sem = 256 32000 100 142
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.msgmnb = 65535
kernel.msgmni = 2878
fs.file-max = 206173
EOF

// Persist the sysctl.conf entries

sysctl –p

// Change the ulimit values

cat >> /etc/security/limits.conf << EOF
# Oracle Application Server settings
* soft nofile 2048
* hard nofile 65536
* soft nproc  2047
* hard nproc  16384
EOF

cat >> /etc/pam.d/login << EOF
session required /lib/security/pam_limits.so
EOF

cat >> /etc/profile << EOF
ulimit -u 16384 -n 65536
EOF

#### Oracle requirements for 11gR2 database ########
kernel.sem = 256 32000 100 142
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.msgmnb = 65535
kernel.msgmni = 2878
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=4194304
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576


RPMs needed for 11gR2 Database


libaio-devel-0.3.106-3.2.i386.rpm
sysstat-7.0.2-3.SEL5_2.i386.rpm
unixODBC-devel-2.2.11-7.1.i386.rpm


local copy at \\disco1bdeapac\home\oracle\softwares\RPM112DB (oracle/oracle) windows browseable

Saturday, July 18, 2009

How to Use Jmeter to do the LDAP/OID Load Testing

This summary is not available. Please click here to view the post.

How to use Jmeter to load test Portal Application

1. Download the latest Jmeter version from http://jakarta.apache.org/jmeter/

2. Set the JDK 1.5 or JDK 1.6 in your path and run jmeter.bat batch file

3. Create a Thread Group with the following values

Set the number of Threads to 50 and the Loop Count to 10. This will send 500 requests to the server

screenshot.9 

4. Under the ThreadGroup create HTTP Cookie Manager with the following values

The CookieManager is required to pass the cookie values across the different page requests. Otherwise Jmeter ignores the cookie value.

In the cookie manager select the Check Bog Clear Cookies each iteration and set the Cookie Policy to Default.

screenshot.10

5. Under the Thread group create a Loop Controller

Right Click on the Thread Group and Add Logical Controller –> Loop Controller

6. Under the Loop Controller Add Sampler –> HTTP Request HTTP Client

Set the Server Name as say xxx.xxx.oracle.com and Port as 7784 enter the Path as /portal/page?_pageid=33,1&_dad=portal&_schema=PORTAL&_mode=16 Select the CheckBox “Follow Redirects”

screenshot.11

7. Under HTTP Request HTTP Client add the HTTP Authorization Manager

Add the Portal username and password in this example I used orcladmin and welcome1.

screenshot.12

8. Add another Portal Page for testing

Under the Loop Controller Add Sampler –> HTTP Request HTTP Client

screenshot.14

9. Add another SSO Protected  Page for testing

Under the Loop Controller Add Sampler –> HTTP Request HTTP Client

Use the following values shown below

screenshot.13

10. This is how the JMeter project looks like after doing the above steps

screenshot.15

11. Now run the Jmeter project by Pressing  Control+R or the Menu option Control+R

12. Check the access_log file for the requests from the Jmeter load test 

Wednesday, June 10, 2009

SSH Setup for RAC

On the incq128ad machine(linux#1)

mkdir -p ~/.ssh
chmod 700 ~/.ssh

/usr/bin/ssh-keygen -t rsa

/usr/bin/ssh-keygen -t dsa

touch ~/.ssh/authorized_keys

On the ipbde  machine(linux#2)

mkdir -p ~/.ssh
chmod 700 ~/.ssh

/usr/bin/ssh-keygen -t rsa

/usr/bin/ssh-keygen -t dsa

touch ~/.ssh/authorized_keys

On the incq128ad machine(linux#1)

ssh incq128ad cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh incq128ad cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh ipbde cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh ipbde cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

scp ~/.ssh/authorized_keys ipbde:.ssh/authorized_keys

On the incq128ad machine(linux#1)
 

cd $HOME
chmod 755 .
chmod 700 .ssh
cd $HOME/.ssh
chmod 600 authorized_keys

On the ipbde machine(linux#2)

cd $HOME
chmod 755 .
chmod 700 .ssh
cd $HOME/.ssh
chmod 600 authorized_keys

On both the machines run the following

ssh incq128ad hostname
ssh ipbde hostname

Wednesday, May 13, 2009

How to read a SSO protected page

You can use wget to get the SSO protected page using the following command


wget --debug --http-user=oc4jadmin   --http-password=welcome1  -O dd.txt http://xxx.xxx.oracle.com:7777/private/dd.txt"

You can use the following code to get the SSO protected page. Download the following jar files
commons-logging.jar , httpcore-4.0.jar , commons-codec-1.3.jar , httpclient-4.0-beta2.jar and
httpmime-4.0-beta2.jar

Run the java program with the following options

d:\jdev10gmin\jdk\bin\javaw.exe -client -classpath D:\jdev10gmin\jdev\mywork\Testing\HTTPClient\classes;E:\ias10134\webservices\lib\commons-logging.jar;D:\httpcomponents-core-4.0\lib\httpcore-4.0.jar;D:\commons-codec-1.3\commons-codec-1.3.jar;D:\httpcomponents-client-4.0-beta2\lib\httpclient-4.0-beta2.jar;D:\httpcomponents-client-4.0-beta2\lib\httpmime-4.0-beta2.jar httpclient.ClientAuthentication1

package httpclient;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;

import java.io.InputStreamReader;

import java.util.List;

import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.cookie.Cookie;
import org.apache.http.impl.client.DefaultHttpClient;

/**
* A simple example that uses HttpClient to execute an HTTP request against
* a target site that requires user authentication.
*/
public class ClientAuthentication1 {

    public static void main(String[] args) throws Exception {
        DefaultHttpClient httpclient = new DefaultHttpClient();
        httpclient.getCredentialsProvider().setCredentials(
        new AuthScope("xxx.xxx.oracle.com", 7777),
        new UsernamePasswordCredentials("orcladmin", "welcome1"));
        HttpGet httpget = new HttpGet("http://xxx.xxx.oracle.com:7777/private/dd.txt");
        System.out.println("executing request \n" + httpget.getRequestLine());
        HttpResponse response = httpclient.execute(httpget);
        HttpEntity entity = response.getEntity();
        List<Cookie> cookies = httpclient.getCookieStore().getCookies();
            if (cookies.isEmpty()) {
              System.out.println("None");
            } else {
              for (int i = 0; i < cookies.size(); i++) {
                System.out.println("- " + cookies.get(i).toString());
              }
            }
        System.out.println("----------------------------------------");
        System.out.println(response.getStatusLine());
        InputStream in =  entity.getContent();
        InputStreamReader inputstreamreader =
            new InputStreamReader(in);
        BufferedReader bufferedreader =
            new BufferedReader(inputstreamreader); 
        System.out.println("--------- URL Contents -----------------");    
        String line;
        while ((line = bufferedreader.readLine())
                  != null) {
            System.out.println(line);
        }
        bufferedreader.close();
        inputstreamreader.close();
                   in.close();   
        System.out.println("----------------------------------------");
        if (entity != null) {
            System.out.println("Response content length: " + entity.getContentLength());
        }
        if (entity != null) {
            entity.consumeContent();
        }

        // When HttpClient instance is no longer needed,
        // shut down the connection manager to ensure
        // immediate deallocation of all system resources
        httpclient.getConnectionManager().shutdown();       
    }
}

Monday, April 13, 2009

How to move the domains across the machines in WebLogic

I have a domain with the name test_domain on my Windows machine , here I have one managed server with some applications deployed.

I would like to move this domain from this machine to the other machine.

On Windows machine use the command pack.cmd to create the domain template

pack.cmd -domain=E:\bea\user_projects\domains\test_domain  -template=C:\bea\user_templates\test_domain.jar -template_name="My WebLogic Test Domain"

Now move the test_domain.jar  to the linux machine.

On the linux machine run the unpack.sh command to create the domain

unpack.sh -template=/home/ias/test_domain.jar -domain=/home/ias/bea/user_projects/domains/test_domain

After this go to the directory and run the command ,
cd /home/ias/bea/user_projects/domains/test_domain/bin
startWebLogic.sh
startManagedWebLogic.sh test  http://localhost:7001