Anirudh Sonthalia

+ Follow
since Jul 30, 2006
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anirudh Sonthalia

Hi Bear

I'm sorry, I'm not sure what you mean by UBB code tags, anyways, it this post looks less readable I will definitely work on it from the next time.

Thanks for your input Ulf, I'll check out jWebUnit.
Hi Guys

I've a problem. I've to use to programmatically login to some web sites. Now the big problem that I'm facing is that if those websites have some relative URLs in their login pages then when I read that login page's code through HttpURLConnection, those URLs are not recognized and I get an error saying web group not found for those relative URLs. Now I checked out the package, I couldn't find any solution to this, I hope I didn't overlooked anything here. Can you please suggest. Also, not just this, but for lot of web sites where I 've to achieve Single Sign On using WebSphere Portal Credential vault(which just stores user/password information), the loging is not having even though there are no relative URLs, I dont know why, lot of them have some active controls on their login pages, others have multiple screens to take user/password information, I'm trying to find a workaround.

Any help here woul dbe really appreciated. It's been long that I've been trying to find a solution to this.

The following is the code I'm using :

HttpURLConnection connection = getConnectionUsingPassiveObject(request, null, host, proxy, port, path, slotId, protocol);

if (connection != null)
System.out.println("Connected found not null");
System.out.println( "Connected successfully" );

connection.setFollowRedirects( false );
connection.setInstanceFollowRedirects( false );

System.out.println( "connection.getFollowRedirects() : " + connection.getFollowRedirects() );
System.out.println( "connection.getInstanceFollowRedirects() : " + connection.getInstanceFollowRedirects() );
System.out.println( "connection.usingProxy() : " + connection.usingProxy() );

Object content = connection.getContent();
String contentType = connection.getContentType();
FileNameMap fMap = connection.getFileNameMap();

Class class1 = content.getClass();
Field[] fields = class1.getDeclaredFields();
Method[] methods = class1.getDeclaredMethods();
for(int i=0;i<fields.length;i++)
System.out.println("field[" + i +"] : " + fields[i] );

for(int i=0;i<methods.length;i++)
System.out.println("method[" + i + "] : " + methods[i] );

//System.out.println("methods : " + methods );


System.out.println("Content : " + content );
System.out.println("ContentType : " + contentType );
System.out.println("fMap : " + fMap);

String responseMessage = connection.getResponseMessage();
int responseCode = connection.getResponseCode();
System.out.println( " connection.getHeaderFields() : " + connection.getHeaderFields() );
//System.out.println( " connection.getRequestProperties() : " + connection.getRequestProperties() );
//Were we successful?
if (HttpURLConnection.HTTP_OK == responseCode)
System.out.println("HttpResponseCode found OK");
result.append("<H4>Successfully connected!</H4>");
System.out.println("HttpResponseCode found not OK");
"<P>Unable to successfully connect to back-end server, HTTP Response Code = "
+ responseCode + ", HTTP Response Message = \""
+ responseMessage + "\"</P>"
response.getWriter().write( result.toString() );


BufferedReader br =new BufferedReader(
new InputStreamReader(connection.getInputStream())
System.out.println( "br : " + br );

String line = null;
while ((line = br.readLine()) != null)
System.out.println( "br.readLine() : " + line );
result.append(line + "\n");

response.getWriter().write( result.toString() );

}//if (connection != null) ends
System.out.println("Connection found null.");
result.append("<h2>Credential not found. Please set it in edit mode!</h2>");
response.getWriter().write( result.toString() );


public static HttpURLConnection getConnectionUsingPassiveObject
PortletRequest portletRequest,
AveryCredVaultDemoPortletSessionBean sessionBean,
String host,
String proxy,
String port,
String path,
String slotID,
String protocol
String userId = null;
String password = null;
HttpURLConnection connection = null;

//getCredential(portletRequest, sessionBean, userid, password);

UserPasswordPassiveCredential cred =
(UserPasswordPassiveCredential) vaultService.getCredential( slotID, "UserPasswordPassive", null, portletRequest );

if ( cred != null )
System.out.println("Credential Slot Found successfully");
char[] charArr = cred.getPassword();
password = "";
for(int i=0; i<charArr.length; i++)
//System.out.println( "char[" + i + "]" + charArr[i] );
password = password + charArr[i];
//System.out.println( "password : " + password );
//password = cred.getPassword() != null ? cred.getPassword().toString() : "";
userId = cred.getUserId();
System.out.println("Credential Slot Couldn't be found");

if ( !"".equals( userId ) )
String userAndPassword = new String( userId.toString() + ":" + password.toString() );
byte[] userAndPasswordBytes = userAndPassword.getBytes();

//System.out.println( "user assword : " + userAndPassword );

BASE64Encoder encoder = new BASE64Encoder();

String basicAuth = new String( encoder.encode( userAndPasswordBytes ) );
basicAuth = "Basic " + basicAuth;

//System.out.println( "URL : " + protocol + host + ":" + port + path );

URL url = null;
System.out.println( "PortNo : " + port );

String portStr = "";

if( port != null && !"".equals( port.trim() ) && !"-1".equals( port.trim() ) )
portStr = ":" + port;

System.out.println( "URL : " + protocol + host + portStr + path );
url = new URL( protocol + host + portStr + path );

/*if( proxy != null && !"".equals( proxy.trim() ) && !"null".equals( proxy.trim() ) )
System.out.println( "URL : " + protocol + "," + proxy + "," + Integer.parseInt(port) + "," + host + path );
url = new URL( protocol, proxy, Integer.parseInt(port), host + path );
System.out.println( "URL : " + protocol + host + portStr + path );
url = new URL( protocol + host + portStr + path );

int proxyPortNo = 8080;
// "http://"
/*if( proxy != null && !"".equals( proxy.trim() ) && !"null".equals( proxy.trim() ) )
System.out.println("Opening URL Connection through Proxy");
connection = (HttpURLConnection) url.openConnection( new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxy, proxyPortNo) ) );
connection = (HttpURLConnection) url.openConnection();

connection = (HttpURLConnection) url.openConnection();

connection.setRequestProperty( "authorization", basicAuth );
catch (Exception e)

return connection;

So, if somebody can comment on this it'll be great help. Also I couldn't find a way to make a URL connection through a proxy, I know that in JDK 5.0 we can do this, by using URL.openConnection(Proxy), but no soln in jdk 1.4, which is the version of our server where I've to do this thing.
So this is another problem.

I tried looking into Apache HttpClient, HttpCore, but no soln yet.

I'm getting this error in my java swing application, please help :

# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x080ab0d6, pid=340, tid=1084
# Java VM: Java HotSpot(TM) Client VM (1.4.2_13-b06 mixed mode)
# Problematic frame:
# V [jvm.dll+0xab0d6]

--------------- T H R E A D ---------------

Current thread (0x009f76c0): VMThread [id=1084]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

EAX=0x00000012, EBX=0x00b33108, ECX=0x00000000, EDX=0x00000000
ESP=0x02affad8, EBP=0x02affb24, ESI=0x00000000, EDI=0x02affba4
EIP=0x080ab0d6, EFLAGS=0x00010246

Top of Stack: (sp=0x02affad8)
0x02affad8: 00b33108 08046f54 00000012 00000001
0x02affae8: 00000000 02affb94 080ab15f 00b331e2
0x02affaf8: 00000001 02affba4 02affb94 00b33108
0x02affb08: 00000000 02affb64 08074329 02affcfc
0x02affb18: 02affba0 02affb94 0805cf4e 02affb78
0x02affb28: 080ab122 02affb94 00b33108 02affba4
0x02affb38: 02affcfc 080ab126 081265e8 081265e8
0x02affb48: 0805cdd4 02affb94 00b33108 02affba4

Instructions: (pc=0x080ab0d6)
0x080ab0c6: 24 0c 7d 08 42 83 c0 04 3b d6 7c ee 8b 49 08 5f
0x080ab0d6: 8b 04 91 8b 70 04 3b 74 24 0c 5e 74 04 8b 44 91

Stack: [0x02ac0000,0x02b00000), sp=0x02affad8, free space=254k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0xab0d6]
V [jvm.dll+0xab122]
V [jvm.dll+0xd3bc8]
V [jvm.dll+0xd5013]
V [jvm.dll+0x58613]
V [jvm.dll+0x5ef12]
V [jvm.dll+0x48e95]
V [jvm.dll+0x5f0aa]
V [jvm.dll+0xe39a6]
V [jvm.dll+0xe3b4e]
V [jvm.dll+0xe38b7]
C [MSVCRT.dll+0x2a3b0]
C [kernel32.dll+0xb683]

VM_Operation (0x0395efa4): generation collection for allocation, mode: safepoint, requested by thread 0x02ce3c98

--------------- P R O C E S S ---------------

Java Threads: ( => current thread )
0x00035df8 JavaThread "DestroyJavaVM" [_thread_blocked, id=344]
0x02dd0e40 JavaThread "Thread-4" [_thread_blocked_trans, id=2116]
0x02ce5930 JavaThread "t1" [_thread_blocked, id=2112]
0x02ce3c98 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1556]
0x02cecbc8 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=1432]
0x02d0f8e0 JavaThread "AWT-Windows" daemon [unknown thread state, id=1388]
0x00a10b40 JavaThread "AWT-Shutdown" [_thread_blocked, id=1396]
0x009bc760 JavaThread "CompilerThread0" daemon [_thread_blocked, id=520]
0x009bbaf0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=924]
0x009b8fa0 JavaThread "Finalizer" daemon [_thread_blocked, id=1092]
0x009b7c18 JavaThread "Reference Handler" daemon [_thread_blocked, id=1088]

Other Threads:
=>0x009f76c0 VMThread [id=1084]
0x009f8e88 WatcherThread [id=480]

VM state:at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event])
[0x00035480/0x00000728] Threads_lock - owner thread: 0x009f76c0
[0x00035600/0x000006ec] Heap_lock - owner thread: 0x02ce3c98

def new generation total 960K, used 924K [0x10010000, 0x10110000, 0x104f0000)
eden space 896K, 99% used [0x10010000, 0x100effb0, 0x100f0000)
from space 64K, 44% used [0x10100000, 0x101071e8, 0x10110000)
to space 64K, 0% used [0x100f0000, 0x100f0000, 0x10100000)
tenured generation total 12028K, used 9711K [0x104f0000, 0x110af000, 0x14010000)
the space 12028K, 80% used [0x104f0000, 0x10e6bcf8, 0x10e6be00, 0x110af000)
compacting perm gen total 7936K, used 7731K [0x14010000, 0x147d0000, 0x18010000)
the space 7936K, 97% used [0x14010000, 0x1479cfd0, 0x1479d000, 0x147d0000)

Dynamic libraries:
0x00400000 - 0x0040b000 c:\Progra~1\Java\j2re1.4.2_13\bin\java.exe
0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f4000 C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f01000 C:\WINDOWS\system32\RPCRT4.dll
0x77c10000 - 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
0x08000000 - 0x08142000 c:\Progra~1\Java\j2re1.4.2_13\bin\client\jvm.dll
0x7e410000 - 0x7e4a0000 C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll
0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.DLL
0x629c0000 - 0x629c9000 C:\WINDOWS\system32\LPK.DLL
0x74d90000 - 0x74dfb000 C:\WINDOWS\system32\USP10.dll
0x10000000 - 0x10007000 c:\Progra~1\Java\j2re1.4.2_13\bin\hpi.dll
0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
0x003b0000 - 0x003be000 c:\Progra~1\Java\j2re1.4.2_13\bin\verify.dll
0x003c0000 - 0x003d9000 c:\Progra~1\Java\j2re1.4.2_13\bin\java.dll
0x003e0000 - 0x003ee000 c:\Progra~1\Java\j2re1.4.2_13\bin\zip.dll
0x02ec0000 - 0x02ed7000 C:\Program Files\IBM\SQLLIB\BIN\db2jdbc.dll
0x7c340000 - 0x7c396000 C:\WINDOWS\system32\MSVCR71.dll
0x6c010000 - 0x6c5b2000 C:\PROGRA~1\IBM\SQLLIB\BIN\DB2APP.dll
0x6d850000 - 0x6d9a9000 C:\PROGRA~1\IBM\SQLLIB\BIN\DB2SYS.dll
0x742b0000 - 0x742bd000 C:\PROGRA~1\IBM\SQLLIB\BIN\DB2WINT.dll
0x02ee0000 - 0x02f07000 C:\PROGRA~1\IBM\SQLLIB\BIN\DB2SYSP.dll
0x6d9b0000 - 0x6db5e000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2osse.dll
0x02f10000 - 0x02f7d000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2g11n.dll
0x02f80000 - 0x02f8c000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2locale.dll
0x02f90000 - 0x02f99000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2sec.dll
0x5b860000 - 0x5b8b4000 C:\WINDOWS\system32\NETAPI32.dll
0x02fa0000 - 0x02faa000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2trcapi.dll
0x02fb0000 - 0x02fb7000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2install.dll
0x02fc0000 - 0x02feb000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2genreg.dll
0x71ab0000 - 0x71ac7000 C:\WINDOWS\system32\WS2_32.dll
0x71aa0000 - 0x71aa8000 C:\WINDOWS\system32\WS2HELP.dll
0x71a50000 - 0x71a8f000 C:\WINDOWS\system32\MSWSOCK.dll
0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
0x02ff0000 - 0x03007000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2dascmn.dll
0x03010000 - 0x03021000 C:\PROGRA~1\IBM\SQLLIB\BIN\db2osse_db2.dll
0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
0x77120000 - 0x771ac000 C:\WINDOWS\system32\OLEAUT32.dll
0x77690000 - 0x776b1000 C:\WINDOWS\system32\NTMARTA.DLL
0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll
0x71bf0000 - 0x71c03000 C:\WINDOWS\system32\SAMLIB.dll
0x03080000 - 0x0308f000 C:\Program Files\Java\j2re1.4.2_13\bin\net.dll
0x76f20000 - 0x76f47000 C:\WINDOWS\system32\DNSAPI.dll
0x76fb0000 - 0x76fb8000 C:\WINDOWS\System32\winrnr.dll
0x76fc0000 - 0x76fc6000 C:\WINDOWS\system32\rasadhlp.dll
0x662b0000 - 0x66308000 C:\WINDOWS\system32\hnetcfg.dll
0x71a90000 - 0x71a98000 C:\WINDOWS\System32\wshtcpip.dll
0x77fe0000 - 0x77ff1000 C:\WINDOWS\system32\Secur32.dll
0x030c0000 - 0x030c9000 C:\PROGRA~1\IBM\SQLLIB\security\plugin\IBM\client\IBMOSauthclient.dll
0x030d0000 - 0x030e0000 C:\PROGRA~1\IBM\SQLLIB\bin\icc\icc\icclib\icclib.dll
0x030e0000 - 0x0319d000 C:\PROGRA~1\IBM\SQLLIB\bin\icc\icc\osslib\libeay32.dll
0x71ad0000 - 0x71ad9000 C:\WINDOWS\system32\WSOCK32.dll
0x74d70000 - 0x74d81000 C:\PROGRA~1\IBM\SQLLIB\bin\db2tcp.DLL
0x031d0000 - 0x032e4000 C:\Program Files\Java\j2re1.4.2_13\bin\awt.dll
0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV
0x5ad70000 - 0x5ada8000 C:\WINDOWS\system32\uxtheme.dll
0x03350000 - 0x033a1000 C:\Program Files\Java\j2re1.4.2_13\bin\fontmanager.dll
0x73760000 - 0x737a9000 C:\WINDOWS\system32\ddraw.dll
0x73bc0000 - 0x73bc6000 C:\WINDOWS\system32\DCIMAN32.dll
0x73940000 - 0x73a10000 C:\WINDOWS\system32\D3DIM700.DLL
0x74720000 - 0x7476b000 C:\WINDOWS\system32\MSCTF.dll
0x755c0000 - 0x755ee000 C:\WINDOWS\system32\msctfime.ime
0x038c0000 - 0x038de000 C:\Program Files\Java\j2re1.4.2_13\bin\jpeg.dll
0x038a0000 - 0x038a8000 C:\Program Files\Java\j2re1.4.2_13\bin\nio.dll
0x039b0000 - 0x039e9000 C:\Program Files\Ivest\Rp1210Wrapper.dll
0x76c30000 - 0x76c5e000 C:\WINDOWS\system32\WINTRUST.dll
0x77a80000 - 0x77b14000 C:\WINDOWS\system32\CRYPT32.dll
0x77b20000 - 0x77b32000 C:\WINDOWS\system32\MSASN1.dll
0x76c90000 - 0x76cb8000 C:\WINDOWS\system32\IMAGEHLP.dll
0x03e60000 - 0x03e6c000 C:\WINDOWS\system32\V1939C32.dll
0x03fc0000 - 0x03fe8000 C:\WINDOWS\system32\VCAND32.DLL
0x77920000 - 0x77a13000 C:\WINDOWS\system32\SetupApi.dll

VM Arguments:
java_command: Com.International.ShopFloor.VehicleElectronics.VESFSStation.App
Launcher Type: SUN_STANDARD

Environment Variables:
PROCESSOR_IDENTIFIER=x86 Family 6 Model 11 Stepping 4, GenuineIntel

--------------- S Y S T E M ---------------

OS: Windows XP Build 2600 Service Pack 2

CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse

Memory: 4k page, physical 261040k(70148k free), swap 640952k(383360k free)

vm_info: Java HotSpot(TM) Client VM (1.4.2_13-b06) for windows-x86, built on Oct 18 2006 10:10:57 by "java_re" with MS VC++ 6.0
16 years ago
Well POJO's means just Plain old java objects, what I mean to say here is I didn't use let's say entity beans to represent business entities like Segment, Flight, etc. Further to decide whether to use Stateless/Stateful, Entity, I used a method which let me decide by how & which module will be facig te highest payload, e.g. Out of the many users that will work in the portal, maximum process load will be due to flight searches, then there are other things which will be contributing to hihg workload on the server but less than Flight searches. So, this was my approach. Once identified I divided these as either services or EJB, whatever my design came upto. This is what I was trying to convey. This is very abstract difficukt to understand may be, but that's how I started up, to take care of performace requiremetns initially itself.
I'm getting lot of queries on my mail regarding SCEA, I suggest to all of them who have questions with me, to put all their queries here, so that others can also benefit from it, as this is a forum which serves the same purpose.
Would like answer some queries I received in mail.

Sun knows the fact very well that a design can be presented in different ways, the fear that your design presentation will
be accepted or not, is fair, but let me tell you you should overcome this, because you just have to follow the UML guidelnes, rest varies from person to person.

Like what elements will you show in the sequence diagram, you can show uptill class level , JSP/servlet level or you can show in terms of groupings, like one representing the HTMl/GUI, then your FFMS system, then your database, etc like this.

I think you should follow this :

1) Your design should be well explained

2) Should consider crucial points, e.g. there may be issues with seat booking that two users are let's say booking, who will get priority, etc how it will happen. So things like that.

3) Make it really simple with all information that you think you would require while checking the assignment.

4) Follow best practices & design patterns.

5) Last & Most imp is the Pet store application, see how Sun wants J2ee applications to look like, their design & everything.

Sun creates blueprints only to convey how they want things to be.

If you need any other clarification, feel free to revert back.
I'll try my level best to help you out.
I took Part 3 on 15 Nov. just after uploading the assignment.
Andrew I kept them as POJOs & my design was pretty simple & staright forward.
Depending upon the processing load, I divided the application load nto 5 modules, then implemented them as EJB which would handle those high load processing areas & give scalability & workload management.
Well For SCEA Part 1, refer to SCEA links at javaranch, that's really good.
Then for Part 2 & 3 refer to the same as well as replies by posts, I mean what you are already referring, i.e. other's experiences.

UML Distilled is a good book.
Hi franziska, can you please send me the assignment that you uploaded to Sun, may be I can help you what's missing. You can mail me the jar to Don't worry you'll pass in the next attempt, we just need to check out what's wrong in the design & rectify the understanding.
: Sun Certified Enterprise Architect for Java 2 Platform Enterprise Edition Technology Part II (310-061)
Date Taken: 2006-12-21 15:24:25.620
Registration Number: o12syd52b7
Site: iin29
Grade: P
Score: 91
Comment: This report shows the total points that could have been awarded in each section and the actual amount of points you were awarded. This information is provided in order to give you feedback on your relative strengths on a section basis. The maximum number of points you could have received is 100, minimum to pass is 70. Class Diagram (44 maximum) .......................... 40 Component Diagram (44 maximum) ...................... 39 Sequence/Collaboration Diagrams (12 maximum) ........ 12
Hi guys, i'm a silent observer of this forum, I think Kathy is a Role Model.
She is the only Java Guru in this world. She has created this world of, which can help you do somethign in java world.
But But there's one very imp thing that I feel like mentioning here is that people who get benefitted with this forum should give back too.
Like now I'll make sure that I respond to queries for other people to benefit from this forum. This is very imp. bcoz if we don't realize so, this forum may not always be what it is today.
So thanks to every body & biggest thanks to the ONE AND ONLY - K A T H Y
Congrats man !
how long did it take for you for the results to be out ?
I've taken Part 3, since 5 weeks no results
Checked both Cert Maneger & i7 both.
What can I do to celebrate a HAPPY New year ?
Thanks Mikalai, please inform us once te server is up, I'
m also in need of the same notes.
I completely agree with Karthi keyan.
I took SCEA 3rd part on 15th Nov.
Still waiting for results.