Archive for the 'Java' category

Spring Transaction in Java main method

Dec 09 2011 Published by under Java

In standalone java project (main method) if you insert / update database it will not work. It is because you need to add the transaction management. You need to do programmatic transaction management. Here is the code you need to add in your main method.
Continue Reading »

No responses yet

Managing Java Memory – heap size, max perm size, GC collection etc.,

Nov 30 2011 Published by under Java

1. –Xms512m and –Xmx2048m

Define the minimum and maximum heap space.
Continue Reading »

No responses yet

WebTest using https – javax.net.ssl.SSLHandshakeException

Oct 31 2011 Published by under Java

Add to the webtest

<config useInsecureSSL="true" />

No responses yet

SEO friendly URL’s in Java

May 19 2011 Published by under Java

If the application is open to all general Internet users, then it is almost mandatory to generate SEO friendly URLs, not just for e.g., the product URL but also the search results page in your application.

Continue Reading »

No responses yet

Java – Logging in high volume transactions

Nov 19 2010 Published by under Java

Logging involves disk IO. I have run tests and in some cases logging affected the response time and in some cases I did not. However this is not about how logging affects response time.

Continue Reading »

No responses yet

SAXParserFactoryImpl not found Error

Oct 08 2010 Published by under Java

Problem:

[java] 2010-10-08 11:29:36.273:WARN::FAILED HandlerCollection@79a2e7: javax.xml.parsers.FactoryConfigurationError: Provider o
rg.apache.xerces.jaxp.SAXParserFactoryImpl not found
[java] 2010-10-08 11:29:36.273:WARN::Error starting handlers
[java] javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
[java]     at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:113)
[java]     at org.eclipse.jetty.xml.XmlParser.<init>(XmlParser.java:68)

Continue Reading »

No responses yet

Generate environment specific properties file using ant replace

Sep 19 2010 Published by under Java

If you want create your config file specific to each environment, then you could take the following approach. Assuming your environment specific properties are kept in folder structure as in the image. 

Continue Reading »

No responses yet

com.sun.tools.javac.Main is not on the classpath

Feb 08 2010 Published by under Java

I get the following error when I run ant script.

com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to “d:\devtools\java1.5\jre”

Continue Reading »

No responses yet

Setting up JackRabbit with Database

Oct 17 2009 Published by under Java

There are not many resources on the net that shows how to setup up JackRabbit with database. At least I couldn’t find it. There are many reasons you would want to choose to implement the storage in database rather than file system. Well I’m not going to talk about that here. You read an interesting discussion on TheServerSide.

Continue Reading »

No responses yet

Delete more than one table

Oct 16 2009 Published by under Java

String query = "show tables like 'a%'";
String tables = null;
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
 
while (rs.next()) {
String tableName= rs.getString(1);
if (tables == null) tables = tableName;
else tables += "," + tableName;
}
st.close();
 
st = conn.createStatement();
st.executeUpdate("drop table " + tables);
st.close();
} catch (SQLException e) {
System.out.println("Unable to execute Query " + e.getMessage());
}

No responses yet

Older posts »