Hi,
Sometimes it is helpful have log statements in JSPS. Unfortunately if we have lot of business logic embedded in JSP’s. It is better to have log statements.
To add log statement in JSP
• Import logger
o <%@page import="org.apache.log4j.Logger"%>
• Provide the logger name, FQN name of the JSP
o private static final Logger logger = Logger.getLogger("portlet.ext.watching_portlet.view.jsp");
• Add the log statements as mentioned in the guide lines
o logger.warn("Unable to find thread associated to subscription");
Best practice:
Please don’t rely on toString method to get the exception stack trace.
Poor: logger.warn("Unable to find thread associated to subscription"+e);
Good: logger.warn("Unable to find thread associated to subscription",e);//exception stack trace will be logged, even if api doesn’t override the toString method
Sunday, July 11, 2010
Changing JSP Editor font Eclipse:
By default JSP editor uses text editor for font settings . Change the setting by
Window->preferences->general-appearance->colors and fonts-Basic->Text font
Window->preferences->general-appearance->colors and fonts-Basic->Text font
Tuesday, May 25, 2010
Getting the method name in the method annotated with “@BeforeMethod”
Hi All,
Below is an example that helps to get the test method name, before executing
A quick example for the people who are very lazy like me
@BeforeMethod
@Parameters("selenium.screenShotFolder")
protected void captureScreenShotBefore(String folder,Method method) {
String data = getSelenium().captureScreenshotToString();
String fileName=method.getName()+"_before.png";
Reporter.log(""+fileName+"");
FileUtil.writeToFile(data,folder+fileName);
}
Thanks & Regards
Balaji
Below is an example that helps to get the test method name, before executing
A quick example for the people who are very lazy like me
@BeforeMethod
@Parameters("selenium.screenShotFolder")
protected void captureScreenShotBefore(String folder,Method method) {
String data = getSelenium().captureScreenshotToString();
String fileName=method.getName()+"_before.png";
Reporter.log(""+fileName+"");
FileUtil.writeToFile(data,folder+fileName);
}
Thanks & Regards
Balaji
Wednesday, April 21, 2010
java.io.IOException: Cannot run program CreateProcess error=87, The parameter is incorrect
Problem:
Recently we observed our ant scripts are failing to fork a JVM process and they are failing with error “CreateProcess error=87, The parameter is incorrect"”
Solution:
Please reduce the classpath size for the javac/java
Root Cause:
In windows operating system if the arguments to process is too long . The process cannot be launched by the Operating system, In our case while ant forks the java/javac process and provides the classpath as argument . The classpath size exceeds the maximum size OS can handle. The solution for this problem is to reduce classpath. (i.e) reducing the size of arguments to process.
Recently we observed our ant scripts are failing to fork a JVM process and they are failing with error “CreateProcess error=87, The parameter is incorrect"”
Solution:
Please reduce the classpath size for the javac/java
Root Cause:
In windows operating system if the arguments to process is too long . The process cannot be launched by the Operating system, In our case while ant forks the java/javac process and provides the classpath as argument . The classpath size exceeds the maximum size OS can handle. The solution for this problem is to reduce classpath. (i.e) reducing the size of arguments to process.
GWT compiler fails with Bad class version
Solution: This might happen because of incorrect version of Javac used by the GWTcompiler or the incorrect version of the jar files in project space.
We observed ant in netbeans is using the default JVM of the netbeans ide instead of JVM set for the project. Please change the default JDK used by neatbeans by changing netbeans.conf file.
For more info please refer http://wiki.netbeans.org/FaqJdkHome
Regards
Balaji
We observed ant in netbeans is using the default JVM of the netbeans ide instead of JVM set for the project. Please change the default JDK used by neatbeans by changing netbeans.conf file.
For more info please refer http://wiki.netbeans.org/FaqJdkHome
Regards
Balaji
Monday, March 22, 2010
Unable to change GWT home in netbeans 6.5
Recenetly I faced a problem when I took GWT based netbeans workspace from my collegue. I am able to point the GWT installation to my local folder. Even I changed the gwt installation folder in netbeans, it is simply ignoring.
The way to solve the problem
• Go to nebeanse config folder of your project.
o For example
o C:\Temp\work\QABuild_Snapper\client\nbproject
• Edit gwt.properties
• Modify the “gwt.install.dir” to the directory you have gwt installation
• Save the file
Hope this helps
~Balaji
The way to solve the problem
• Go to nebeanse config folder of your project.
o For example
o C:\Temp\work\QABuild_Snapper\client\nbproject
• Edit gwt.properties
• Modify the “gwt.install.dir” to the directory you have gwt installation
• Save the file
Hope this helps
~Balaji
Wednesday, February 24, 2010
Sharing source files across the projects in Nebeans 6.5 or above.
I observed a strange problem using netbeans ,when I tried to use the source files that are already used by other projects. I get an exception “Package folder already used in project”. As per the netbeans it is correct, because we are trying to use the source folder that is already used by other project. But there are few situations that demands us to do so.
For example we have code in folder “c1”; it has to be shared by two projects p1 and p2
Include the code “c1” by going to project ”p1” ->properties->sources->Source PackageFolders->add folder
Add the c1 code to p1 source
If you are trying to add “c1” again to project “p2” it give you an error “Package folder already in use by project p1”. To overcome this.
Add the parent folder of “c1” (i.e) c0 to project “p2” by properties->sources->Source PackageFolders->add folder
• Open the file “project.properties” of p2 at “p2\nbproject\ project.properties”
• Search for the string “src.c0.dir=${file.reference.c-c0}”
• Replace the value of file.reference.c-c0 with actual code folder “c1”
• Example file.reference.c-c0=\home\c\c0\c1
• Save the file project.properties
Hope this help . I spent 3 hours in figuring this out, But its worth to document by spending 30 min more
Thanks & Regards
Balaji Chopparapu
For example we have code in folder “c1”; it has to be shared by two projects p1 and p2
Include the code “c1” by going to project ”p1” ->properties->sources->Source PackageFolders->add folder
Add the c1 code to p1 source
If you are trying to add “c1” again to project “p2” it give you an error “Package folder already in use by project p1”. To overcome this.
Add the parent folder of “c1” (i.e) c0 to project “p2” by properties->sources->Source PackageFolders->add folder
• Open the file “project.properties” of p2 at “p2\nbproject\ project.properties”
• Search for the string “src.c0.dir=${file.reference.c-c0}”
• Replace the value of file.reference.c-c0 with actual code folder “c1”
• Example file.reference.c-c0=\home\c\c0\c1
• Save the file project.properties
Hope this help . I spent 3 hours in figuring this out, But its worth to document by spending 30 min more
Thanks & Regards
Balaji Chopparapu
Subscribe to:
Posts (Atom)