Pessoal estou tentando fazer o exemplo de hibernate do artigo da Mundo Java que foi escrito pelo Caio Filipine e o Umlauf:
e me apresenta o seguinte erro:
[code](cfg.Environment 483 ) Hibernate 2.1.8
(cfg.Environment 517 ) loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.firebirdsql.jdbc.FBDriver,
hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.hibernate.cache.EhCacheProvider,
hibernate.cache.use_query_cache=true, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.InterbaseDialect,
hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes ‘Y’, no ‘N’, hibernate.proxool.pool_alias=pool1,
hibernate.connection.username=SYSDBA, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:firebirdsql://localhost/C:/Arquivos de
programas/IBOConsole/MUNDOJAVA, hibernate.connection.password=masterkey, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
(cfg.Environment 542 ) using java.io streams to persist binary types
(cfg.Environment 543 ) using CGLIB reflection optimizer
(cfg.Environment 572 ) using JDK 1.4 java.sql.Timestamp handling
(cfg.Configuration 909 ) configuring from resource: /hibernate.cfg.xml
(cfg.Configuration 881 ) Configuration resource: /hibernate.cfg.xml
(cfg.Configuration 332 ) Mapping resource: Artista.hbm.xml
(cfg.Binder 229 ) Mapping class: br.com.mundojava.hibernate.modelo.Artista -> artista
(cfg.Configuration 256 ) Could not compile the mapping document
net.sf.hibernate.MappingException: Associated class not found
at net.sf.hibernate.cfg.Binder.bindOneToMany(Binder.java:719)
at net.sf.hibernate.cfg.Binder.bindCollection(Binder.java:552)
at net.sf.hibernate.cfg.Binder$2.create(Binder.java:1434)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1028)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:253)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:289)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:337)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1027)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:983)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:911)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
at br.com.mundojava.hibernate.main.Main.main(Main.java:28)
Caused by: java.lang.ClassNotFoundException: br.com.mundojava.hiberante.modelo.Cd
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
at net.sf.hibernate.cfg.Binder.bindOneToMany(Binder.java:714)
… 13 more
net.sf.hibernate.MappingException: Error reading resource: Artista.hbm.xml
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:340)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1027)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:983)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:911)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
at br.com.mundojava.hibernate.main.Main.main(Main.java:28)
Caused by: net.sf.hibernate.MappingException: Associated class not found
at net.sf.hibernate.cfg.Binder.bindOneToMany(Binder.java:719)
at net.sf.hibernate.cfg.Binder.bindCollection(Binder.java:552)
at net.sf.hibernate.cfg.Binder$2.create(Binder.java:1434)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1028)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:253)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:289)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:337)
… 5 more
Caused by: java.lang.ClassNotFoundException: br.com.mundojava.hiberante.modelo.Cd
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:102)
at net.sf.hibernate.cfg.Binder.bindOneToMany(Binder.java:714)
… 13 more
[/code]
(cfg.Binder 229 ) Mapping class: br.com.mundojava.hibernate.modelo.Artista -> artista
(cfg.Configuration 332 ) Mapping resource: ./hbm/Capa.hbm.xml
(cfg.Binder 229 ) Mapping class: br.com.mundojava.hibernate.modelo.Capa -> capa
(cfg.Configuration 332 ) Mapping resource: ./hbm/Musica.hbm.xml
(cfg.Binder 229 ) Mapping class: br.com.mundojava.hibernate.modelo.Musica -> musica
(cfg.Configuration 332 ) Mapping resource: ./hbm/Cd.hbm.xml
(cfg.Binder 229 ) Mapping class: br.com.mundojava.hibernate.modelo.Cd -> cd
(cfg.Configuration 1067) Configured SessionFactory: null
(cfg.Configuration 641 ) processing one-to-many association mappings
(cfg.Binder 1181) Mapping collection: br.com.mundojava.hibernate.modelo.Artista.cds -> cd
(cfg.Binder 1181) Mapping collection: br.com.mundojava.hibernate.modelo.Cd.musicas -> musica
(cfg.Configuration 650 ) processing one-to-one association property references
(cfg.Configuration 675 ) processing foreign key constraints
(dialect.Dialect 86 ) Using dialect: net.sf.hibernate.dialect.FirebirdDialect
(cfg.SettingsFactory 70 ) Maximim outer join fetch depth: 1
(cfg.SettingsFactory 74 ) Use outer join fetching: true
(connection.DriverManagerConnectionProvider 42 ) Using Hibernate built-in connection pool (not for production use!)
(connection.DriverManagerConnectionProvider 43 ) Hibernate connection pool size: 1
(connection.DriverManagerConnectionProvider 77 ) using driver: org.firebirdsql.jdbc.FBDriver at URL:
jdbc:firebirdsql:localhost/3050:C:/Arquivos de programas/IBOConsole/MUNDOJAVA?autoReconnect=true
(connection.DriverManagerConnectionProvider 78 ) connection properties: {user=GESTOR, password=msolutec}
(transaction.TransactionManagerLookupFactory 33 ) No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
(cfg.SettingsFactory 114 ) Use scrollable result sets: true
(cfg.SettingsFactory 117 ) Use JDBC3 getGeneratedKeys(): false
(cfg.SettingsFactory 120 ) Optimize cache for minimal puts: false
(cfg.SettingsFactory 126 ) echoing all SQL to stdout
(cfg.SettingsFactory 129 ) Query language substitutions: {no=‘N’, true=1, yes=‘Y’, false=0}
(cfg.SettingsFactory 140 ) cache provider: net.sf.hibernate.cache.EhCacheProvider
(cfg.SettingsFactory 152 ) query cache factory: net.sf.hibernate.cache.StandardQueryCacheFactory
(cfg.Configuration 1130) instantiating and configuring caches
(config.Configurator 123 ) No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath:
jar:file:/C:/Documents%20and%20Settings/RodrigoR/Meus%20documentos/Hibernate/WEB-INF/lib/ehcache-0.7.jar!/ehcache-failsafe.xml
(impl.SessionFactoryImpl 119 ) building session factory
net.sf.hibernate.PropertyNotFoundException: Could not find a setter for property imagem in class br.com.mundojava.hibernate.modelo.Capa
at net.sf.hibernate.property.BasicPropertyAccessor.getSetter(BasicPropertyAccessor.java:131)
at net.sf.hibernate.mapping.Property.getSetter(Property.java:178)
at net.sf.hibernate.persister.AbstractEntityPersister.(AbstractEntityPersister.java:750)
at net.sf.hibernate.persister.EntityPersister.(EntityPersister.java:690)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:137)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:805)
at br.com.mundojava.hibernate.main.Main.main(Main.java:28)
[/code]
E ai galera, to tentando fazer um exemplo de hibernate dar certo aqui tb, mas porém ta dando uns erros!!O código não apresenta nenhum erro, mas depois que mando executa ele me apresenta o seguinte.
xception in thread “main” java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.hibernate.cfg.annotations.Version.(Version.java:12)
at org.hibernate.cfg.AnnotationConfiguration.(AnnotationConfiguration.java:68)
at valer.Listagem12.main(Listagem12.java:19)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:220)
at java.net.URLClassLoader$1.run(URLClassLoader.java:209)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:208)
at java.lang.ClassLoader.loadClass(ClassLoader.java:325)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:270)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:338)
… 3 more
Java Result: 1