I'm reading "Java Persistence with Hibernate", Chapter 2.
I'm trying to run the examples in Eclipse development environment(Ganymede), using the JBOSS plug-in server and Hibernate. I'm stuck on the example which runs EJB components with JBOSS (page 115).
I have downloaded the source code from
http://www.manning.com/bauer2/. The persistence.xml and helloworld-beans.xml I have put in the META-INF directory of my project. When I start the server, I get the following problem:
Code:
17:25:53,031 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:ear=TestApplication.ear,jar=TestApplicationEJB.jar,unitName=helloworld
State: NOTYETINSTALLED
I Depend On:
jboss.jca:name=HelloWorldDS,service=DataSourceBinding
My persistence.xml looks like this:
Code:
<persistence 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" version="1.0">
<persistence-unit name="helloworld">
<!-- A datasource managed by the Java EE runtime environment -->
<jta-data-source>java:/HelloWorldDS</jta-data-source>
<properties>
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<!-- SQL stdout logging
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="use_sql_comments" value="true"/>
-->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<!-- On deployment of this persistence unit, drop and then re-create all tables -->
<property name="hibernate.hbm2ddl.auto" value="create"/>
</properties>
</persistence-unit>
</persistence>
and my hello-beans.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer:2.0">
<!-- Enable a JCA datasource available through JNDI -->
<bean name="helloWorldDatasourceFactory"
class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
<property name="jndiName">java:/HelloWorldDS</property>
<!-- HSQL DB -->
<property name="driverClass">com.mysql.jdbc.Driver</property>
<property name="connectionURL">jdbc:mysql://localhost:3306/jpa_hibernate</property>
<property name="userName">root</property>
<property name="password">deborah</property>
<property name="minSize">0</property>
<property name="maxSize">10</property>
<property name="blockingTimeout">1000</property>
<property name="idleTimeout">100000</property>
<property name="transactionManager"><inject bean="TransactionManager"/></property>
<property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property>
<property name="initialContextProperties"><inject bean="InitialContextProperties"/></property>
</bean>
<bean name="HelloWorldDS" class="java.lang.Object">
<constructor factoryMethod="getDatasource">
<factory bean="helloWorldDatasourceFactory"/>
</constructor>
</bean>
</deployment>
As you can see I'm connecting to a MySQL database. Any ideas?