Olá,
Estou implementando um aplicativo 3 camadas (dados, negocio, aplicacao) e estou configurando o hibernate 2 para fazer a consistência de dados. Com sou novo com hibernate surgiu um problema que nao sei resolver.
Na main class do meu projeto eu inicio o HibernateUtil que copiei da referencia do hibernate. (http://technology.amis.nl/blog/index.php?p=137)
static br.gov.sp.al.chinchilla.dados.HibernateUtil hibernate4Chinchilla =
new br.gov.sp.al.chinchilla.dados.HibernateUtil();
Ele inicia o factory numa boa, mapeia o driver para oracle 9i, carrega o hbm do meu bean, tudo normal. Se eu não chamar um session o programa roda perfeitamente, mas quando chamo o session ele levanta o seguinte erro:
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
at net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:313)
Já tive vários outros grilos no meu código, mas este estou com dificuldades de resolver. A maioria se relacionava a dependencias que precisavam ser mapeadas no projeto. Se alguém tiver uma idéia eu agradesço.
PS: estou usando o JBuilder X, compilando com o java 1.3. O bd é oracle 9i. Segue os erros:
01/10/2004 18:44:05 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.6
01/10/2004 18:44:05 net.sf.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connection.username=rh, hibernate.connection.password=***, hibernate.cglib.use_reflection_optimizer=true, hibernate.connection.url=jdbc:oracle:thin:@alsrv101.al.sp.gov.br:1575:workflow, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver}
01/10/2004 18:44:05 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
01/10/2004 18:44:05 net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /chinchilla.cfg.xml
01/10/2004 18:44:05 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /chinchilla.cfg.xml
01/10/2004 18:44:05 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: br/gov/sp/al/chinchilla/dados/expediente.hbm.xml
01/10/2004 18:44:06 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: br.gov.sp.al.chinchilla.dados.expediente -> expediente
01/10/2004 18:44:06 net.sf.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
01/10/2004 18:44:06 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
01/10/2004 18:44:06 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
01/10/2004 18:44:06 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
01/10/2004 18:44:06 net.sf.hibernate.dialect.Dialect
INFO: Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
01/10/2004 18:44:06 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: true
01/10/2004 18:44:06 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
01/10/2004 18:44:06 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
01/10/2004 18:44:06 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@alsrv101.al.sp.gov.br:1575:workflow
01/10/2004 18:44:06 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=rh, password=***}
01/10/2004 18:44:06 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
01/10/2004 18:44:08 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
01/10/2004 18:44:08 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
01/10/2004 18:44:08 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
01/10/2004 18:44:09 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
01/10/2004 18:44:09 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
01/10/2004 18:44:09 net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
01/10/2004 18:44:09 net.sf.hibernate.impl.SessionFactoryImpl
INFO: building session factory
01/10/2004 18:44:10 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
at net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:313)
at net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:326)
at net.sf.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:334)
at br.gov.sp.al.chinchilla.dados.HibernateUtil.currentSession(HibernateUtil.java:30)
at br.gov.sp.al.chinchilla.aplicacao.sistemaRH.initHibernate(sistemaRH.java:50)
at br.gov.sp.al.chinchilla.aplicacao.sistemaRH.(sistemaRH.java:21)
at br.gov.sp.al.chinchilla.aplicacao.sistemaRH.main(sistemaRH.java:69)
Exception in thread “main”
