Project setup that allows working with both hosted mode and web mode side by side?

5 views
Skip to first unread message

rintcius

unread,
Jul 22, 2009, 8:50:29 AM7/22/09
to Google Web Toolkit
Hi,
I am looking for a project setup that allows me to work easily with
both hosted mode and web mode (including RPC).
I am getting the exception below, whenever I start up hosted mode
after I have started it in web mode (i.e. war/<myModule> directory
contains the compiled code for web mode). If I am starting hosted mode
on a clean war/<myModule> directory then it works ok.

To workaround it I thought to add a specific module for hosted mode
like this:
<module rename-to='myModuleHosted'>
<inherits name='my.company.gwt.MyModule'/>
<set-property name="user.agent" value="gecko" />
<set-property name="locale" value="default" />
</module>
And then start up this from the shell (with args: -startupUrl
MyModuleHosted.html
my.company.gwt.MyModuleHosted). This works well as long as I dont do
any RPC calls.

RPC calls however fail since they try to address myModuleHosted/
myServicePath whereas the service is still available under myModule/
myServicePath.

Any ideas to get the service available as myModuleHosted/myServicePath
instead?
Or any other ideas for a setup?

Thanks, Rintcius


[ERROR] Error while executing the JavaScript provider for property
'user.agent'
java.lang.RuntimeException: Failed to invoke native method:
__gwt_getProperty with 1 arguments.
at com.google.gwt.dev.shell.moz.LowLevelMoz.invoke(LowLevelMoz.java:
134)
at com.google.gwt.dev.shell.moz.ModuleSpaceMoz.doInvoke
(ModuleSpaceMoz.java:99)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
453)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject
(ModuleSpace.java:231)
at
com.google.gwt.dev.shell.ModuleSpacePropertyOracle.computePropertyValue
(ModuleSpacePropertyOracle.java:108)
at com.google.gwt.dev.shell.ModuleSpacePropertyOracle.getPropertyValue
(ModuleSpacePropertyOracle.java:65)
at com.google.gwt.dev.cfg.ConditionWhenPropertyIs.doEval
(ConditionWhenPropertyIs.java:48)
at com.google.gwt.dev.cfg.Condition.isTrue(Condition.java:36)
at com.google.gwt.dev.cfg.ConditionAll.doEval(ConditionAll.java:37)
at com.google.gwt.dev.cfg.Condition.isTrue(Condition.java:36)
at com.google.gwt.dev.cfg.Rule.isApplicable(Rule.java:35)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind
(StandardRebindOracle.java:103)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind
(StandardRebindOracle.java:62)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind
(StandardRebindOracle.java:172)
at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind
(ShellModuleSpaceHost.java:114)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:474)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate
(ModuleSpace.java:365)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:
39)
at com.google.gwt.core.client.GWT.create(GWT.java:91)
at com.google.gwt.user.client.DOM.<clinit>(DOM.java:35)
at com.google.gwt.user.client.ui.SimplePanel.<init>(SimplePanel.java:
35)

JonJ27

unread,
Jul 22, 2009, 9:31:38 AM7/22/09
to Google Web Toolkit
Hi Rintcius

What IDE are you using and what is your J2EE contianer?

I managed to use the -noserver -startupURL options...
This allowed me to get my back end (services) debuggable on my servlet
container (in this case websphere, which had already been started) and
the front end in hosted mode.

RPC works fine in this set up.

Jonathan

Juraj Vitko

unread,
Jul 23, 2009, 10:15:57 AM7/23/09
to Google Web Toolkit
just a blind shot - try to define an additional servlet-mapping for
your service servlet in your web.xml file.

rintcius

unread,
Jul 25, 2009, 7:42:52 AM7/25/09
to Google Web Toolkit
Hi Jon and Juraj,

Thanks for your suggestions.

@Jon
I am using eclipse and jetty. Can you also use the front end in web
mode apart from hosted mode? I am getting the same exception when I
try with the -noserver option.
The reason I would like web mode is because of Firebug so I can see
what's actually going on in the browser (and tweak the css for
example). BTW Out of Process Hosted Mode http://code.google.com/p/google-web-toolkit/wiki/DesignOOPHM
will probably solve the problem for me.

@Juraj
Yes, that looks like the easiest workaround.

Backtracking to the root of the problem:
I am still interested in a solution i.s.o. a workaround. I mean,
shouldn't web mode and hosted mode be working side by side out of the
box?
I am also wondering why my problem is not occurring more often (found
just 1 thread with a similar error but this was with the -noserver
option http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/aa3a8d942e493c26).
I would guess the use case of using hosted mode and web mode side by
side is pretty common. Maybe there's something particular about my
project setup although I can't think of anything except maybe that I
am using linux/ubuntu iso windows.

Rintcius

Juraj Vitko

unread,
Jul 26, 2009, 9:03:35 AM7/26/09
to Google Web Toolkit
I don't know if this is the same problem, but I have to define my
service as (for example):


MyService.java:

@RemoteServiceRelativePath("rpc")
public interface MyService extends RemoteService { }

web.xml:

<servlet>
<servlet-name>rpc</servlet-name>
<servlet-class>mypackage.Myservice</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>rpc</servlet-name>
<url-pattern>/rpc</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>rpc</servlet-name>
<url-pattern>/myapplication/rpc</url-pattern>
</servlet-mapping>


Without any of the above, it either doesn't work in Hosted mode, or in
Web mode.
I'm on Linux too.

J.



On Jul 25, 1:42 pm, rintcius <rintc...@gmail.com> wrote:
> Hi Jon and Juraj,
>
> Thanks for your suggestions.
>
> @Jon
> I am using eclipse and jetty. Can you also use the front end in web
> mode apart from hosted mode? I am getting the same exception when I
> try with the -noserver option.
> The reason I would like web mode is because of Firebug so I can see
> what's actually going on in the browser (and tweak the css for
> example). BTW Out of Process Hosted Modehttp://code.google.com/p/google-web-toolkit/wiki/DesignOOPHM
> will probably solve the problem for me.
>
> @Juraj
> Yes, that looks like the easiest workaround.
>
> Backtracking to the root of the problem:
> I am still interested in a solution i.s.o. a workaround. I mean,
> shouldn't web mode and hosted mode be working side by side out of the
> box?
> I am also wondering why my problem is not occurring more often (found
> just 1 thread with a similar error but this was with the -noserver
> optionhttp://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...).

rintcius

unread,
Jul 29, 2009, 2:54:32 PM7/29/09
to Google Web Toolkit
I solved the issue. This happened because I am using a different
module for development to speed up compilation in web mode. Something
like this:
<module rename-to='myModule'>
<inherits name='my.company.gwt.MyModule'/>
<set-property name="user.agent" value="gecko" />
<set-property name="locale" value="default" />
</module>

The problem was that in hosted mode I was still using the original
module which lead to the exception I mentioned in the first post of
this thread. Once I started hosted mode with this development module
i.s.o. the original module the problem was resolved and I can now
happily run hosted mode and web mode side by side.

Rintcius
Reply all
Reply to author
Forward
0 new messages