Error parsing JNDI name

1 resposta
E

Olá!

Pessoal por favor me ajudem, cansei de procurar como resolver isso aqui. preciso urgente tentar entender o que está errado
O erro que aparece no console:

Ocorreu um erro ao iniciar a SF. org.hibernate.service.jndi.JndiException: Error parsing JNDI name [java:/comp/env/jdbc/tc]
Exception in thread "main" java.lang.NullPointerException

Arquivo Context.xml:
<?xml version="1.0" encoding="UTF-8"?>

<Context reloadable="true">
	<Resource name="jdbc/tc" 
	auth="Container" 
	type="javax.sql.DataSource"
	maxActive="100"
	maxIdle="30" 
	maxWait="1000"
	username ="root"
	password="root"
	driverClassName="com.mysql.jdbc.Driver" 
	url="jdbc:mysql://localhost:3306/tc?autoReconnect=true"/>
</Context>
Configuração web.xml:
<!-- configuração DataSource -->
	<resource-ref>
		<description>DataSource tc</description>
		<res-ref-name>jdbc/tc</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>
hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
	<session-factory>

		<!-- CONFIGURAÇÕES DE CONEXÃO DO DIALETO  E APONTAMENTO PARA DATASOURCE-->
		<property name="hibernate.connection.datasource">java:/comp/env/jdbc/tc</property>	
		<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
		
		
		
		
		<!-- CONFIGURAÇÕES DO POOL DE CONEXÕES -->
		<property name="c3p0.min_size">5</property><!-- NÚMERO MÍNIMO DE CONEXÕES -->
		<property name="c3p0.max_size">30</property><!-- NÚMERO MÁXIMO DE CONEXÕES -->
		<property name="c3p0.timeout">300</property><!-- TEMPO LIMITE DAS CONEXÕES INATIVAS -->
		<property name="c3p0.max_statements">80</property><!-- NÚMERO MÁXIMO DE DECLARAÇÕES PREPARADA QUE IRÃO PARA CACHE -->
		<property name="c3p0.idle_test_period">300</property><!-- TEMPO DE INATIVIDADE ANTES QUE A CONEXÃO SEJA AUTOMATICAMANTE FECHADA -->
			

		<!-- CONFIGURAÇÕES DE DEBUG -->
		<property name="hibernate.show_sql">true</property>
		<property name="hibernate.format_sql">true</property>
		<property name="generate_statistics">true</property>
		<property name="use_sql_comments">true</property>

		<!-- HABILITA A ATUALIZAÇÃO AUTOMÁTICA DA ESTRUTURA DE TABELAS PELO HIBERNATE -->
		<property name="hibernate.hbm2ddl.auto">update</property>


		<!-- LISTA DE ENTIDADES -->
		<mapping class="br.com.ueg.tc.model.entities.Usuario"/>
		
		
	</session-factory>
</hibernate-configuration>
Arquivo applicationContext:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
	http://www.springframework.org.schema/beans/spring-beans-3.0.xsd">
	
	<bean id="financeiroDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
		<propriety name="jndiName">
			<value>java:comp/env/jdbc/tc</value>
		</propriety>
	</bean>
</beans>

1 Resposta

E

Esqueci de dizer.
Antes de tentar configurar esse spring security
estava tudo uma blz quando ia fazer conexão com o banco. Acrescentei essas configurações e começou a não prestar.

Criado 21 de março de 2013
Ultima resposta 21 de mar. de 2013
Respostas 1
Participantes 1