Sunday, 13 January 2013

java.lang.ClassNotFoundException: javax.transaction.Synchronization

,

Exception: 

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Access denied for user ''@'localhost' to database 'school' at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3421) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1247) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775) at com.mysql.jdbc.Connection.(Connection.java:1555) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:154)...

Reason 

  1. your username and password are incorrect
  2. your username does not have enough privilege on database
  3. you might be trying to access wrong database.

Possible solution : 

  1. Check your username and password
  2. Check privilege assigned to your username or role from which you are trying to access database.you might not be granted permission to access the database
  3. Check the database you are trying to access.you might be trying to access wrong database.
Read more →

java.lang.ClassNotFoundException: javassist.util.proxy.MethodFilter

,

Exception: 

java.lang.ClassNotFoundException: javassist.util.proxy.MethodFilter at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at org.hibernate.bytecode.javassist.BytecodeProviderImpl.getProxyFactoryFactory(BytecodeProviderImpl.java:49) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactoryInternal(PojoEntityTuplizer.java:207) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:185)...

Reason 

you have not included javassist.jar 

Possible solution : 

  1. Download javassist.jar from http://www.csg.is.titech.ac.jp/~chiba/javassist and include it in library.
    2 . For maven user, Include javassist in pom.xml
        
<dependency>
    <groupId>javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.12.1.GA</version>
</dependency>
Read more →

Saturday, 5 January 2013

org.hibernate.HibernateException: Unable to instantiate default tuplizer

,

Exception: 

Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
    at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:108)
    at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:133)
    at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:322)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:485)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:133)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:286)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)...

Reason 

you have use mismatch field in hbm which is not present in entity or database table.

Possible solution : 

  1. Check your entity field spelling in entity and hbm.
  2. Check your name of table assign in hbm.
  3. Check the entity class name assign in hbm.


Read more →

Thursday, 3 January 2013

Check element exists in javascript

,
Code to check if element exist of not.
 You can check element exist or not with javascript by it id or name.

Check Element exist in Javascript

With Id :

var check = document.getElementById("elementId");
if(check.length != 0)
{
      alert('I am present');
}

With Name:
 
var check = document.getElementsByName("elementName");
if(check.length != 0)
{
      alert('I am present');
}


Check Element exist in jQuery

With Id :

if ($('#elementId').length > 0) { 
    // it exists 
}
Read more →

Sunday, 30 December 2012

Creating differenet shapes in CSS 3

,

Square :

#square {
    width: 100px;
    height: 100px;
    background: orange;
}

Rectangle :

#rectangle { 
    width: 200px; 
    height: 100px; 
    background: orange; 
}

Circle :

#circle { 
    width: 100px; 
    height: 100px; 
    background: orange; 
    -moz-border-radius: 50px; 
    -webkit-border-radius: 50px; 
    border-radius: 50px; 
}

Oval :

#oval { 
    width: 200px;
    height: 100px;
    background: orange;
    -moz-border-radius: 100px / 50px;
    -webkit-border-radius: 100px / 50px;
    border-radius: 100px / 50px; 
}

Read more →