-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationCon
PostPosted: Tue Nov 05, 2013 7:51 am 
Newbie

Joined: Tue Nov 05, 2013 7:21 am
Posts: 3
Hello guyes.. i m new in hibernate. i m using hibernate 3.2 distribution api. if i run the hibernate part in main method then it works fine but when i am taking the data from a web application which is developed in struts then it show this error plz help me thankx in advance.

Error :
javax.servlet.ServletException: Filter execution threw an exception
root cause

java.lang.ExceptionInInitializerError
org.shokeenda.com.util.MyHibernateUtil.buildSessionFactory(MyHibernateUtil.java:22)
org.shokeenda.com.util.MyHibernateUtil.<clinit>(MyHibernateUtil.java:10)
org.shokeenda.com.services.CRUD_BM_Impl.<init>(CRUD_BM_Impl.java:14)
org.shokeenda.com.actions.AddBMAction.<init>(AddBMAction.java:26)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
java.lang.Class.newInstance0(Class.java:355)
java.lang.Class.newInstance(Class.java:308)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:119)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:287)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
root cause

java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationConfiguration.configure()Lorg/hibernate/cfg/AnnotationConfiguration;
org.shokeenda.com.util.MyHibernateUtil.buildSessionFactory(MyHibernateUtil.java:15)
org.shokeenda.com.util.MyHibernateUtil.<clinit>(MyHibernateUtil.java:10)
org.shokeenda.com.services.CRUD_BM_Impl.<init>(CRUD_BM_Impl.java:14)
org.shokeenda.com.actions.AddBMAction.<init>(AddBMAction.java:26)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA



Hibernate Api :
hibernate3.jar
antlr.2.7.6.jar
commans-collection-3.1.jar
dom4j-1.6.1.jar
javaassist.3.12.0.GA.jar
jta-1.1.jar
slf4j-api-1.6.1.jar
hibernate-jpa-2.0-api-1.0.1Final.jar
cglib-2.2.jar
hibernate-annotation-3.2.0.Ga.jar


@Entity
public class BranchManager {

@Id
private String empid;
@Column (name="First_Name")
private String firstname;
@Column (name="Last_Name")
private String lastName;
@Column (name="DateOfBirth")
private Set<CRUDSecurityBM> security=new HashSet<CRUDSecurityBM>();
// getter and setters


@Embeddable
public class CRUDSecurityBM {


@Column (name="First_Name")
private String firstname;
@Column (name="Last_Name")
private String lastName;
@Column (name="DateOfBirth")
private String dob;
// getters and setters

hibernate utils
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
return new AnnotationConfiguration().configure()
.buildSessionFactory();

hibernate.cfg.xml
<session-factory>
<property name="myeclipse.connection.profile">
SGMFL Database
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/SMGFL_mast
</property>
<property name="connection.username">root</property>
<property name="connection.password">mysql</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="show_sql">true</property>
<property name="connection.pool_size">1</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<mapping class="org.shokeenda.com.beans.BranchManager" />
<mapping class="org.shokeenda.com.beans.CRUDSecurityBM" />


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationCon
PostPosted: Wed Nov 06, 2013 5:18 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
There seems to be another version inside your web app.

(Is there any good reason to use a stone-age-version of Hibernate?)


Top
 Profile  
 
 Post subject: Re: java.lang.NoSuchMethodError: org.hibernate.cfg.AnnotationCon
PostPosted: Wed Nov 06, 2013 6:17 am 
Newbie

Joined: Tue Nov 05, 2013 7:21 am
Posts: 3
sorry friend i m new in hibernate. i m using myeclipse 8.0 ,hibernate 3.2 capabilities (core and annotation). can u tell me what is suitable way to integrate the struts and hibernate part.
plz.. tell me the api link.. that i will use the hibernate and struts


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.