This user hasn't shared any biographical information

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)

Problem: While connecting to MySQL from command line on MySQL 5.7, receiving the below error

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)

Solution: To solve this problem, download an older version from the archives, say 5.6.28 and copy the “data” folder under mysql-5.6.28-winx64 to mysql-5.7.11-winx64

Once data folder is copied, open a command prompt in admin mode and navigate to bin directory and uninstall existing MSQL service

C:\mysql-5.7.11-winx64\bin>sc delete MySQL

After existing MySQL service is uninstalled, install MySQL service again

C:\mysql-5.7.11-winx64\bin>mysqld –install
Service successfully installed.

C:\mysql-5.7.11-winx64\bin>mysqld start

now open a commnad prompt and type services.msc, if MSQL service is not running, open the service and start.

Once the sercice is running, test the connection using MySQL Workbench. When trying to connect using workbench, you will receive the below error

Table ‘performance_schema.session_variables’ doesn’t exist

This is because we copied data folder from an older version of mysql to a new version. If you do not copy, mysql wont even start in the first place. To resolve performance_schema table issue, lets upgrade the mysql as shown below.

C:\mysql-5.7.11-winx64\bin>mysql_upgrade -u root -p –force
Enter password:
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK

Leave a comment

Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults for context configuration

Problem: Running JUnit 4 with Spring 3 and getting below exception


Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults for context configuration


Solution: Add locations attribute to the contextConfiguration.

@ContextConfiguration(locations = {“classpath:applicationContext.xml”}) for the JUnit to refer to the beans Definition.



Leave a comment

Cannot execute mojo: resources. It requires a project with an existing po m.xml, but the build is not using one.

Problem: Cannot execute mojo: resources. It requires a project with an existing po
m.xml, but the build is not using one.

This error simply means there is not pom.xml in the working directory. From the path,where the mvn jetty:run is being run, pom.xml does not exist.

Navigate to the right directory and run the command being tried again should resolve the issue.

Leave a comment

The plugin ‘org.apache.maven.plugins:maven-jetty-plugin’ does not exist o r no valid version could be found

Problem: The plugin ‘org.apache.maven.plugins:maven-jetty-plugin’ does not exist o
r no valid version could be found


Performing mvn jetty:run is throwing this error and infact maven-jetty-plugin does not exist in pom.xml. Instead of adding it every pom.xml that tries to use jetty, instead plug-in is added to settings.xml as below


<!– pluginGroup
| Specifies a further group identifier to use for plugin lookup.

Leave a comment

How to search a string in clob column in oracle

Problem: How to search for a string in a CLOB Column

Solution: Suppose you have a table with a CLOB column and you want to search for an occurence of the string in the clob column, you can do like


Replace with your table name, CLOB Column name in the table and with the actual search string.

Leave a comment

ORA-04091:table is mutating, trigger/function may not see it

Problem: ORA-04091:table is mutating, trigger/function may not see it

Solution: There are various solutions to solve this, however it requires deeper understanding on what mutating error is and how to resolve this. You will encounter this when working on a trigger for a particular table and the trigger code is accessing the same table on which the trigger is operating on.

Simple solution is to remove references to any usage of the table on which trigger is operating on, if at all possible. How ? Go on…



Suppose the trigger is on the ORDERS table FOR EACH ROW and BEFORE  UPDATE. Trigger is to update  the ORDER_DETAILS table for a particular existing order along with updating the timestamp in ORDERS table. To do so, if you try to access the ORDER_DETAILS as below, you will end up with mutating error, as in




I have added some reference down below to understand :NEW and :OLD for those who want to understand how to use them in triggers. In the above query, problem is trigger is on ORDERS table and trigger is also trying to access the ORDERS table. Here there is no need to access ID from ORDERS table to join with ORDER_DETAILS Details.   

Instead, simplify the query by removing the references to ORDERS table to avoid mutating error




Identifying scenarios like this before dwelling into complex solutions will save time 🙂

Accessing Column Values in Row Triggers

Within a trigger body of a row trigger, the PL/SQL code and SQL statements have access to the old and new column values of the current row affected by the triggering statement. Two correlation names exist for every column of the table being modified: one for the old column value, and one for the new column value. Depending on the type of triggering statement, certain correlation names might not have any meaning.

  • A trigger fired by an INSERT statement has meaningful access to new column values only. Because the row is being created by the INSERT, the old values are null.
  • A trigger fired by an UPDATE statement has access to both old and new column values for both BEFORE and AFTER row triggers.
  • A trigger fired by a DELETE statement has meaningful access to :old column values only. Because the row no longer exists after the row is deleted, the :new values are NULL. However, you cannot modify :new values:ORA4084 is raised if you try to modify :new values.

The new column values are referenced using the new qualifier before the column name, while the old column values are referenced using the old qualifier before the column name. For example, if the triggering statement is associated with the Emp_tab table (with the columns SALCOMM, and so on), then you can include statements in the trigger body. For example:

IF :new.Sal > 10000 ...
IF :new.Sal < :old.Sal ...

1 Comment

java.sql.SQLException: Protocol violation

Problem: Getting SQL Exception java.sql.SQLException: Protocol violation

Solution: I had researched various available solutions for this issue, however none of them solved my issue. I will first summarize some available solutions before presenting what solved the problem in a different way


Solution 1:   DB  password was showing an error ORA-28002: the password will expire within XX day. Reseting the password resolves the issue

Solution 2: use 64 bit VM. To use 64 bit VM pass argument -d64 as command line parameter to Java.

Solution 3: In My case, its the JVM Settings. Increasing the -Xmx<size> set maximum Java heap size

Increasing from -Xmx512M to -Xmx1024M resolved the issue as well

Leave a comment

Failed to load Main-Class manifest attribute from….

Problem: “Failed to load Main-Class manifest attribute from” error while trying to call main class bundled in a jar file.

Below is the documentation from oracle related to the above error, but i will also show you how do to do this in case if you are using build tool like maven to bundle your jar file.

Setting an Application’s Entry Point

If you have an application bundled in a JAR file, you need some way to indicate which class within the JAR file is your application’s entry point. You provide this information with the Main-Class header in the manifest, which has the general form:

Main-Class: classname

The value classname is the name of the class that is your application’s entry point.

Recall that the entry point is a class having a method with signature public static void main(String[] args).

After you have set the Main-Class header in the manifest, you then run the JAR file using the following form of the java command:

java -jar JAR-name

The main method of the class specified in the Main-Class header is executed.

An Example

We want to execute the main method in the class MyClass in the package MyPackage when we run the JAR file.

We first create a text file named Manifest.txt with the following contents:

Main-Class: MyPackage.MyClass

Warning: The text file must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.

We then create a JAR file named MyJar.jar by entering the following command:

jar cfm MyJar.jar Manifest.txt MyPackage/*.class

This creates the JAR file with a manifest with the following contents:

Manifest-Version: 1.0
Created-By: 1.7.0_06 (Oracle Corporation)
Main-Class: MyPackage.MyClass

When you run the JAR file with the following command, the main method of MyClass executes:

java -jar MyJar.jar

Setting an Entry Point with the JAR Tool

The ‘e’ flag (for ‘entrypoint’), introduced in JDK 6, creates or overrides the manifest’s Main-Class attribute. It can be used while creating or updating a JAR file. Use it to specify the application entry point without editing or creating the manifest file.
For example, this command creates app.jar where the Main-Class attribute value in the manifest is set to MyApp:

jar cfe app.jar MyApp MyApp.class

You can directly invoke this application by running the following command:

java -jar app.jar

If the entrypoint class name is in a package it may use a ‘.’ (dot) character as the delimiter. For example, if Main.class is in a package called foo the entry point can be specified in the following ways:

jar cfe Main.jar foo.Main foo/Main.class




where com.MyPackage.MyClass is the file where the main method exists and classpathPrefix is something where i am expecting some dependant jars to be available. We are interested in mainClass element at this time.

This is how Manifest.MF looks like in META-INF folder inside the jar file
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: username
Build-Jdk: 1.6.0_33
Main-Class: com.MyPackage.MyClass
Class-Path: target/lib/json-20090211.jar

Main-Class described above will help to load the main method.



Leave a comment

Axis2 contract-first web service

Installing Axis2 WAR Distribution

  1. Download the Axis2  WAR distribution from here:
  2. Deploy it as an exploded directory in your preferred Servlet Container (JBoss, Tomcat, etc).
  3. axis2.war will be the container to hold multiple aar files, which independently are axis projects themselves
  4. Go to the axis2.war/WEB-INF/conf/axis2.xml file, and set the hotupdate parameter to true, as follows:
…<parameter name=”hotupdate”>true</parameter>Check that the Axis2 webapp was successfully deployed by going to this link http://localhost:8080/axis2/ and clicking on ‘Validate’.

Developing a contract-first web service

  1. Create a Maven project in eclipse.
  2. Copy your wsdl and xsd files to src/main/resourcesNote: This process assumes you already have an existing WSDL file with external xsd files for the messages definition (Contract-first approach)
  3. Copy the following to your pom.xml file:











































































  1. To generate the java sources from the wsdl, run: mvn clean generate-sources -Pcodegen. This will create the input and output objects of every service, as well as the skeleton files and the services.xml file.
  2. Copy the files from target/generated-sources/axis2/wsdl2code/src to your src folder.
  3. Copy the services.xml file from target/generated-sources/axis2/wsdl2code/src to src/main/resources
  4. Edit the Skeleton class to include the logic you want.
  5. To generate the .aar file, run: mvn clean compile axis2-aar:aar
  6. Copy the generated .aar file from target to testws.war/WEB-INF/services
  7.  WSDL URLhttp://host:port/axis2/services/test-services?wsdl

Leave a comment

Bulk convert Office 2003 files to Office 2007

If you would like to convert all your 2003 office documents to 2007, but would like to do all of them in a single shot, here you go.

1. Download Migration Manager from microsoft and install it, which is a free tool

2. Download Office compatibility pack


Once step 1 is done, open the folder where it is installed and look for tools\ofc.ini

Below ofc.ini is complete file and we are interested in one part, the path to provide the source folder under [FoldersToConvert], make sure you have this fldr=C:\localfolder (without a ; before fldr and where localfolder is name of your folder)


; The Converter will attempt to convert all supported files in the specified folders
; (do not include if specifying FileListFolder)

Also you can update DestinationPathTemplate to the path where your converted files need to be available


4. Now open cm.exe and navigate to folder where migration manager is installed and simply run the cmd as ofc.exe

all your files will be converted and available in destination provided above without original files getting affected.

Leave a comment