No connection properties specified - the user must supply JDBC connections

1,005 views
Skip to first unread message

nicola....@gmail.com

unread,
May 28, 2009, 10:04:06 AM5/28/09
to warp-core
I have the warning in the subject, when using Guice 2.0 + Warp
2.0-20090214 + Hibernate 3.3.x, and then an exception saying the
dialect is not set.

Could you please help me ??


Thanks!!


The configuration file is the following and appears to be read:
-------------------------------------
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">org.hsqldb.jdbcDriver</
property>
<property name="connection.url">jdbc:hsqldb:hsql://localhost</
property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="dialect">org.hibernate.dialect.HSQLDialect</
property>

<property name="current_session_context_class">thread</property>
<property
name="cache.provider_class">org.hibernate.cache.NoCacheProvider</
property>

<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>

<mapping package="com.naaka.spikes.domain" />
<mapping class="com.naaka.spikes.domain.Book" />
<mapping class="com.naaka.spikes.domain.Cart" />
</session-factory>
</hibernate-configuration>


I have the following dependency tree:
-------------------------------------
[INFO] com.naaka.spikes:book:jar:1.0-SNAPSHOT
[INFO] +- commons-lang:commons-lang:jar:2.4:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.2:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.5.2:compile
[INFO] | \- log4j:log4j:jar:1.2.14:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.5.2:compile
[INFO] +- com.google.code.guice:guice:jar:2.0:compile
[INFO] +- aopalliance:aopalliance:jar:guice-2.0:compile
[INFO] +- com.wideplay:warp-persist:jar:2.0-20090214:compile
[INFO] +- hsqldb:hsqldb:jar:1.8.0.7:compile
[INFO] +- org.hibernate:hibernate-core:jar:3.3.1.GA:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | \- javax.transaction:jta:jar:1.1:compile
[INFO] +- org.hibernate:hibernate-annotations:jar:3.4.0.GA:compile
[INFO] +- org.hibernate:hibernate-commons-annotations:jar:
3.1.0.GA:compile
[INFO] +- org.hibernate:hibernate-validator:jar:3.1.0.GA:compile
[INFO] +- org.hibernate:ejb3-persistence:jar:3.3.2.Beta1:compile
[INFO] +- org.testng:testng:jar:jdk15:5.7:test
[INFO] +- org.mockito:mockito-all:jar:1.7:test
[INFO] \- org.hamcrest:hamcrest-all:jar:1.2:test


Detailed Exception:
-------------------------------------
WARN org.hibernate.connection.UserSuppliedConnectionProvider.configure
(UserSuppliedConnectionProvider.java:46) No connection properties
specified - the user must supply JDBC connections
FAILED CONFIGURATION: @BeforeMethod startDb
org.hibernate.HibernateException: Hibernate Dialect must be explicitly
set
at org.hibernate.dialect.DialectFactory.determineDialect
(DialectFactory.java:80)
at org.hibernate.dialect.DialectFactory.buildDialect
(DialectFactory.java:62)
at org.hibernate.cfg.SettingsFactory.determineDialect
(SettingsFactory.java:460)
at org.hibernate.cfg.SettingsFactory.buildSettings
(SettingsFactory.java:155)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:
2101)
at org.hibernate.cfg.Configuration.buildSessionFactory
(Configuration.java:1325)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory
(AnnotationConfiguration.java:867)
at com.wideplay.warp.persist.hibernate.SessionFactoryProvider$1.get
(SessionFactoryProvider.java:49)
at com.wideplay.warp.persist.hibernate.SessionFactoryProvider$1.get
(SessionFactoryProvider.java:48)
at com.wideplay.warp.persist.internal.LazyReference.get
(LazyReference.java:53)
at com.wideplay.warp.persist.hibernate.SessionFactoryProvider.get
(SessionFactoryProvider.java:68)
at com.wideplay.warp.persist.hibernate.SessionFactoryProvider.get
(SessionFactoryProvider.java:35)
at
com.wideplay.warp.persist.hibernate.HibernatePersistenceService.start
(HibernatePersistenceService.java:43)
at com.naaka.spikes.domain.CartTest.startDb(CartTest.java:26)
..

Robbie Vanbrabant

unread,
May 28, 2009, 5:37:42 PM5/28/09
to warp...@googlegroups.com
It seems like Hibernate can't find your configuration file, is it located in the root of your classpath? (make sure it's copied after compilation)

Robbie

nicola....@gmail.com

unread,
May 29, 2009, 4:21:24 AM5/29/09
to warp-core
The following log shows that the file is correctly read:

...
INFO org.hibernate.cfg.Configuration.addResource(Configuration.java:
586) Reading mappings from resource : hibernate.cfg.xml
...
DEBUG org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType
(AnnotationConfiguration.java:529) Process hbm files
DEBUG org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType
(AnnotationConfiguration.java:537) Process annotated classes
DEBUG
org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder
(AnnotationConfiguration.java:401) processing fk mappings (*ToOne
and JoinedSubclass)
DEBUG org.hibernate.cfg.Configuration.secondPassCompile
(Configuration.java:1153) processing extends queue
DEBUG org.hibernate.cfg.Configuration.secondPassCompile
(Configuration.java:1157) processing collection mappings
DEBUG org.hibernate.cfg.Configuration.secondPassCompile
(Configuration.java:1168) processing native query and
ResultSetMapping mappings
DEBUG org.hibernate.cfg.Configuration.secondPassCompile
(Configuration.java:1176) processing association property references
DEBUG org.hibernate.cfg.Configuration.secondPassCompile
(Configuration.java:1198) processing foreign key constraints
...

I also debugged the addResource() method call, that showed the the xml
is correcty read, as the following dom snapshot shows:

[org.dom4j.tree.DefaultElement@1e3e7d2 [Element: <property attributes:
[org.dom4j.tree.DefaultAttribute@188a387 [Attribute: name name value
"connection.driver_class"]]/>], org.dom4j.tree.DefaultElement@1a81bd5
[Element: <property attributes:
[org.dom4j.tree.DefaultAttribute@1bb60ad [Attribute: name name value
"connection.url"]]/>], org.dom4j.tree.DefaultElement@c80e21 [Element:
<property attributes: [org.dom4j.tree.DefaultAttribute@17bcd4
[Attribute: name name value "connection.username"]]/>],
org.dom4j.tree.DefaultElement@6e3fe4 [Element: <property attributes:
[org.dom4j.tree.DefaultAttribute@24c22b [Attribute: name name value
"connection.password"]]/>], org.dom4j.tree.DefaultElement@147a16f
[Element: <property attributes:
[org.dom4j.tree.DefaultAttribute@1b78953 [Attribute: name name value
"dialect"]]/>], org.dom4j.tree.DefaultElement@98b13b [Element:
<property attributes: [org.dom4j.tree.DefaultAttribute@9bad4f
[Attribute: name name value "current_session_context_class"]]/>],
org.dom4j.tree.DefaultElement@8f3eac [Element: <property attributes:
[org.dom4j.tree.DefaultAttribute@5ba50e [Attribute: name name value
"transaction.factory_class"]]/>], org.dom4j.tree.DefaultElement@b173c3
[Element: <property attributes:
[org.dom4j.tree.DefaultAttribute@270fc4 [Attribute: name name value
"cache.provider_class"]]/>], org.dom4j.tree.DefaultElement@7c4768
[Element: <property attributes:
[org.dom4j.tree.DefaultAttribute@1342f5b [Attribute: name name value
"show_sql"]]/>], org.dom4j.tree.DefaultElement@11126f6 [Element:
<property attributes: [org.dom4j.tree.DefaultAttribute@114ef62
[Attribute: name name value "hbm2ddl.auto"]]/>],
org.dom4j.tree.DefaultElement@1703484 [Element: <mapping attributes:
[org.dom4j.tree.DefaultAttribute@187e184 [Attribute: name package
value "com.naaka.spikes.domain"]]/>],
org.dom4j.tree.DefaultElement@1e6cf07 [Element: <mapping attributes:
[org.dom4j.tree.DefaultAttribute@2209db [Attribute: name class value
"com.naaka.spikes.domain.Book"]]/>],
org.dom4j.tree.DefaultElement@b53b32 [Element: <mapping attributes:
[org.dom4j.tree.DefaultAttribute@41647f [Attribute: name class value
"com.naaka.spikes.domain.Cart"]]/>]]


The connection properties appear to be read from the xml files !





On May 28, 11:37 pm, Robbie Vanbrabant <robbie.vanbrab...@gmail.com>
wrote:
> It seems like Hibernate can't find your configuration file, is it located in
> the root of your classpath? (make sure it's copied after compilation)
>
> Robbie
>
> On Thu, May 28, 2009 at 4:04 PM, nicola.sina...@gmail.com <

nicola....@gmail.com

unread,
May 29, 2009, 4:23:38 AM5/29/09
to warp-core
Could you please verify the versions of hibernate i am using ?

Can you tell me which versions are you using on your projects ?


It might be a dependency issue....




On May 28, 11:37 pm, Robbie Vanbrabant <robbie.vanbrab...@gmail.com>
wrote:
> It seems like Hibernate can't find your configuration file, is it located in
> the root of your classpath? (make sure it's copied after compilation)
>
> Robbie
>
> On Thu, May 28, 2009 at 4:04 PM, nicola.sina...@gmail.com <

nicola....@gmail.com

unread,
May 29, 2009, 4:23:45 AM5/29/09
to warp-core
Could you please verify the versions of hibernate i am using ?

Can you tell me which versions are you using on your projects ?


It might be a dependency issue....




On May 28, 11:37 pm, Robbie Vanbrabant <robbie.vanbrab...@gmail.com>
wrote:
> It seems like Hibernate can't find your configuration file, is it located in
> the root of your classpath? (make sure it's copied after compilation)
>
> Robbie
>
> On Thu, May 28, 2009 at 4:04 PM, nicola.sina...@gmail.com <

Robbie Vanbrabant

unread,
Jun 6, 2009, 8:18:31 AM6/6/09
to warp...@googlegroups.com
Could you share your Warp Persist configuration? Nothing seems to indicate that this is a dependency issue.
Maybe Warp Persist is using a JIT binding for your Configuration object because you didn't bind it and are creating it elsewhere? Just guessing.

Robbie
Reply all
Reply to author
Forward
0 new messages