Friday, August 30, 2013

WAS and Oracle Connection Not Available Cause being java.lang.AbstractMethodError

With a specific version of WAS ND, i.e., 7.0.0.15 and 7.0.0.17 the connection to a Oracle repository seems to always fail with Connection Not Available or something similar to this. If you are using an enterprise application you might see the "Attempt to start the Enterprise bean#bean id failed with an exception" and the cause might be a "java.lang.AbstractMethodError: java/sql/Wrapper.isWrapperFor(Ljava/lang/Class;)Z"

This is a known issue with the specific versions of WAS and APARs have been created to address the same. You can find the problem report and resolution summary in the below links
http://www-01.ibm.com/support/docview.wss?uid=swg1PM34365
http://www-01.ibm.com/support/docview.wss?uid=swg21474061

You can download the iFix from here.
http://www-01.ibm.com/support/docview.wss?uid=swg24029891

Saturday, January 26, 2013

Why THIS has to be THIS only ??

This post is a placeholder of references to certain questions for which there is no definitive answer, but always good to know.

1. Why do we need abstract classes in Java? In other words whats the difference between an abstract class and a concrete class?

Check out here : http://stackoverflow.com/questions/10211317/how-is-abstract-class-different-from-concrete-class

2. Why NULL isn't nothing or empty string in Oracle?

A lot of time and lot of effort has been spent on this. Well that's how Oracle behaves. However there are ways in which this can be handled.

Check out here : http://www.oracle.com/technetwork/issue-archive/2005/05-jul/o45sql-097727.html

Thursday, June 7, 2012

SQL1092N "USER" does not have the authority to perform the requested operation

Installing DB2 on machine using a domain account could at times leave that particular domain account from having rights to perform actions like CREATE, UPDATE, etc., 

The reason being, if a user logs on to a domain account and tries to access a DB2 database, DB2 goes to a Domain Controller to enumerate groups (including the Administrator's group). You can change this behavior in either of two ways:

1. Set the registry variable DB2_GRP_LOOKUP = local and add the domain accounts (or global groups) to the local Administrators group.

DB2SET DB2_GRP_LOOKUP=LOCAL
DB2STOP
DB2START

2. Update the database manager configuration file to specify a new group. If you want that group enumerated on the local machine, then you must also set the DB2_GRP_LOOKUP registry variable.

By default in a Windows NT domain environment, only domain users that belong to the Administrators group at the Primary Domain Controller (PDC) have SYSADM authority on an instance. Since DB2 always performs authorization at the machine where the account is defined, adding a domain user to the local Administrators group on the server does not grant the domain user SYSADM authority to the group. So to do that, run the following commands

DB2 UPDATE DBM CFG USING SYSADM_GROUP <global_group> 
DB2STOP
DB2START


Note : global_group named DB2ADMNS would have got created on the local machine, had you chosen the option to enable administrative security while installing DB2. Use the same group, else use any of the global groups in your network.

You have tried the above mentioned steps and you still end up seeing the same error message, the following commands might help (it does most of the times)

Run the db2set like below, to see if the DB2_GRP_LOOKUP registry value is set properly. 

C:\IBM\SQLLIB\BIN>db2set -all
[e] DB2PATH=C:\IBM\SQLLIB
[i] DB2_USE_ALTERNATE_PAGE_CLEANING=ON
[i] DB2_INLIST_TO_NLJN=YES
[i] DB2_REDUCED_OPTIMIZATION=YES
[i] DB2INSTOWNER=MAGNETO
[i] DB2PORTRANGE=60000:60003
[i] DB2_GRP_LOOKUP=LOCAL
[i] DB2INSTPROF=C:\PROGRAMDATA\IBM\DB2\DB2COPY1
[i] DB2COMM=TCPIP
[g] DB2_EXTSECURITY=YES
[g] DB2_COMMON_APP_DATA_PATH=C:\ProgramData
[g] DB2SYSTEM=MAGNETO
[g] DB2PATH=C:\IBM\SQLLIB
[g] DB2INSTDEF=DB2
[g] DB2ADMINSERVER=DB2DAS00

Now append the value TOKENLOCAL to the DB2_GRP_LOOKUP registry entry like below. This works like magic most of the times.

DB2SET DB2_GRP_LOOKUP=LOCAL,TOKENLOCAL
DB2STOP
DB2START

The above steps should have helped you see through the error. If the error still persists, reboot the machine and retry all the steps. 

Tuesday, May 10, 2011

NullPointerException and Java

When I first started programming in Java, that was like few years ago, with the little background that I had of C the first thing I learnt was, Java does not have Pointers

Why doesn't it have Pointers?
Structures were removed and gone, and arrays and strings are objects, the need for pointers to these constructs goes away.

Why Structures were removed?
You don't need structures and unions when you have classes; you can achieve the same effect simply by declaring a class with the appropriate instance variables.

So now we have enough reasons as to why Java didn't have Pointers.

Having said that it makes me wonder why is there an exception called NullPointerException when there is no Pointer in Java. I am very sure the Java developers would have some reason to have named this the way it is today. May be they could have named it NullReferenceException. But obviously they didn't. The following are my guesses as to why it can still be called so
  • Its not that Java does not have Pointers
  • In fact every reference in Java is ideally a Pointer (except for primitive types)
  • Its just that Java doesn't support Pointer arithmetic

Monday, July 19, 2010

Being an Engineer

Shift from a being a DEV guy, to becoming an ENGINEERING guy is something that not everyone would prefer to do. Why? For the simple reason, not many people understand what an ENGINEERING guy does. People see ENGINEERS as TESTERS, Black Box testers, and to them being a tester is being below their dignity level. For even, I thought so during my initial days of IT. I was too naive and I didn't know what role the testers played.

But after having treaded the road for about FOUR good years I stand in a position where I can see the point in needing/being a tester and there is nothing to be ashamed about it. But for testers, developers would be in soup, deep soup. I am not kidding. Assume a product/solution is being delivered without passing the QA(Quality Assurance). Of-cos, it was shipped after all the unit test cases developed by the developers passed and they were quite satisfied the product/solution is bug free. What the developers fail to do is to come up with use cases that are more likely the customers come up with. Putting it in simple terms they focus more than the positive scenarios and give a little attention to the negative scenarios. From the customers point of view, even something as trivial as a spelling mistake in the ack or error message is unacceptable and it would get escalated. When a bug is raised by the customer, the developer would be the one who will have to face the hot seat. I am sure, no developer would want himself to be placed there. Trust me, its not a pleasant experience being there.

This is where someone with a different perspective becomes necessary. The someone who can think beyond specifications of the application and try simulating real time scenarios. And this someone is ideally an ENGINEER/TESTER. Well, I am not going to discuss more about TESTER, because I am still not very sure as to what exactly his role would be. Now that I have been an ENGINEER for about an year, I can throw enough light on what it is like being one. First, an Engineer is not only a Tester. An Engineer should be aware of the technology being used in the product/solution that needs to be tested which a Tester can be least bothered about. Engineers primary responsibility is to break what the developer builds. What I call as "Breaking the Code". This means, an Engineer has to code to break the code. So being an engineer gives the exposure to both paradigms of software building, "cranking" and "breaking". An Engineer also tests the coverage of the code developed. Additionally an engineer should find ways in which the test execution environment can be automated. This means an Engineer gets exposed to build frameworks and automation tools. In short, being an Engineer involves more than just testing the product/solution.

Thursday, February 25, 2010

Blat - A mailing utility

Often developers/testers come across scenarios where in they have to notify a team once a deployment or build is complete. There are many build management tools that provide us with such an option. There could be scenarios where in Maven or Ant is used for building purpose. In such scenarios emailing options should be considered through a third party tool. One such tool is "BLAT"

Blat is a Win32 command line utility that sends eMail using SMTP or post to usenet using NNTP. SMTP being the protocol that we use for email communication, Blat provides us with the option to send mails to the intended recipients.

Doing it the ANT way

Assuming your build process is setup using Ant and the last step that you want to do is to send an email. This is how to write an Ant target to achieve the same

  <target name="email-report">
         <exec dir="${basedir}"
          executable="${basedir}/../thirdparty/blat/blat.exe"
          os="Windows XP,Windows 2000,Windows 2003,Windows Server 2003,Windows Server 2008">
               <arg file="<location of the file you want to send as an attachment if any>"/>
               <arg line="-to <email address of the recipient>"/>
               <arg line="-f  <email address of the sender>"/>
               <arg line="-server <the SMTP server address>"/>
               <arg line="-i <email alias name>"/>
               <arg line="-s <'your subject within single quotes'>"/>
         </exec>
  </target>

Doing it the BAT way

Suppose if you have automated ur build process using batch script invoking specific goals or target and would like to also trigger mails from the batch, here is how you go about it.

<Location where blat is installed>\blat.exe "Attachment if any" -to "Recipient Email address" -f "Senders Email address" -i "Sender Email Alias" -s "Subject Line" -server "SMTP Server address"

This is a very simple email utility that not many of us know about. Happy mailing :)

Sunday, January 24, 2010

Wanna change network settings to work at different locations?

People working with laptops might have to swap the network settings depending on the location they work at. Normal usage being at Home and at Work. At work places these settings are normally defined by the DHCP and at home its a STATIC source most of times.

I have come up with a batch script using which you can switch between these network settings without having to change them manually whenever your work location changes. All that has to be done to copy the below script into a file and name it *.bat and just double click it. You might have to key in your work location as an arg when you run this.

Don't forget to define the following variables varip, varsm, vargw, vardns1 and  vardns2 with your network specific entries. (Your service provider must have provided you with these entries)

 ******** COPY THE SOURCE BELOW ********

@ECHO OFF

ECHO Change network setting for (Home/Work)?

set/p "cho=>"

if %cho%==Home goto HOME
if %cho%==HOME goto HOME
if %cho%==Work goto WORK
if %cho%==WORK goto WORK

:HOME
set varip=

set varsm=

set vargw=

set vardns1=

set vardns2=

REM ***** You don’t need to change anything below this line! ******

ECHO Setting IP Address and Subnet Mask

netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm%

ECHO Setting Gateway

netsh int ip set address name = "Local Area Connection" gateway = %vargw% gwmetric = 1

ECHO Setting Primary DNS

netsh int ip set dns name = "Local Area Connection" source = static addr = %vardns1%

ECHO Setting Secondary DNS

netsh int ip add dns name = "Local Area Connection" addr = %vardns2%

GOTO DISPLAY

:WORK

ECHO Setting IP Address

netsh int ip set address name = "Local Area Connection" source = dhcp

ECHO Setting DNS

netsh int ip set dns name = "Local Area Connection" source = dhcp

GOTO DISPLAY

:DISPLAY

ECHO Here are the new settings for %computername%:

netsh int ip show config

pause.