[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Problem getting JDBC datasource from JBOSS

bikerzon do-not-reply at jboss.com
Fri Jun 20 05:18:11 EDT 2008


Here's my final persistence.xml :

  | <?xml version="1.0" encoding="UTF-8"?>
  | <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  | 	<persistence-unit name="jboss_jpa_web_all_in_one">
  | 		<provider>org.hibernate.ejb.HibernatePersistence</provider>
  | 		<mapping-file>META-INF/orm.xml</mapping-file>
  | 		<class>com.hui.Person</class>
  | 		<properties>
  | 			<property name="hibernate.connection.datasource" value="java:MySqlDS" />
  | 			<property name="hibernate.connection.release_mode" value="after_transaction" />
  | 			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
  | 			<property name="hibernate.hbm2ddl.auto" value="create" />
  | 			<property name="hibernate.cache.use_query_cache" value="false" />
  | 			<property name="hibernate.show_sql" value="true" />
  | 		</properties>
  | 	</persistence-unit>
  | </persistence>
  | 
  | 

I initiate the context with the jndi environment directly from my code, and also I did package the jndi.properties with my apps.

The results is also the same - NullPointerException - the return object is null from jndi lookup.

But from the JMX console I do see the java:MySqlDS

This is too weird.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159501#4159501

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159501



More information about the jboss-user mailing list