Java - No Comments » - Posted on August, 27 at 4:19 pm
A hackish way of modifying the classpath at runtime can be done in a way described at the java forums Modifying Classpath at Runtime
A cleaner approach is to configure your own classloader and set it as the threads context classloader
URL[] urls=new URL[2];
URLClassLoader classLoader=new URLClassLoader(urls);
Thread.currentThread().setContextClassLoader(classLoader);
This is extremely useful if your unit test cases have dependencies [...]
Read More..>>
Posted in Java | No Comments »
Java - 1 Comment » - Posted on May, 8 at 1:18 am
InheritableThreadLocal does not work with tomcat as tomcat thread pool does not clear the thread local contacts after a request has been executed. This results in no good way to share information information between the parent and the child threads that are created using thread local variables.
One way to solve this problem is to [...]
Read More..>>
Posted in Java | 1 Comment »
Java - No Comments » - Posted on September, 21 at 5:03 pm
Locks introduced in Java 5 allow a more granular control on a shared resource. When a method is synchronized only the thread that obtains the lock is allowed to enter into that method or any other synchronized method of the class. However some times we may need a more granular control, typically when we have [...]
Read More..>>
Posted in Java | No Comments »
Java - 1 Comment » - Posted on August, 31 at 9:28 am
We were stumped yesterday trying to debug why all java clients trying to connect to a secure site using entrust’s Secure Server Certificates were throwing a certificate chain validation error. It turned out that the intermediate certificate that we downloaded from entrust had a bad expiration date. To correct this problem download the intermediate certificate [...]
Read More..>>
Posted in Java | 1 Comment »
Java, Tutorial - 1 Comment » - Posted on May, 13 at 6:24 pm
Cryptography in essence tries to solve three main real world problems.
Confidentialty
Integrity
Authenticity
Lets consider there are two people Alice and Bob who want to communicate with each other, and Eve is trying to eaves drop on the communication. The communication is said to be confidential if eve is not able to understand what messages Alice and Bob [...]
Read More..>>
Posted in Java, Tutorial | 1 Comment »
Java - No Comments » - Posted on March, 9 at 4:11 pm
“Log4JLogger does not implement Log” .. this happens because commons logging is bound to the JBoss system classloader, however the application classloader is trying to associate it to itself. The best way to resolve this error is to remove all references to commons-logging and utilize the one that is packaged with JBoss. For more information [...]
Read More..>>
Posted in Java | No Comments »
Java - 31 Comments » - Posted on January, 19 at 3:22 pm
A common problem faced when moving certificates and keys from tomcat to Apache web server is that keytool does not allow you to export the private key in the format that apache’s modssl module requires. Mark Foster’s post and Andrew Morrow’s post contains valuable information on how to export a key from a JKS keystore.
Here [...]
Read More..>>
Posted in Java | 31 Comments »
Java, Tutorial - 18 Comments » - Posted on January, 15 at 11:37 am
Ever wondered how an interpreter works ? Well, while evaluating parser generators for executing expressions I wrote this small example.
Getting to the basics
What is an Interpreter ?
An interpreter is a computer program that executes the program given to it as an input. In contrast, a compiler generates machine code for the program given to it, [...]
Read More..>>
Posted in Java, Tutorial | 18 Comments »