Hibernate + 1 erro

se eu configurar o hbm.xml assim…

 <session-factory>
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.password">ibict_fs</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@192.168.0.254:1521:sigmab</property>
        <property name="hibernate.connection.username">ibict_fs</property>
        <property name="hibernate.default_schema">IBICT_FS</property>
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
   
   <!-- Condiguração do c3p0 -->
		<property name="hibernate.c3p0.max_size">10</property>
		<property name="hibernate.c3p0.min_size">2</property>
		<property name="hibernate.c3p0.timeout">5000</property>
		<property name="hibernate.c3p0.max_statements">10</property>
		<property name="hibernate.c3p0.idle_test_period">3000</property>
   		<property name="hibernate.c3p0.acquire_increment">2</property>
		
		<!-- Configurações de debug -->
		<property name="show_sql">true</property>
		<property name="hibernate.generate_statistics">true</property>
		<property name="hibernate.use_sql_comments">true</property>

eu mesmo assim precis configurar o hibernate.properties???

hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
hibernate.connection.password=ibict_fs
hibernate.connection.url=jdbc:oracle:thin:@192.168.0.254:1521:sigmab
hibernate.connection.username=ibict_fs
hibernate.dialect=org.hibernate.dialect.OracleDialect
hibernate.default_schema=IBICT_FS

pq, se eu nao coloco o hibernate.properties o erro é esse…

2006-07-20 08:26:48,218 INFO  hibernate.connection.C3P0ConnectionProvider  -> C3P0 using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@192.168.0.254:1521:sigmab
2006-07-20 08:26:48,218 INFO  hibernate.connection.C3P0ConnectionProvider  -> Connection properties: {user=ibict_fs, password=****}
2006-07-20 08:26:48,218 INFO  hibernate.connection.C3P0ConnectionProvider  -> autocommit mode: false
2006-07-20 08:26:48,250 FATAL hibernate.connection.C3P0ConnectionProvider  -> JDBC Driver class not found: oracle.jdbc.driver.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)

e se eu coloco é esse

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:595)
org.hibernate.MappingException: Error reading resource: hibernate.properties
	at org.hibernate.cfg.Configuration.addResource(Configuration.java:452)

1º) Essa informações só precisam constar em um lugar apenas
2º) O arquivo de configuração do Hibernate é o hibernate.cfg.xml e não .hbm.xml
3º) Configurando ele basta colocar no seu código a SessionFactory recebendo as configurações, tipo:

sessionFactory = new Configuration().configure("/PACOTE/hibernate.cfg.xml").buildSessionFactory();

Outra coisa, verifique se dentro do seu /WEB-INF/lib/ ou no seu CLASSPATH está o .jar do Driver do Oracle.

[quote=fhsantiago]java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at org.apache.catalina.loader.WebappClassLoader.loadClass[/quote]

Brigado pessoal. mas me responda uma coisa. o driver oracle é esse aqui
ojdbc14.zip???
presisa de mais algo,alem dos arquivos do hibernate claro…

Não me recordo agora os .jar do Oracle…
Mas o ojdbc14.jar com certeza deve estar presente, não sei outros .jar devem estar presente também.

Após teste, foi solicitado mais alguma class que não foi encontrada?

INFO: Reloading this Context has started
2006-07-20 10:34:54,531 INFO  hibernate.cfg.Environment  -> Hibernate 3.0.5
2006-07-20 10:34:54,546 INFO  hibernate.cfg.Environment  -> loaded properties from resource hibernate.properties: {hibernate.connection.username=ibict_fs, hibernate.default_schema=IBICT_FS, hibernate.connection.password=****, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=org.hibernate.dialect.OracleDialect, hibernate.connection.url=jdbc:oracle:thin:@192.168.0.254:1521:sigmab, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver}
2006-07-20 10:34:54,546 INFO  hibernate.cfg.Environment  -> using CGLIB reflection optimizer
2006-07-20 10:34:54,546 INFO  hibernate.cfg.Environment  -> using JDK 1.4 java.sql.Timestamp handling
2006-07-20 10:34:54,750 INFO  hibernate.cfg.Configuration  -> configuring from resource: hibernate.cfg.xml
2006-07-20 10:34:54,750 INFO  hibernate.cfg.Configuration  -> Configuration resource: hibernate.cfg.xml
2006-07-20 10:34:54,937 INFO  hibernate.cfg.Configuration  -> Mapping resource: demo/TbEventos.hbm.xml
2006-07-20 10:34:55,140 INFO  hibernate.cfg.HbmBinder  -> Mapping class: hibernate.TbEventos -> TB_EVENTOS
2006-07-20 10:34:55,203 INFO  hibernate.cfg.Configuration  -> Configured SessionFactory: null
2006-07-20 10:34:55,218 INFO  hibernate.cfg.Configuration  -> processing extends queue
2006-07-20 10:34:55,218 INFO  hibernate.cfg.Configuration  -> processing collection mappings
2006-07-20 10:34:55,218 INFO  hibernate.cfg.Configuration  -> processing association property references
2006-07-20 10:34:55,218 INFO  hibernate.cfg.Configuration  -> processing foreign key constraints
2006-07-20 10:34:55,406 INFO  hibernate.connection.C3P0ConnectionProvider  -> C3P0 using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@192.168.0.254:1521:sigmab
2006-07-20 10:34:55,406 INFO  hibernate.connection.C3P0ConnectionProvider  -> Connection properties: {user=ibict_fs, password=****}
2006-07-20 10:34:55,406 INFO  hibernate.connection.C3P0ConnectionProvider  -> autocommit mode: false
2006-07-20 10:34:55,437 FATAL hibernate.connection.C3P0ConnectionProvider  -> JDBC Driver class not found: oracle.jdbc.driver.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)

sempre o erro do oracle…

o meu arquivo ta assim
factory = new Configuration().configure(“hibernate.cfg.xml”).buildSessionFactory();
e o hibernate.cfg.xml ta na raiz…
Fontes\proj\JavaSource

Anteriormente você colocou que o arquivo lib do Oracle JDBC era um .zip, se for isso mesmo, renomei a extensão para .jar, talvez possa ser isso!

cara… parece que funcionou aqui…mas olha o erro…

org.apache.jasper.JasperException: Not able to obtain connection
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

org.hibernate.HibernateException: Not able to obtain connection
	org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:113)
	org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:88)
	org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1162)
	org.hibernate.loader.Loader.doQuery(Loader.java:390)
	org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
	org.hibernate.loader.Loader.doList(Loader.java:1593)
	org.hibernate.loader.Loader.list(Loader.java:1577)
	org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
	org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
	org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
	org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
	demo.TbEventosFacade.getEventos(TbEventosFacade.java:21)
	org.apache.jsp.pages.inputname_jsp._jspService(inputname_jsp.java:112)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

O que está presente no seu código nessa parte?

demo.TbEventosFacade.getEventos(TbEventosFacade.java:21)

O Hibernate não está conseguindo estabelecer uma conexão!

package demo;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

public class TbEventosFacade {

	
	public List getEventos(){
		
		Session sessao = HibernateUtility.getSession();
		Transaction tx = sessao.beginTransaction();
		Query select = sessao.createQuery("from TbEventos");
		List objetos = select.list();
		System.out.println(objetos);
		tx.commit();
		sessao.close();
		return select.list();
		
		
	}
	
}

brigadao pela força ai cara…

Mas diz qual é a linha 21 do código, assim não dá para saber!

Ah! E por que você não dá um return objetos no lugar de return select.list()?

hahahahahaahahaahahah… Brigadao…Funcionou aqui.