Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:43:20+00:00 2026-06-05T01:43:20+00:00

hello friends i created struts with hibernate application when i call SessionFactory sessionFactory =new

  • 0

hello friends i created struts with hibernate application when i call SessionFactory sessionFactory =new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
this code is generate error please help me example code is here
this is my hibernate.cfg.xml file

   <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD                  3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
      <hibernate-configuration>
         <session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/logintest</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">xxxx</property>
<property name="connection.pool_size">1</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">
        org.hibernate.cache.NoCacheProvider
    </property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<mapping resource="hibernate.hbm.xml"/>

and my mapping file is here

   <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 <hibernate-mapping>
    <class name="net.model.Contact" table="contacts">
   <id name="id" type="int" column="id" >
    <generator class="increment"></generator>
</id>   
<property name="firstName" column="firstname"></property>
<property name="lastName" column="lastname"></property>
 <property name="cellNo" column="cell_no"></property>
<property name="emailId" column="email_id"></property>
 <property name="birthDate" column="birthdate"/>
<property name="website" column="website"/>
  </class>
   </hibernate-mapping>

mainclass is here

        public class Testmain {
       public static void main(String args[])
{
    Session session=null;
    try
    {
   SessionFactory sessionFactory =new Configuration().configure().buildSessionFactory();
        session =sessionFactory.openSession();

    Contact contact=new Contact();
   contact.setFirstName("mohan");
  contact.setLastName("raddy");
  contact.setEmailId("mm@gmail.com");
    contact.setCellNo("4664564564");
   contact.setWebsite("www.stackoverflow.com");
        session.save(contact);
       session.beginTransaction().commit();
      System.out.println("done");


    }catch(Exception e)
    {
    System.out.println(e);
    }




    session.beginTransaction();
    List<Contact> contacts = null;
    try {

        contacts = (List<Contact>)session.createQuery("from Contact").list();

    } catch (HibernateException e) {
        e.printStackTrace();
        session.getTransaction().rollback();
    }
    session.getTransaction().commit();


    for (Contact contact : contacts) {
        System.out.println(contact.getFirstName());
      System.out.println(contact.getLastName());
        System.out.println(contact.getEmailId());
          System.out.println(contact.getCellNo());
            System.out.println(contact.getWebsite());
    }   
   }}

following error showing when i run main class

Exception in thread “main” java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(Z)V
at net.sf.cglib.core.DebuggingClassWriter.(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.(Enhancer.java:69)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
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.(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:295)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at net.model.Testmain.main(Testmain.java:25)
Java Result: 1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:43:22+00:00Added an answer on June 5, 2026 at 1:43 am

    Take a look at this answer which suggests that you might be picking up the wrong version of asm.jar You should check your classpath and make sure you don’t have multiple versions installed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello friends i m new to jQuery and nyro modal. right now i m
Hello friends I am using this code in my view.. Using this code I
hello friends i am using this galleria gallery link to display images on my
Hello Functional C# Friends, So this time i am trying to compact my code
Hello friends I created some custom fields for contacts. How can I insert values
Hello Friends I am a newbie programmer and very very new to PHP. I
Hello friends a newbie question... The Issue is like this: I have a static
Hello friends In my application I want to customize regular expression in such a
hello friends i have created a UDP chatting program through which the clients can
hello friends i am developing one intranet application called human resource information system using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.