AttachNotSupportedException: Unable to enqueue operation: the target VM does not support attach mechanism

14,649 views
By Abhijit Ghosh on Jan 10, 2014 10:12:37 AM

Following exception occurs in Windows for IBM JDK 6 while executing a JUnit testcase which uses JMockit framework, in-spite of enabling the Attach API "-Dcom.ibm.tools.attach.enable=yes" - java.lang.RuntimeException: com.sun.tools.attach.AttachNotSupportedException: Unable to enqueue operation: the target VM does not support attach mechanism

Tags:

Expand Shortened Link using Java

26,353 views
By Abhijit Ghosh on Oct 22, 2013 11:32:36 AM

Nowadays we use different URL shortening services (like bit.ly, TinyURL, Google URL Shortener etc.) to shorten long URL to fit in micro-blogging sites (like Twitter), to beautify a link, view analytics on link clicks, make a link manageable for sharing (in SMS or printed hard copy, book, magazine etc.) or obscure the underlying address. But large portion of shortened links are used just to disguise spam or bad-sites containing malware, spyware, XSS attacks etc. So for safe browsing, sometimes revealing the destination of shortened link is necessary too.

Here, we'll discuss one programmatic approach (using java.net.HttpURLConnection) to expand shortened links.

Tags:

Problem: failed to create task or type eclipse.refreshLocal

21,459 views
By Abhijit Ghosh on Aug 30, 2013 1:32:41 PM

Eclipse platform provides different useful Ant tasks to interact with the workspace. If you have added any such Ant task (say eclipse.refreshLocal) in your ant build script and started getting "Problem: failed to create task or type eclipse.refreshLocal. Cause: The name is undefined.", then this is the post worth looking into.

Tags:

Logback using SLF4J Hello World Example

74,212 views
By Abhijit Ghosh on Nov 21, 2012 11:40:00 AM

Logback is an increasingly popular logging framework intended as a successor to the popular log4j project. It is designed by the founder of log4j. Logback offers many advantages over log4j like faster, smaller memory footprint, automatic reloading of configuration files, automatic compression of archived log files, conditional processing of configuration files and many more. For more details go through the following link Reasons to prefer logback over log4j.

This tutorial describes how to configure SLF4J and Logback as logging solution of an application.

Tags:

Java File and Directory operations made easy in JDK 7

14,337 views
By Abhijit Ghosh on Nov 7, 2012 11:32:05 AM

Here we'll see two examples - Copy operation & Traversing a file tree. If you have already worked using JDk 6 or earlier versions then you can see how easy it is to use JDK 7's nio package. And you need to write less code to implement the same.

Tags:

Send logs by Email Notification using Apache log4j SMTPAppender

48,224 views
By Abhijit Ghosh on Oct 11, 2012 2:46:33 AM

It is always better to get notified as soon as any major issues / exceptions occurred in the Application, instead of manually going thorugh huge logs to find probable exception messages. Apache log4j provides out of the box log Appender (called SMTPAppender) to send email alerts for the log level configured in log4j configuration file.

Tags:

Configure Simple Logging Facade for Java (SLF4J) with log4j as underlying logging framework

57,636 views
By Abhijit Ghosh on Sep 26, 2012 1:30:13 PM

Simple Logging Facade for Java (SLF4J) is an abstraction of different logging frameworks (eg. log4j, java.util.logging, commons logging etc.). This tutorial describes how to configure SLF4J with log4j as underlying logging framework.

Tags:

Example to Generate Random Alpha Numeric Text

12,681 views
By Abhijit Ghosh on Sep 18, 2012 2:08:04 PM

This example shows how to generate random alpha numeric text which is not easy to guess.

Tags:

How to retain DOCTYPE declaration while saving DOM Document to an XML file

17,742 views
By Abhijit Ghosh on Sep 13, 2012 2:13:01 PM

If we save a DOM Document to an XML file using javax.xml.transform.Transformer, DOCTYPE declaration gets emitted by default. This example shows how we can retain PUBLIC and SYSTEM id of the DOCTYPE declaration for external DTD.

Tags:

Programmatically Start or Stop an Application, deployed in IBM WebSphere Application Server (WAS) using Java Code and ANT script

19,985 views
By Abhijit Ghosh on Aug 17, 2012 12:41:54 PM

This tutorial describes how an application, deployed in IBM WebSphere Application Server (WAS) can be started or stopped programmatically using Java code. The sample java code invokes and executes an ANT script which uses 'wsadmin' scripting tool and the AdminControl object to start / stop the application.

Tags:

About this 'Hello World' site

This site is mainly developed to share coding and technology learning experiences on java / j2ee based technologies.

Simple tutorials / codes have been shared to learn a new technology. Full source code is also available for download.