Reputation: 1060
Im currently working on a JPA Jersey Servlet and Im trying to use Guice for dependency injection. The Problem is, that I get the following error:
Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: com.google.inject.CreationException: Guice creation errors:
1) null returned by binding at com.google.inject.persist.jpa.JpaPersistModule.configurePersistence(JpaPersistModule.java:63)
but parameter 1 of com.google.inject.persist.jpa.JpaPersistService.<init>() is not @Nullable
while locating java.util.Properties annotated with @com.google.inject.persist.jpa.Jpa()
for parameter 1 at com.google.inject.persist.jpa.JpaPersistService.<init>(JpaPersistService.java:43)
at com.google.inject.persist.jpa.JpaPersistModule.configurePersistence(JpaPersistModule.java:67)
while locating com.google.inject.persist.jpa.JpaPersistService
for field at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.emProvider(JpaLocalTxnInterceptor.java:33)
at com.google.inject.persist.jpa.JpaPersistModule.configurePersistence(JpaPersistModule.java:76)
2) null returned by binding at com.google.inject.persist.jpa.JpaPersistModule.configurePersistence(JpaPersistModule.java:63)
but parameter 1 of com.google.inject.persist.jpa.JpaPersistService.<init>() is not @Nullable
while locating java.util.Properties annotated with @com.google.inject.persist.jpa.Jpa()
for parameter 1 at com.google.inject.persist.jpa.JpaPersistService.<init>(JpaPersistService.java:43)
at com.google.inject.persist.jpa.JpaPersistModule.configurePersistence(JpaPersistModule.java:67)
while locating com.google.inject.persist.jpa.JpaPersistService
while locating com.google.inject.persist.UnitOfWork
for field at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.unitOfWork(JpaLocalTxnInterceptor.java:36)
at com.google.inject.persist.jpa.JpaPersistModule.configurePersistence(JpaPersistModule.java:76)
2 errors
The code that i generating this error is:
install(new JpaPersistModule("theseen"));
filter("/*").through(PersistFilter.class);
If I use the "standard" way by instantiating a EntitiManager and uncommenting these lines, nothing happens.
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("theseen");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
em.merge(s);
em.getTransaction().commit();
works like a charm. So I think the setup if the database connection must be ok.
What could these to errors possibly be? I tested the same App on another test environment and it works! Both machines use Glassfish 3.1, Eclipse Indigo with m2eclipse and m2wtp integration. I use Guice 3.0 with guice-persist 3.0 and guice-servlet 3.0. The machine where the app is working runs Ubuntu 11.04 with OpenJDK, the machine where problems occure uses Windows 7 with JDK1.6v26. I normally use a Datasource provided by Glassfish, but even using a plain persistence.xml is not working.
I am seriously confused... Any ideas what is wrong with Guice Injection for JPA?
Upvotes: 1
Views: 2147
Reputation: 1060
Since nobody answered I went brute force:
Completely reinstall Glassfish and the WebApp worked...
Something must have been corrupted during the long months of testing here on my local machine.
Upvotes: 2