I know that I know nothing

remote debug in tomcat

clock May 9, 2015 19:12 by author Administrator

add this line jvm args


create jndi in tomcat

clock May 9, 2015 18:55 by author Administrator

Create META-INF/context.xml

<Context  docBase="appName" path="/" reloadable="true" >

    <Resource name="develop" auth="Container" type="javax.sql.DataSource" maxActive="50        
          maxIdle="30" maxWait="10000" username="test"    password="test"

        driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@" />



web.xml configuration


        <description>jdbc Datasource example</description>

The value of attribute "formula" must not contain the '<' character.

clock May 8, 2015 12:43 by author Administrator

hibernate formula dosenot allow user < in select for example i use this formula and get this exception

  <property name="debitPrice"  not-null="true"   formula="(  select nvl(sum(d.cost_price),0) from ihs_flat_cost_assign d where d.flat_id=Id  and d.cost_price <=0   )  "   />


and i change that to this

        <property name="debitPrice"  not-null="true"   formula="(  select nvl(sum(d.cost_price),0) from ihs_flat_cost_assign d where d.flat_id=Id  and 0>=d.cost_price    )  "   />

and problem solve

crazyyyyy bug i dont know whyyyyy

send email after commit using spring transaction

clock May 6, 2015 21:22 by author Administrator

Sometimes you want a little more control over transaction but at the same time you don't want to switch to programmatic transaction management. I'm talking about cases when you want to execute some activities only when transaction was completed successfully. For example: send an email with registration details, update a cache, send a message over network, etc. The tricky part here is that you want to perform these activities from a transactional method (a method marked with @Transactional which automatically will start and end the transaction).


public class AfterCommitExecutorImpl extends TransactionSynchronizationAdapter implements AfterCommitExecutor {
    private static final Logger LOGGER = LoggerFactory.getLogger(AfterCommitExecutorImpl.class);
    private static final ThreadLocal<List<Runnable>> RUNNABLES = new ThreadLocal<List<Runnable>>();

    public void execute(Runnable runnable) {"Submitting new runnable {} to run after commit", runnable);
        if (!TransactionSynchronizationManager.isSynchronizationActive()) {
  "Transaction synchronization is NOT ACTIVE. Executing right now runnable {}", runnable);
        List<Runnable> threadRunnables = RUNNABLES.get();
        if (threadRunnables == null) {
            threadRunnables = new ArrayList<Runnable>();

    public void afterCommit() {
        List<Runnable> threadRunnables = RUNNABLES.get();"Transaction successfully committed, executing {} runnables", threadRunnables.size());
        for (int i = 0; i < threadRunnables.size(); i++) {
            Runnable runnable = threadRunnables.get(i);
  "Executing runnable {}", runnable);
            try {
            } catch (RuntimeException e) {
                LOGGER.error("Failed to execute runnable " + runnable, e);

    public void afterCompletion(int status) {"Transaction completed with status {}", status == STATUS_COMMITTED ? "COMMITTED" : "ROLLED_BACK");




final String email = user.getEmail();
            afterCommitExecutor.execute(new Runnable() {
                public void run() {
                    mailService.sendMail(email, "CreateUser", params, "templates/email/CreateUser.ftl");


clock May 2, 2015 22:09 by author Administrator

“I’m the smartest man in Athens because I know that I know nothing.” —Socrates 470-399 BC

jsoup: Java HTML Parser like jquery

clock May 2, 2015 19:01 by author Administrator

jsoup is a Java library for working with real-world HTML. It provides a very convenient API for extracting and manipulating data, using the best of DOM, CSS, and jquery-like methods.


String userURL = "";

content of this request contain this tag


<input type="text" id="txt_title" value="title"  />
Document doc = Jsoup.connect(userURL).get();



About the author

 Welcome to this web site . This page has two purposes: Sharing information about my professional life such as articles, presentations, etc.
This website is also a place where I would like to share content I enjoy with the rest of the world. Feel free to take a look around, read my blog

Java,J2EE,Spring Framework,JQuery,

Hibernate,NoSql,Cloud,SOA,Rest WebService and Web Stack tech...


Month List

Sign In