I tried the following packaging with a single web-app and the 2
contexts as subcontexts underneath:
/war
|-/context1 (gwt module, inherits "service" module)
|-/context2 (gwt module, inherits "service" module)
|-/WEB-INF
|-/classes (contains the rpc servlet classes)
|-/lib (gwt-servlet.jar, dao lib with hibernate)
|-web.xml (definition of rpc servlet and its mapping to /
context3)
Seems to work ok until now, both gwt modules instantiate their own
ServiceDefTarget to /context3 and can call the same rpc interface.
On Apr 15, 1:44 pm, gregor <[email protected]> wrote:
> I would be careful about multiple Hibernate session factories etc. You
> may be able to get away with it, but there are potential problems that
> might be difficult to trace. I would do some research into your
> options as they relate to your particular use case. Two main ways to
> deal with this are:
>
> 1. configure data source as JNDI lookup. That works with servlet
> container only, e.g. Tomcat, Jetty. I'm pretty sure Spring provides
> ways to do this in conjunction with Hibernate for example.
> 2. deploy as an EAR that houses both web apps (as WARs) and a common
> data access/transaction management tier (as a JAR). You might delegate
> the server side work and data access from your RPC servlets to a
> session EJB for example. You will need to use a full blown Java EE app
> server like JBoss for this of course, and run GWT hosted mode with -
> noserver option etc.
>
> On Apr 15, 8:38 am, jfeid <[email protected]> wrote:
>
> > Thanks for the reply.
>
> > The RPC servlet uses a db layer jar which configures a Hibernate
> > factory.
> > Because of different classloaders I assume that there will be 2
> > instances of this factory.
> > But I cannot say if this will present an issue until I test it.
>
> > On Apr 14, 9:23 pm, gregor <[email protected]> wrote:
>
> > > You can do this if you place your RPC services in a separate module
> > > that is inherited by the two main application modules. In this
> > > situation you can specify the RPC servlets in the common module
> > > gwt.xml file and this will work for hosted mode, but I think you have
> > > to map them separately (i.e. in duplicate) in each main module's
> > > web.xml for deployment - AFAIK there is no way around that (app server/
> > > servlet specification issue, not GWT).
>
> > > At run time you will end up with two instances of each servlet loaded
> > > by the two main module's classloaders (again app server/servlet
> > > specification issue, not GWT) which may or may not present you with an
> > > issue depending on what you are doing.
>
> > > On Apr 14, 4:14 pm, jfeid <[email protected]> wrote:
>
> > > > Hello,
>
> > > > I have the following problem that puzzles me.
>
> > > > Suppose I have 2 different GWT applications running on different
> > > > contexts:
> > > > -http://server/context1
> > > > -http://server/context2
>
> > > > Is there a way to share an RPC service between them?
>
> > > > Thank you.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---