Binding to PersistenceService not bound

0 views
Skip to first unread message

艾文哲.贝维斯

unread,
Mar 17, 2008, 1:48:43 AM3/17/08
to warp-core
God
my warp framework still not complete

com.google.inject.CreationException: Guice configuration errors:

1) Error at com.asu.cmoney.init.AppServiceModule
$Initializer.<init>(AppServiceModule.java:28):
Binding to com.wideplay.warp.persist.PersistenceService not found. No
bindings to that type were found.


public class AppServiceModule extends AbstractModule {
private final Log logger = LogFactory.getLog(getClass());

protected void configure() {
bind(Configuration.class).toInstance(
new AnnotationConfiguration().addResource("hbm.cfg.xml"));
bind(Initializer.class).asEagerSingleton();

}

@Singleton
public class Initializer {
@Inject
Initializer(com.wideplay.warp.persist.PersistenceService service) {
logger.info("Starting Persistence Service");
service.start();
}
}
}


-------------------------

ublic class WarpHibernateContextListener {
private static Injector injector;
private final Log logger = LogFactory.getLog(getClass());

public void contextInitialized(ServletContextEvent
servletContextEvent) {
injector = Guice.createInjector(new AppServiceModule(),

PersistenceService.usingHibernate().across(UnitOfWork.REQUEST)// .addAccessor(UserAccessor.class)
.buildModule());
}
}

Dhanji R. Prasanna

unread,
Mar 17, 2008, 3:07:51 AM3/17/08
to warp...@googlegroups.com
This is the same problem as before--it looks like you are not creating the warp-persist module. Or you are creating 2 *different* injectors. 

Can you test to make sure the warp-persist module is actually being created? And that they are both part of the same injector? I could have sworn the struts2 plugin does not allow you to install your own modules...

Robbie knows more about this--are you watching this list, Robbie?

Josh McDonald

unread,
Mar 17, 2008, 3:20:43 AM3/17/08
to warp...@googlegroups.com
Don't you need some slightly customised Struts 2.1 from the guice gcode site?

-J
--
"Therefore, send not to know For whom the bell tolls, It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: jo...@gfunk007.com

jeromy

unread,
Mar 17, 2008, 3:32:42 AM3/17/08
to warp-core


On Mar 17, 6:20 pm, "Josh McDonald" <j...@gfunk007.com> wrote:
> Don't you need some slightly customised Struts 2.1 from the guice gcode
> site?
>

I recently moved an existing Struts2 app from my own JPA
implementation to warp-persist without any such problems. The
customized setup for guice is required only when users tinker with the
default XWork converter's as they need to be instantiated by the
ObjectFactory before the Struts2 Guice plugin is initialized.
Otherwise, there's only two issues for warp-persist users:
1. build the Guice plugin from source, as the 1.0.1 jar distribution
version doesn't allow custom modules
2. in your module, call
install(PersistenceService.usingJpa().across(UnitOfWork.TRANSACTION).buildModule());

The user can of course choose to use the Warp-servlet instead for
session in view semantics, or a custom context listener, which is the
path the OP appears to be attempting.

Migrating from my own threadlocal EntityManagerProvider to warp-
persist has been extremely satisfying.

Dhanji R. Prasanna

unread,
Mar 17, 2008, 8:01:50 AM3/17/08
to warp...@googlegroups.com
On Mon, Mar 17, 2008 at 6:32 PM, jeromy <jerom...@gmail.com> wrote:

 1. build the Guice plugin from source, as the 1.0.1 jar distribution
version doesn't allow custom modules

This is what I figured was happening...
 

Migrating from my own threadlocal EntityManagerProvider to warp-
persist has been extremely satisfying.
 
Sounds great! Thanks for sharing =)

Dhanji.

Robbie Vanbrabant

unread,
Mar 17, 2008, 9:31:45 AM3/17/08
to warp...@googlegroups.com
1.0.1 does support custom modules, IIRC. You shouldn't need to build from source.

Robbie

jeromy

unread,
Mar 17, 2008, 6:47:59 PM3/17/08
to warp-core


On Mar 18, 12:31 am, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
wrote:
> 1.0.1 does support custom modules, IIRC. You shouldn't need to build from
> source.

Sorry, confirmed. The 1.0.1 plugin supports a custom module.
Reply all
Reply to author
Forward
0 new messages