File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes ClassPathXmlApplicationContext and configuration file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "ClassPathXmlApplicationContext and configuration file" Watch "ClassPathXmlApplicationContext and configuration file" New topic

ClassPathXmlApplicationContext and configuration file

Alex Armenteros
Ranch Hand

Joined: May 05, 2010
Posts: 75
Normally when using XML Beans I use this

But now I need to use Spring Scheduling and I need an ApplicationContext

And it seems the properties are black as this exception appears loading the Hibernate SessionFactory

org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available

Any error on that code snippet?

Jayesh A Lalwani
Saloon Keeper

Joined: Jan 17, 2008
Posts: 2716

Well, as the exception says there is something wrong with either the hibernate dialect or the connection to database. You will need to look at how your data source is setup
Alex Armenteros
Ranch Hand

Joined: May 05, 2010
Posts: 75
I think I solved it

I must not call applicationContext.refresh() before adding the configurer so this must be done:

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32818

Thanks for posting the solution

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: ClassPathXmlApplicationContext and configuration file
It's not a secret anymore!