Follow by Email

Wednesday, May 18, 2016

How to ignore zero decimal place values in Crystal Reports

I had this requirement where I wanted to show a decimal number with 2 decimal points in my report but when there is no decimal value I wanted to show the integer part only i.e.

I wanted to show


instead of
50.00 (default behavior)

I had to define a custom formula for this

here is the procedure

  1. right click on your field in crystal report
  2. Format field
  3. Click on Number tab
  4. Press customize button
  5. Define a formula for Decimals as below
Crystal Report Formula
if CurrentFieldValue - truncate(CurrentFieldValue) <> 0 then

This basically means that if the current value has no decimals show 0 or no decimal places , else show 2.

Thanks to an answer in below stackoverflow thread from where I got to know about "CurrentFieldValue "

Thursday, May 5, 2016

SCRIPT438: Object doesn't support this property or method

Problem :
When trying to click on a check box I was getting this error message

SCRIPT438: Object doesn't support this property or method

Reason : 

The reason was that the Id of my inbox and the function it was calling on click was the same

<INPUT type="checkbox" id="isGeneral" onclick="isGeneral(this)" />

Solution :

Changed the function name like

<INPUT type="checkbox" id="isGeneral" onclick="isGeneralBestPractice(this)" />

And it was working fine after that.

Tuesday, April 26, 2016

Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin

Problem :

Trying to build my project in Maven , getting below error and build unsuccessful

ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.2:compile (default) on project DrillingBestPractices: Compiler errors :

[ERROR] error at import org.apache.catalina.connector.Request;
[ERROR] ^^^^^^^^^^^^^^^^^^

[ERROR]  absolute Path of my class
The import org.apache.catalina cannot be resolved

Solution :

The import was not being used in the class , so just had to delete it from the related class. and then the project was successfully built in Maven.

Surprise :

IDE was not complaining about this import , no compilation error which means the related jar file was in the build path. IDE however was showing me an un used warning for this import. It is strange that Maven was actually complaining about this import. However as said in the solution problem was resolved by removing the unused import in error message.

Lesson Learned :

Pay close attention to Maven error log and you will find a hint where the problem might be.

Saturday, March 26, 2016

Tiles javax.servlet.ServletException: Could not resolve view with name 'myTileName' in servlet with name 'My Servlet'

Problem :

Tiles javax.servlet.ServletException: Could not resolve view with name 'myTileName'  in servlet with name 'My Servlet'


The above error was facd when there was no related tiles definition in the related layout file of tiles , once the tile definition was created this error was gone.

Note I thaught initially that it was not picking the page correctly but the problem was it was not finding the tiles definition.

Wednesday, February 10, 2016

JSTL : Adding a custom EL function

I am out putting URLS in my JSP pages and wanted to encode those URLS to avoid cross site scripting , The bets solution I can think about was to create a custom EL function for URL encoding and use it in my jsp pages.

Below is how to do that

Create a class with your function

package com.mycompany.myproject.util;



import javax.servlet.jsp.tagext.TagSupport;



public class FunctionForJSTL  {



        * This method will return the encoded URL


        * From above Stackoverflow link

        *  URLEncoder.encode() is actually not the correct way to encode a URL. It is the correct way to encode a URL parameter. It changes spaces to + for example. The correct technique is new URI(null, url, null).toASCIIString(), which for example changes spaces to %20.

        * @param url

        * @return

        * @throws URISyntaxException


       public static String urlEncode(String url) throws URISyntaxException{

              String escapedURL=null;


                     escapedURL =new URI(null, url, null).toASCIIString();

                     return escapedURL;



                     return url;



Create TLD file put it under WEB-INF

<?xml version="1.0" encoding="UTF-8" ?>






    <display-name>Custom Functions</display-name>   






        <function-signature>java.lang.String urlEncode(java.lang.String)</function-signature>



Use In your JSP

Taglib import statement

<%@taglib uri="/WEB-INF/functions.tld" prefix="f" %>



Sunday, September 13, 2015

java.lang.NoSuchMethodError: com.rsa.jsafe.CryptoJ.isNativeAvailable(Ljava/lang/String;)


java.lang.NoSuchMethodError: com.rsa.jsafe.CryptoJ.isNativeAvailable(Ljava/lang/String;)

Ah you lil devlil , this exception wasted alot of my time debugging and looking into the solution , this could be because of many reasons

  1. You have new jar in you project and you compile your code with it but when you deploy to server  , it has old jar file in it's class path , and the class loader has loaded the old jar file which doesn't have this new method in the specified class.
  2. You may have two version of same jar file in your class path , an older version and a newer version.
However none of the above was the case for me , and I was left totally clueless.

I had file in my classpath also , everything was perfect.


After banging my head with the wall for so many days , I was lucky to find the solution which was to copy the latest from my Documentum installation folder and copy another file called dfc.keystore in my classpath. And this resolved my problem , now don't ask me why :) and try this solution at your machine if it works leave a comment here.

Tuesday, September 1, 2015

Where can I view Tomcat log files in Eclipse?

Below text taken from a very useful post at stackoverflow

if you're after the catalina.out log file then follow the directions below:
  • In the servers tab, double-click on the Tomcat Server. You will get a screen called Overview.
  • Click on "Open launch configuration". Click on the "Common" tab.
  • Towards the bottom of the screen you can check the "File" checkbox and then specify a file that can be used to log your console (catalina.out) output.
  • Finally, restart the Tomcat server.