-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Cannot get hibernate console working in eclipse
PostPosted: Mon Jul 09, 2007 1:29 am 
Beginner
Beginner

Joined: Wed Nov 30, 2005 10:25 pm
Posts: 25
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


Top
 Profile  
 
 Post subject: Never mind, fixed it
PostPosted: Mon Jul 09, 2007 1:44 am 
Beginner
Beginner

Joined: Wed Nov 30, 2005 10:25 pm
Posts: 25
Found the issue. I needed to add a hibernate-console.properties file to my project:
Code:
hibernate.connection.provider_class = org.hibernate.connection.DriverManagerConnectionProvider
hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql://localhost/test
hibernate.connection.username = test
hibernate.connection.password = test
hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
hibernate.default_catalog = test
hibernate.default_schema = test
hibernate.datasource = java:/testDatasource
hibernate.transaction.manager_lookup_class=


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 10, 2007 11:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm...it should pick up the config automatically. is there a .launch file generated for you ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Here are the launch files...
PostPosted: Tue Jul 10, 2007 11:50 am 
Beginner
Beginner

Joined: Wed Nov 30, 2005 10:25 pm
Posts: 25
Here are the launch files I can find:

/home/andrew/development/christws/customer/web/.externalToolBuilders/com.exadel.verification.verifybuilder.launch
/home/andrew/development/christws/customer/web/.externalToolBuilders/org.eclipse.dali.core.persistenceBuilder.launch


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 10, 2007 12:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so you do get a hibernate-console.properties but no .launch file next to it ?!

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.