0

I need to work on hibernate and Springs along with GWT ( Google ).

This is my hibernate config file..

<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
        <property name="hibernate.connection.username">root</property>

        <mapping class="com.AAA"  />

    </session-factory>
</hibernate-configuration>

And this is the model class

@Entity
public class AAA {

    @Id@GeneratedValue(strategy=GenerationType.AUTO)
    private int id;
    private String Name;
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return Name;
    }
    public void setName(String name) {
        Name = name;
    }
}

this is my main class

public static void main(String arg[] ) {

    SessionFactory sessionFactory=new AnnotationConfiguration().configure().buildSessionFactory();
    Session hibernate_session = ((org.hibernate.SessionFactory) sessionFactory).openSession();
    hibernate_session.beginTransaction();

    System.out.println("Inside..");

    AAA pr = (AAA)hibernate_session.get(AAA.class,2);


    hibernate_session.getTransaction().commit();
    hibernate_session.close();

    System.out.println("Out sideee..");
}

And this is the Error getting continuously, even though there is changes of Different ver.. of `Asm.jar files.

Exception in thread "main" java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
    at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
    at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
    at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
    at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
    at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
    at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:107)
    at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
    at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
    at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
    at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
    at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:269)
    at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:425)
    at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
    at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
    at com.Tesf.main(Tesf.java:13)

And these are the following main jars what I am using.

asm-3.1.jar
cglib-2.1.3.jar
hibernate3
spring.jar
hibernate-jpa-2.0-api-1.0.1.final.jar

If I used these jars in Dynamic web project, every thing is fine, but in case of GWT webapplication its not..

Please give some Idea to Achieve it,

Ramesh J
  • 794
  • 2
  • 11
  • 24
  • It seems libraries issue, what version of spring used? See also http://stackoverflow.com/questions/2432471/error-java-lang-nosuchmethoderror-org-objectweb-asm-classwriter-initiv http://www.mkyong.com/hibernate/java-lang-nosuchmethoderror-org-objectweb-asm-classwriter/ – Georgy Gobozov Jun 14 '13 at 13:03
  • This looks like the classic picking-up-the-wrong-jar error. Have you tried ctr-shft-t in Eclipse to see in which jar(s) does this class reside? You can also use JarScan to search for a class in a folder and all of its subfolders. You probably will find 2 or more asm jars in the classpaths. – Christopher Yang Jun 14 '13 at 13:08
  • u use spring-orm.jar,hibernate-core.jar – swamy Jun 14 '13 at 13:17
  • Am using Springs-2.5.6.jar@Georgy Gobozov – Ramesh J Jun 14 '13 at 13:20
  • again the same error occured @swamy – Ramesh J Jun 14 '13 at 13:32
  • Spring.jar is really old version, Spring were releasing all modules as one jar back 2008 as I remember, get 3.XXX version then try. – Elbek Jun 14 '13 at 14:10

0 Answers0