-->
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.  [ 2 posts ] 
Author Message
 Post subject: problem with Annotation using Spring
PostPosted: Wed May 03, 2006 8:37 am 
Beginner
Beginner

Joined: Sat Oct 08, 2005 2:13 am
Posts: 47
Hi
I am using the spring framework v1.2.4 and want to using annotations in my project but I encounter the following error. please help me about this.
any help will be appreciated.

------------------
this is the bean I used it:


package com.payvand.hltest.dao.entity;

import java.io.*;
import javax.persistence.*;


@Entity(name="City")
@Table(name="city")
public class City implements Serializable{
private Integer id;
private String name;
private String nameE;
private Integer statusCode;
private Integer idProvince;
private Integer idCountry;

@Id()
public Integer getId() {
return id;

}
public void setId(Integer id) {
this.id = id;
}

@Column(name="idCountry",length=11)
public Integer getIdCountry() {
return idCountry;
}
public void setIdCountry(Integer idCountry) {
this.idCountry = idCountry;
}

@Column(name="idProvince",length=11)
public Integer getIdProvince() {
return idProvince;
}
public void setIdProvince(Integer idProvince) {
this.idProvince = idProvince;
}

@Column(name="name",length=100)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}

@Column(name="nameE",length=100)
public String getNameE() {
return nameE;
}
public void setNameE(String nameE) {
this.nameE = nameE;
}

@Column(name="statusCode",length=11)
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}


}


-----------------

Hibernate version: 3.1.3

Full stack trace of any exception that occurs:
INFO - XmlBeanDefinitionReader.loadBeanDefinitions(158) | Loading XML bean definitions from class path resource [applicationContext.xml]
INFO - AbstractRefreshableApplicationContext.refreshBeanFactory(92) | Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=29855319]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [propertyConfigurer,dataSource,transactionManager,sessionFactory,hibernateTemplate,baseTransactionProxy,cityDAO]; root of BeanFactory hierarchy
INFO - AbstractApplicationContext.refresh(295) | 7 beans defined in application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=29855319]
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'propertyConfigurer'
INFO - PropertiesLoaderSupport.loadProperties(167) | Loading properties file from class path resource [WEB-INF/jdbc.properties]
INFO - CollectionFactory.<clinit>(61) | JDK 1.4+ collections available
INFO - AbstractApplicationContext.initMessageSource(437) | Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@17f1ba3]
INFO - AbstractApplicationContext.initApplicationEventMulticaster(459) | Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@1d520c4]
INFO - DefaultListableBeanFactory.preInstantiateSingletons(260) | Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [propertyConfigurer,dataSource,transactionManager,sessionFactory,hibernateTemplate,baseTransactionProxy,cityDAO]; root of BeanFactory hierarchy]
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'dataSource'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'transactionManager'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'sessionFactory'
INFO - Environment.<clinit>(479) | Hibernate 3.1.3
INFO - Environment.<clinit>(509) | hibernate.properties not found
INFO - Environment.<clinit>(525) | using CGLIB reflection optimizer
INFO - Environment.<clinit>(555) | using JDK 1.4 java.sql.Timestamp handling
INFO - Configuration.configure(1323) | configuring from url: file:/F:/workspace/PAYVAND_hltest/res/WEB-INF/hibernate.cfg.xml
INFO - Configuration.doConfigure(1419) | Configured SessionFactory: null
INFO - LocalSessionFactoryBean.afterPropertiesSet(701) | Building new Hibernate SessionFactory
INFO - AnnotationBinder.bindClass(335) | Binding entity from annotated class: com.payvand.hltest.dao.entity.City
INFO - EntityBinder.bindTable(318) | Bind entity com.payvand.hltest.dao.entity.City on table city
INFO - ConnectionProviderFactory.newConnectionProvider(72) | Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@1d256fa)
LogAbandoned: true
RemoveAbandoned: true
RemoveAbandonedTimeout: 60
INFO - SettingsFactory.buildSettings(77) | RDBMS: MySQL, version: 4.1.13-nt
INFO - SettingsFactory.buildSettings(78) | JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.0.11-stable ( $Date: 2004/02/04 02:47:36 $, $Revision: 1.27.2.34 $ )
INFO - Dialect.<init>(103) | Using dialect: org.hibernate.dialect.MySQLDialect
INFO - TransactionFactoryFactory.buildTransactionFactory(31) | Using default transaction strategy (direct JDBC transactions)
INFO - TransactionManagerLookupFactory.getTransactionManagerLookup(33) | No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
INFO - SettingsFactory.buildSettings(125) | Automatic flush during beforeCompletion(): disabled
INFO - SettingsFactory.buildSettings(129) | Automatic session close at end of transaction: disabled
INFO - SettingsFactory.buildSettings(136) | JDBC batch size: 15
INFO - SettingsFactory.buildSettings(139) | JDBC batch updates for versioned data: disabled
INFO - SettingsFactory.buildSettings(144) | Scrollable result sets: enabled
INFO - SettingsFactory.buildSettings(152) | JDBC3 getGeneratedKeys(): enabled
INFO - SettingsFactory.buildSettings(160) | Connection release mode: auto
INFO - SettingsFactory.buildSettings(184) | Maximum outer join fetch depth: 2
INFO - SettingsFactory.buildSettings(187) | Default batch fetch size: 1
INFO - SettingsFactory.buildSettings(191) | Generate SQL with comments: disabled
INFO - SettingsFactory.buildSettings(195) | Order SQL updates by primary key: disabled
INFO - SettingsFactory.createQueryTranslatorFactory(338) | Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO - ASTQueryTranslatorFactory.<init>(24) | Using ASTQueryTranslatorFactory
INFO - SettingsFactory.buildSettings(203) | Query language substitutions: {}
INFO - SettingsFactory.buildSettings(209) | Second-level cache: enabled
INFO - SettingsFactory.buildSettings(213) | Query cache: disabled
INFO - SettingsFactory.createCacheProvider(325) | Cache provider: org.hibernate.cache.EhCacheProvider
INFO - SettingsFactory.buildSettings(228) | Optimize cache for minimal puts: disabled
INFO - SettingsFactory.buildSettings(237) | Structured second-level cache entries: disabled
INFO - SettingsFactory.buildSettings(257) | Echoing all SQL to stdout
INFO - SettingsFactory.buildSettings(264) | Statistics: disabled
INFO - SettingsFactory.buildSettings(268) | Deleted entity synthetic identifier rollback: disabled
INFO - SettingsFactory.buildSettings(283) | Default entity-mode: pojo
INFO - SessionFactoryImpl.<init>(154) | building session factory
DEBUG - CacheManager.create(177) | Creating new CacheManager with default config
DEBUG - CacheManager.configure(151) | Configuring ehcache from classpath.
WARN - Configurator.configure(123) | No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/F:/workspace/PAYVAND_hltest/lib/ehcache-0.7.jar!/ehcache-failsafe.xml
DEBUG - Configuration$DiskStore.setPath(181) | Disk Store Path: C:\DOCUME~1\SAEEDI~1.XIT\LOCALS~1\Temp\
ERROR - CGLIBLazyInitializer.getProxyFactory(130) | CGLIB Enhancement failed: com.payvand.hltest.dao.entity.City
java.lang.NoSuchMethodError: net.sf.cglib.proxy.Enhancer.setInterceptDuringConstruction(Z)V
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:118)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:216)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:777)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:703)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1058)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
at com.payvand.hltest.test.BaseDAOTest.<init>(BaseDAOTest.java:19)
at com.payvand.hltest.test.CityDAOTest.<init>(CityDAOTest.java:15)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at junit.framework.TestSuite.createTest(TestSuite.java:131)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:399)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
WARN - PojoEntityTuplizer.buildProxyFactory(173) | could not create proxy factory for:com.payvand.hltest.dao.entity.City
org.hibernate.HibernateException: CGLIB Enhancement failed: com.payvand.hltest.dao.entity.City
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:132)
at org.hibernate.proxy.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:41)
at org.hibernate.tuple.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:161)
at org.hibernate.tuple.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:131)
at org.hibernate.tuple.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:64)
at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:257)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:216)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:777)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:703)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1058)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:318)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:81)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
at com.payvand.hltest.test.BaseDAOTest.<init>(BaseDAOTest.java:19)
at com.payvand.hltest.test.CityDAOTest.<init>(CityDAOTest.java:15)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at junit.framework.TestSuite.createTest(TestSuite.java:131)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:399)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.NoSuchMethodError: net.sf.cglib.proxy.Enhancer.setInterceptDuringConstruction(Z)V
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:118)
... 34 more
INFO - SessionFactoryObjectFactory.addInstance(82) | Not binding factory to JNDI, no JNDI name configured
INFO - SchemaExport.execute(152) | Running hbm2ddl schema export
INFO - SchemaExport.execute(177) | exporting generated schema to database
INFO - SchemaExport.execute(194) | schema export complete
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'hibernateTemplate'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'cityDAO'
@@@@@@@@@@@@@@@@@@@@@@@ before @@@@@@@@@@@@@@@@@@
true
DEBUG - CityDAOTest.setUp(26) | setup
DEBUG - CityDAOTest.testInsertCity(36) | false
false
INFO - XmlBeanDefinitionReader.loadBeanDefinitions(158) | Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'DB2'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'HSQL'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'MS-SQL'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'MySQL'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'Oracle'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'Informix'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'PostgreSQL'
INFO - AbstractBeanFactory.getBean(222) | Creating shared instance of singleton bean 'Sybase'
INFO - SQLErrorCodesFactory.<init>(120) | SQLErrorCodes loaded: [DB2, HSQL, MS-SQL, MySQL, Oracle, Informix, PostgreSQL, Sybase]
Hibernate: insert into city (idCountry, idProvince, nameE, statusCode, name, id) values (?, ?, ?, ?, ?, ?)


Name and version of the database you are using:
MySql 4

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

----------------


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 11:28 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
You have an incompatible CGLIB jar in your classpath:
Code:
java.lang.NoSuchMethodError: net.sf.cglib.proxy.Enhancer.setInterceptDuringConstruction(Z)V


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.