I cannot get my project to be used in the hibernate console.
Environment:
Eclipse 3.3.0 on Linux
JBossTools-200706241629-nightly-ALL-linux-gtk.zip
I have setup my project using to use seam with the embedded EJB3 container.
It is setup using:
persistence.xml
jboss-beans.xml
Contents:
persistence.xml:
Code:
<persistence>
<persistence-unit name="entityManager" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/testDatasource</jta-data-source>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="connection.release_mode">after_statement</property>
<property name="hibernate.default_schema">public</property>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<property name="hibernate.transaction.flush_before_completion" value="true"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.query.substitutions"></property>
<property name="jboss.entity.manager.factory.jndi.name"
value="java:/testEntityManagerFactory"/>
<property name="jboss.entity.manager.jndi.name"
value="java:/entityManager"/>
</properties>
</persistence-unit>
</persistence>
jboss-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">
<bean name="christwsDatasourceBootstrap"
class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
<property name="driverClass">org.postgresql.Driver</property>
<property name="connectionURL">jdbc:postgresql://localhost/test</property>
<property name="userName">test</property>
<property name="password">test</property>
<property name="jndiName">java:/testDatasource</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="testDatasource" class="java.lang.Object">
<constructor factoryMethod="getDatasource">
<factory bean="testDatasourceBootstrap" />
</constructor>
</bean>
</deployment>
My code works fine, but the hibernate tools do not. I get:
Sessionfactory error: Cound not find datasource
Eclipse stack trace:
Code:
org.hibernate.HibernateException: Could not find datasource
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2005)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$1.execute(LazyDatabaseSchemaWorkbenchAdapter.java:91)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:88)
at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:57)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:94)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: javax.naming.NamingException: Local server is not initialized
at org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:45)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:175)
at org.hibernate.util.NamingHelper.getInitialContext(NamingHelper.java:28)
at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
... 11 more
What do I need to do to have eclipse recognize the data source which is currently in jboss-beans.xml?
Thanks,
Andrew