warp-persist "no connection available" error

13 views
Skip to first unread message

Same dude

unread,
Jan 2, 2010, 11:34:37 PM1/2/10
to warp-core
Hello, im having a bit of problem setting up warp-persist.
To make this super easy on myself, Im adding warp persist to a very
simple hibernate gwt project that has someone login to the server to
authenticate (via rpc).
I added a java file with main arguments so I could set this up without
having to set it up with gwt RPC.

My error is as such:

Exception in thread "main" com.google.inject.CreationException: Guice
creation errors:

1) Error injecting constructor, org.hibernate.HibernateException:
'hibernate.dialect' must be set when no Connection avalable
at org.webhop.ywdc.login.client.MyInitializer.<init>
(MyInitializer.java:8)
while locating org.webhop.ywdc.login.client.MyInitializer

1 error
at
com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist
(Errors.java:354)
at com.google.inject.InjectorBuilder.injectDynamically
(InjectorBuilder.java:179)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:113)
at com.google.inject.Guice.createInjector(Guice.java:92)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
at org.webhop.ywdc.login.client.Main.main(Main.java:24)
Caused by: org.hibernate.HibernateException: 'hibernate.dialect' must
be set when no Connection avalable
at org.hibernate.dialect.resolver.DialectFactory.buildDialect
(DialectFactory.java:107)
at org.hibernate.cfg.SettingsFactory.buildSettings
(SettingsFactory.java:138)
at org.hibernate.cfg.Configuration.buildSettingsInternal
(Configuration.java:2119)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:
2115)
at org.hibernate.cfg.Configuration.buildSessionFactory
(Configuration.java:1339)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory
(AnnotationConfiguration.java:867)
at com.wideplay.warp.hibernate.SessionFactoryProvider$1.get
(SessionFactoryProvider.java:52)
at com.wideplay.warp.hibernate.SessionFactoryProvider$1.get
(SessionFactoryProvider.java:50)
at com.wideplay.warp.util.LazyReference.get(LazyReference.java:53)
at com.wideplay.warp.hibernate.SessionFactoryProvider.get
(SessionFactoryProvider.java:71)
at com.wideplay.warp.hibernate.SessionFactoryProvider.get
(SessionFactoryProvider.java:36)
at com.wideplay.warp.hibernate.HibernatePersistenceService.start
(HibernatePersistenceService.java:43)
at org.webhop.ywdc.login.client.MyInitializer.<init>
(MyInitializer.java:10)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.google.inject.DefaultConstructionProxyFactory$2.newInstance
(DefaultConstructionProxyFactory.java:81)
at com.google.inject.ConstructorInjector.construct
(ConstructorInjector.java:85)
at com.google.inject.ConstructorBindingImpl$Factory.get
(ConstructorBindingImpl.java:111)
at com.google.inject.ProviderToInternalFactoryAdapter$1.call
(ProviderToInternalFactoryAdapter.java:45)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:
811)
at com.google.inject.ProviderToInternalFactoryAdapter.get
(ProviderToInternalFactoryAdapter.java:42)
at com.google.inject.Scopes$1$1.get(Scopes.java:54)
at com.google.inject.InternalFactoryToProviderAdapter.get
(InternalFactoryToProviderAdapter.java:48)
at com.google.inject.InjectorBuilder$1.call(InjectorBuilder.java:200)
at com.google.inject.InjectorBuilder$1.call(InjectorBuilder.java:194)
at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:
804)
at com.google.inject.InjectorBuilder.loadEagerSingletons
(InjectorBuilder.java:194)
at com.google.inject.InjectorBuilder.injectDynamically
(InjectorBuilder.java:176)
... 5 more
*****************************************************************************************8

I have it set up as such:

in my Guice Abstract module i have:

bind(Configuration.class).toInstance(new AnnotationConfiguration
().addResource("hibernate.cfg.xml"));
bind(MyInitializer.class).asEagerSingleton();

My main method:

public static void main(String[] args)
{
Injector injector = Guice.createInjector(new LoginModule(),
PersistenceService

.usingHibernate()

.across(UnitOfWork.REQUEST)

.buildModule());
}

I dont actually do anything with it yet. Im just before that stage. On
top of this error, Im not exactly how to access the hibernate orm. So,
after I get this error fixed, I will have to determine how to access
my hibernate DAO's (not jpa), but first things first.

I have my current_session_context_class set to managed
and i dont have hibernate.transaction.factory_class set.

I used the MyTransactional class on warp persist website.

public class MyInitializer {

@Inject MyInitializer(PersistenceService service)
{
service.start();
}
}

Can anyone please help me with my problem?
Id be ever so grateful.

Sincerely, your friend,

Coder420


Dhanji R. Prasanna

unread,
Jan 2, 2010, 11:55:16 PM1/2/10
to warp...@googlegroups.com
Hi,

you need to set up hibernate properties, telling it what kind of database to use (mysql, etc.). This is usually done by binding a Configuration object. See the guide for the hibernate module here:


It also contains examples on how to access and use the Hibernate database session.

Dhanji.



--

You received this message because you are subscribed to the Google Groups "warp-core" group.
To post to this group, send email to warp...@googlegroups.com.
To unsubscribe from this group, send email to warp-core+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/warp-core?hl=en.



Same dude

unread,
Jan 3, 2010, 10:07:13 PM1/3/10
to warp-core
The problem was that it was looking for annotated properties, in the
form of a hibernate.properties file. I added that and put my config
info in there and that particular problem was fixed.
thanks,

Coder420

On Jan 2, 8:55 pm, "Dhanji R. Prasanna" <dha...@gmail.com> wrote:
> Hi,
>
> you need to set up hibernate properties, telling it what kind of database to
> use (mysql, etc.). This is usually done by binding a Configuration object.
> See the guide for the hibernate module here:
>
> http://www.wideplay.com
>
> It also contains examples on how to access and use the Hibernate database
> session.
>
> Dhanji.
>

> > warp-core+...@googlegroups.com<warp-core%2Bunsu...@googlegroups.com>

Reply all
Reply to author
Forward
0 new messages