Hibernate.cfg.xml

Alguém pode me ajudar com um erro no hibernate de novo???

O erro é o seguinte:
WARNING: Could not bind factory to JNDI
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

Antes eu estava usando o hibernate.properties. Agora vou usar
o hibernate.cfg.xml. Usando este último está ocorrendo o erro acima.

O mapeamento xml tá assim:

[code]<session-factory
name="java:comp/env/hibernate/SessionFactory">

    &lt;!-- properties --&gt;

	&lt;property name=&quot;dialect&quot;&gt;net.sf.hibernate.dialect.OracleDialect&lt;/property&gt;
	&lt;property name=&quot;connection.driver_class&quot;&gt;oracle.jdbc.OracleDriver&lt;/property&gt;
	&lt;property name=&quot;connection.url&quot;&gt;jdbc&#58;oracle&#58;thin&#58;@frajola&#58;1521&#58;devdb&lt;/property&gt;
	&lt;property name=&quot;connection.username&quot;&gt;ejm&lt;/property&gt;
	&lt;property name=&quot;connection.password&quot;&gt;ejmpwd02&lt;/property&gt;

	&lt;property name=&quot;connection.pool_size&quot;&gt;1&lt;/property&gt;
	&lt;property name=&quot;statement_cache.size&quot;&gt;25&lt;/property&gt;

    &lt;property name=&quot;show_sql&quot;&gt;true&lt;/property&gt;
    &lt;property name=&quot;use_outer_join&quot;&gt;true&lt;/property&gt;

	&lt;property name=&quot;jdbc.batch_size&quot;&gt;0&lt;/property&gt;
	&lt;property name=&quot;jdbc.use_streams_for_binary&quot;&gt;true&lt;/property&gt;

	&lt;property name=&quot;cglib.use_reflection_optimizer&quot;&gt;false&lt;/property&gt;

    &lt;!-- mapping files --&gt;
    &lt;mapping resource=&quot;br/com/proj/dao/register/Department.hbm.xml&quot;/&gt;
    &lt;mapping resource=&quot;br/com/proj/dao/register/Template.hbm.xml&quot;/&gt;

	&lt;mapping resource=&quot;br/com/proj/dao/register/User.hbm.xml&quot;/&gt;
	&lt;mapping resource=&quot;br/com/proj/dao/register/Product.hbm.xml&quot;/&gt;
	&lt;mapping resource=&quot;br/com/proj/dao/register/Action.hbm.xml&quot;/&gt;		

&lt;/session-factory&gt;[/code]

Se alguém puder me ajudar…

Obrigado

abraços

Galera to passando o mesmo dobrado com o novo arquivo de configurações do hibernate. Alguem poderia dar uma explicação sobre ele :lol:

Se puder valew !!!

Galera ta dando um mesmo pau aqui, quem pode desvendar isso

WARNING&#58; Could not bind factory to JNDI
javax.naming.NoInitialContextException&#58; Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file&#58;  java.naming.factory.initial
	at javax.naming.spi.NamingManager.getInitialContext&#40;NamingManager.java&#58;640&#41;
	at javax.naming.InitialContext.getDefaultInitCtx&#40;InitialContext.java&#58;243&#41;
	at javax.naming.InitialContext.getURLOrDefaultInitCtx&#40;InitialContext.java&#58;280&#41;
	at javax.naming.InitialContext.getNameParser&#40;InitialContext.java&#58;429&#41;
	at net.sf.hibernate.util.NamingHelper.bind&#40;NamingHelper.java&#58;52&#41;
	at net.sf.hibernate.impl.SessionFactoryObjectFactory.addInstance&#40;SessionFactoryObjectFactory.java&#58;90&#41;
	at net.sf.hibernate.impl.SessionFactoryImpl.&lt;init&gt;&#40;SessionFactoryImpl.java&#58;264&#41;
	at net.sf.hibernate.cfg.Configuration.buildSessionFactory&#40;Configuration.java&#58;627&#41;
	at sic.sicla.dao.UsuarioDAO.&lt;init&gt;&#40;UsuarioDAO.java&#58;27&#41;
	at sic.sicla.view.MainApp.main&#40;MainApp.java&#58;133&#41;
30/09/2003 09&#58;55&#58;42 net.sf.hibernate.impl.SessionFactoryImpl &lt;init&gt;
INFO&#58; Query language substitutions&#58; &#123;&#125;
Hibernate&#58; insert into TBUSUARIOS &#40;NOME, SENHA, NIVEL, ID&#41; values &#40;?, ?, ?, ?&#41;
java.lang.NullPointerException
30/09/2003 09&#58;55&#58;43 net.sf.hibernate.impl.SessionImpl finalize
WARNING&#58; unclosed connection

meu arquivo cfg.xml esta assim

&lt;?xml version='1.0' encoding='utf-8'?&gt;
&lt;!DOCTYPE hibernate-configuration PUBLIC
&quot;-//Hibernate/Hibernate Configuration DTD 2.0//EN&quot;
&quot;http&#58;//hibernate.sourceforge.net/hibernate-configuration-2.0.dtd&quot;&gt;

&lt;hibernate-configuration&gt;

&lt;!-- a SessionFactory instance listed as /jndi/name --&gt;

&lt;session-factory name=&quot;java&#58;comp/env/hibernate/SessionFactory&quot;&gt; 

      &lt;!-- properties --&gt;     
      &lt;property name=&quot;dialect&quot;&gt;net.sf.hibernate.dialect.InterbaseDialect&lt;/property&gt; 
      &lt;property name=&quot;connection.driver_class&quot;&gt;org.firebirdsql.jdbc.FBDriver&lt;/property&gt; 
      &lt;property name=&quot;connection.url&quot;&gt;jdbc&#58;firebirdsql&#58;localhost/3050&#58;c&#58;/sic/sicla.gdb&lt;/property&gt; 
      &lt;property name=&quot;connection.username&quot;&gt;sysdba&lt;/property&gt; 
      &lt;property name=&quot;connection.password&quot;&gt;masterkey&lt;/property&gt; 

      &lt;property name=&quot;connection.pool_size&quot;&gt;1&lt;/property&gt; 
      &lt;property name=&quot;statement_cache.size&quot;&gt;25&lt;/property&gt; 

      &lt;property name=&quot;show_sql&quot;&gt;true&lt;/property&gt; 
      &lt;property name=&quot;use_outer_join&quot;&gt;true&lt;/property&gt; 

      &lt;property name=&quot;jdbc.batch_size&quot;&gt;0&lt;/property&gt; 
      &lt;property name=&quot;jdbc.use_streams_for_binary&quot;&gt;true&lt;/property&gt; 

      &lt;property name=&quot;cglib.use_reflection_optimizer&quot;&gt;false&lt;/property&gt; 

        &lt;!-- mapping files --&gt; 
        &lt;mapping resource=&quot;sic/sicla/dao/Usuario.hbm.xml&quot;/&gt; 
		
    &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;

Help-me !!! :shock:

Eu tbm estou com este problema. Isto que aparece é apenas um WARNING. No caso, vc não está usando JNDI, e sim o driver de um DB
diretamente. vc pode substituir o código:

&lt;session-factory name=&quot;java&#58;comp/env/hibernate/SessionFactory&quot;&gt;

por:

&lt;session-factory&gt;

Tenta aí e vê o que dá!!!

falow