tomcat deployable user jar?

98 views
Skip to first unread message

John Watson

unread,
May 18, 2006, 1:30:00 AM5/18/06
to Google Web Toolkit
The jars as distributed are not "legal" to deploy into tomcat, as they
contain the javax.servlet packages. These can't end up in WEB-INF/lib,
since that violates the servlet spec (tomcat refuses to load the jars).
I have built my own custom version of the user jar that is deployable
into tomcat, but it seems like it would be good to a) document this
issue and b) distribute a version of the jar which doesn't include the
servlet classes in it.

Just thought I'd mention it.

Thanks,
John

Chiraz

unread,
May 18, 2006, 1:50:02 AM5/18/06
to Google Web Toolkit
Thanks,

I just suffered from the same issue and this solved it.

I agree that there should at least be a paragraph written in the
documentation on how to deploy a simple GWT app on at least a Tomcat
server (for testing).

Only thing to solve in my case now is that client side does not make
server-calls yet, but I'm not sure what may be causing this.

Cheers,

tahir akhtar

unread,
May 18, 2006, 4:46:46 AM5/18/06
to Google Web Toolkit
This is probably due to the server path issue. First the Entry point
must be set to a valid url. For example, calendar example
SchoolCalendarWidget may be modified to say

ServiceDefTarget target = (ServiceDefTarget) calService;
String staticResponseURL = GWT.getModuleBaseURL();
staticResponseURL += "/calendar";
target.setServiceEntryPoint(staticResponseURL);
and the servlet must be mapped to URL /calendar (or whatever you
specified in entry point) in web.xml.

Remember that the XXXServiceImpl class (e.g SchoolCalendarServiceImpl)
actually extends a Servlet class. So somthing like this will go in
web.xml

<servlet>
<servlet-name>SchoolCalendarService</servlet-name>
<servlet-class>com.google.gwt.sample.dynatable.server.SchoolCalendarServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>SchoolCalendarService</servlet-name>
<url-pattern>/calendar</url-pattern>
</servlet-mapping>

Well, thats the theory but I have to get it to work before I can say
with surety.

tahir akhtar

unread,
May 18, 2006, 5:02:00 AM5/18/06
to Google Web Toolkit
Well looking closely calendar service example gives you an option to
turn off static behaviour
change private final static boolean USE_STATIC_RPC_ANSWERS = true;
to private final static boolean USE_STATIC_RPC_ANSWERS = false;
in SchoolCalendarWidget
recompile the SchoolCalendarWidget into java class (not same as GWT
Compile which emits the javascript etc)
Deploy the servlet as I mentioned in previous post and test

tahir akhtar

unread,
May 18, 2006, 6:39:02 AM5/18/06
to Google Web Toolkit
OK got it running on Tomcat. Here are the steps

1. Strip the javax.* packages from gwt-user.jar . You can do it with
winzip/winrar etc. Open the jar in such tools and delete all files in
javax folder including the folder

2. Copy the stripped jar in your webapps/YourApp/WEB-INF/lib. Copy the
compiled classes (e.g copy the folder "com" in samples/dynatable/bin )
to webapps/YourApp/WEB-INF/classes

3. Modify your Service Entry point code (if required). Note the text
you put in place /calendar line. You will use this text in web.xml
later


ServiceDefTarget target = (ServiceDefTarget) calService;
String staticResponseURL = GWT.getModuleBaseURL();

staticResponseURL += "/YourApp/calendar";
target.setServiceEntryPoint(staticResponseURL);
4. Run DynaTable-compile.cmd (replace dynatable with app name). File
will be generated in www\com.google.gwt.sample.dynatable.DynaTable\ .
Copy all files within this folder to webapps/YourApp/

5. Create modify web.xml and place it in WEB-INF
<?xml version="1.0" encoding="UTF-8"?>
<web-app>

<servlet>
<servlet-name>SchoolCalendarService</servlet-name>

<servlet-class>com.google.gwt.sample.dynatable.server.SchoolCalendarServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>SchoolCalendarService</servlet-name>
<url-pattern>/calendar</url-pattern>
</servlet-mapping>

</web-app>
5. Launch tomcat. Open browser e.g.
localhost:8080/YourApp/DynaTable.html
6. Enjoy

Burning Iez

unread,
May 18, 2006, 10:08:36 AM5/18/06
to Google Web Toolkit
Hi,

I followed you step by step and successfully configured my web app.
This is great.

Thanks. :)

Tahir Akhtar

unread,
May 18, 2006, 11:00:56 AM5/18/06
to Google-We...@googlegroups.com
We aim to please !
:)
Wassalam

rob_cranfill

unread,
May 18, 2006, 11:28:55 AM5/18/06
to Google Web Toolkit
I'm trying to do the same, no joy. Here are my notes:


= Create folders:
{tomcat}\webapps\DynaTable
{tomcat}\webapps\DynaTable\WEB-INF
{tomcat}\webapps\DynaTable\WEB-INF\lib
{tomcat}\webapps\DynaTable\WEB-INF\classes


= Copy contents of
gwt-windows-1.0.20\samples\DynaTable\www\com.google.gwt.sample.dynatable.DynaTable
to
{tomcat}\webapps\DynaTable


= Copy
gwt-user-minus-javax.jar
to
{tomcat}\webapps\DynaTable\WEB-INF\lib


= Copy
gwt-windows-1.0.20\samples\DynaTable\bin\com
to
{tomcat}\webapps\DynaTable\WEB-INF\classes
(creating {tomcat}\webapps\DynaTable\WEB-INF\classes\com\google\{etc})


- Test #1: browse http://localhost:8080/DynaTable/

HTTP Status 404 - /DynaTable/
type Status report
message /DynaTable/
description The requested resource (/DynaTable/) is not available.


= Copy
D:\dev\gwt-windows-1.0.20\samples\DynaTable\tomcat\webapps\ROOT\WEB-INF\web.xml
to
{tomcat}\webapps\DynaTable\WEB-INF\


? Test #2: browse http://localhost:8080/DynaTable/

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class
com.google.gwt.dev.shell.GWTShellServlet or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)


= Create and copy
gwt-dev-windows-minus-javax-servlet.jar
to
{tomcat}\webapps\DynaTable\WEB-INF\lib


? Test #3: browse http://localhost:8080/DynaTable/

Browser:
"To launch an an application, specify a URL of the form
/module/file.html"
Tomcat console:
(nothing)


- Test #4: (browse http://localhost:8080/DynaTable/DynaTable.html)

Browser:
"Unable to find/load module 'DynaTable.html' (see server log for
details)"

Tomcat console:
- #0 The server received a request to generate a host page for module
'DynaTable.html'
- #0.0 Loading module 'DynaTable.html'
- #0.0.0 Unable to find 'DynaTable/html.gwt.xml' on your classpath;
could be a typo, or maybe you forgot to include a classpath entry for
source?


--- FYI, here's console output from a typical startup of Tomcat:
- The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java
.library.path:
D:\dev\Tomcat5.5\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\
Wbem;D:\dev\jwsdp20\jwsdp-shared\bin;c:\mobius\Mobius-1.8.0\bin;C:\bin;D:\dev\bin;D:\dev\cygwin\bin;D:\dev\jdk5\bin;C:\P
rogram Files\SecureCRT;C:\Program
Files\SecureFX;D:\dev\Subversion\bin;D:\dev\MinGW\bin
- Initializing Coyote HTTP/1.1 on http-8080
- Initialization processed in 771 ms
- Starting service Catalina
- Starting Servlet Engine: Apache Tomcat/5.5.16
- XML validation disabled
- org.apache.webapp.balancer.BalancerFilter: init(): ruleChain:
[org.apache.webapp.balancer.RuleChain: [org.apache.webap
p.balancer.rules.URLStringMatchRule: Target string: News / Redirect
URL: http://www.cnn.com], [org.apache.webapp.balance
r.rules.RequestParameterRule: Target param name: paramName / Target
param value: paramValue / Redirect URL: http://www.y
ahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule:
Redirect URL: http://jakarta.apache.org]]
- Starting Coyote HTTP/1.1 on http-8080
- JK: ajp13 listening on /0.0.0.0:8009
- Jk running ID=0 time=0/30 config=null
- Find registry server-registry.xml at classpath resource
- Server startup in 3555 ms

Thanks for any help or ideas!
- rob

rob_cranfill

unread,
May 18, 2006, 11:30:50 AM5/18/06
to Google Web Toolkit
Oh, and by the way, notice that I found it necessary to add a
stripped-down (no javax.servlet.*) version of gwt-dev-windows.jar,
because of that

javax.servlet.ServletException: Wrapper cannot find servlet class
com.google.gwt.dev.shell.GWTShellServlet or a class it depends on

exception.

- rob

tahir akhtar

unread,
May 18, 2006, 12:03:02 PM5/18/06
to Google Web Toolkit
This step is wrong:
= Copy

D:\dev\gwt-windows-1.0.20\samples\DynaTable\tomcat\webapps\ROOT\WEB-INF\web.xml
to
{tomcat}\webapps\DynaTable\WEB-INF\

Try creating a new web.xml with contents i provided in my previous
post.
Following is also *not* needed


= Create and copy
gwt-dev-windows-minus-javax-servlet.jar
to
{tomcat}\webapps\DynaTable\WEB-INF\lib

Test: http://localhost:8080/DynaTable/DynaTable.html

tahir akhtar

unread,
May 18, 2006, 12:04:10 PM5/18/06
to Google Web Toolkit
That error is due to wrong web.xml. Use the above web.xml and it will
go away.

rob_cranfill

unread,
May 18, 2006, 1:45:50 PM5/18/06
to Google Web Toolkit
You are right on both counts, of course! That fixes it - I'm running
DynaTable under Tomcat 5.5.16!!

Thanks, now I'm off to try coding my own first app.... :)

- rob

Tahir Akhtar

unread,
May 18, 2006, 4:32:43 PM5/18/06
to Google-We...@googlegroups.com
You are welcome :)

Dave Patterson

unread,
May 19, 2006, 4:33:42 AM5/19/06
to Google Web Toolkit
Out of interest, why would you want to deploy the GWT jars on Tomcat?

Aren't all the generated products are hot-deployable?

Tahir Akhtar

unread,
May 19, 2006, 4:42:58 AM5/19/06
to Google-We...@googlegroups.com
Not sure what you mean by hot-deployable. What I (and other folks on this thread) wanted to do was: Let a GWT app make rpc calls to our servlets deployed on a tomcat instance.

Agreed that GWT uses Tomcat itself in shell mode, but for a different purpose IMO. It deploys a standard GWT shell servlet that serves you your pages generated from java source in Shell browser. You can get a better understanding of this by looking at the web.xml within tomcat folder inside of GWT app folder.

I will post back after I have completely figured out the process :).

Dave Patterson

unread,
May 19, 2006, 5:07:00 AM5/19/06
to Google Web Toolkit
Hi Tahir,

Are you trying to test your RPC calls in hosted mode (running the
GWTShell)? If so, do you need really Tomcat to launch GWTShell?

If you are trying to test the compiled code in an ordinary browser then
you should be able to run the compile outside tomcat and copy (or 'hot
deploy') the generated files into your web-app's root directory.

Dave P.

Tahir Akhtar

unread,
May 19, 2006, 5:50:23 AM5/19/06
to Google-We...@googlegroups.com
Yes I would like to do that: test my RPC calls in hosted mode (running the
GWTShell), but
* I figure that I wont be able do that with a separate tomcat instance as there is no straight-forward way IF hosted mode browser honours the usual browser security pertaining to cross domain calls. I haven't tried that yet.
* Another way is to tweak the generated web.xml. I hope it won't be rocket science but got no time at my hand at the moment to give it a try.

Currently doing the rpc test in separate browser. Yes the copy to tomcat works and we discussed in this thread what to copy where within the tomcat. But you still need to come up with servlet mappings in web.xml. We discussed that too.

Hope that helps
Regards
Tahir Akhtar


On 5/19/06, Dave Patterson <davp...@hotmail.com> wrote:

Dave Patterson

unread,
May 19, 2006, 7:13:53 AM5/19/06
to Google Web Toolkit
<penny drops>
Now I get it - The example servlets depend on the server.rpc package in
the gwt-user.jar.
</penny drops>

Sounds like the server-side RPC code is a candidate for a seperate
deployable JAR as per your stripped copy.

Sorry for being so slow :(

Dave P.

Tahir Akhtar

unread,
May 19, 2006, 11:04:58 AM5/19/06
to Google-We...@googlegroups.com
Acutally the whole rpc mechanism provided by GWT depends on server.rpc package in
the gwt-user.jar.

You *must* use it if you do not want to write custom method for rpc. If you want to use something else, JSON could be an option as it has support for most platforms/langs like ASP, PHP etc.

Tahir Akhtar

unread,
May 19, 2006, 12:42:11 PM5/19/06
to Google-We...@googlegroups.com
Well, finally found what I was missing from the beginning: Testing rpc services from withing the GWTShell

We can add servlet declarations (think of it as definition + url mapping in one line) in app.gwt.xml. And the embedded tomcat in shell will load and map the servlet at the specified url.

So we will only have to do all the tomcat deployment stuff just for final testing.


The servlet is already mapped for DynaTable example, see

--DynaTable.gwt.xml
<module>
    <inherits name=' com.google.gwt.user.User'/>
    <entry-point class='com.google.gwt.sample.dynatable.client.DynaTable'/>
    <servlet path='/calendar' class='com.google.gwt.sample.dynatable.server.SchoolCalendarServiceImpl '/>
</module>
All you have to do is to enable the calls in SchoolCalendarWidget

  private final static boolean USE_STATIC_RPC_ANSWERS = false;
And ensure that entry point is set according to above mapping
public CalendarProvider()
...
target.setServiceEntryPoint("/calendar");

See docs for more details

Manu

unread,
May 20, 2006, 12:48:02 AM5/20/06
to Google Web Toolkit
Hi Tahir,

I did the same way you mention to invoke the RPC. I can't able to
polulate the table in DynaTable.html.


Failed to access data: <html><head><title>Apache Tomcat/5.0.28 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head><body><h1>HTTP Status 404 -
/samples/DynaTable/samples/calendar</h1><HR size="1"
noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>
<u>/samples/DynaTable/samples/calendar</u></p><p><b>description</b>
<u>The requested resource (/samples/DynaTable/samples/calendar) is not
available.</u></p><HR size="1" noshade="noshade"><h3>Apache
Tomcat/5.0.28</h3></body></html>

I think i am unable to get data from the server
SchoolCalendarServiceImpl.java.

one more issue. When i tried to call "DynaTable-compile.cmd", it is not
creating classes in bin folder. So i think i have to compile
SchoolCalendarServiceImpl.java separately and copy to WEB-INF/classes

I have a suggestion to you. Can you do a HelloWorld sample RPC program
with step by step. It will help all the developers to begin this GWT
use. I will really appreciate if you can do that for all developers.

> ------=_Part_36005_26966217.1148056931395
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 1204
>
> Well, finally found what I was missing from the beginning: Testing rpc services from withing the GWTShell<br><br>We can add servlet declarations (think of it as definition + url mapping in one line) in app.gwt.xml. And the embedded tomcat in shell will load and map the servlet at the specified url.
> <br><br>So we will only have to do all the tomcat deployment stuff just for final testing.<br><br><br>The servlet is already mapped for DynaTable example, see<br><br>--DynaTable.gwt.xml<br>&lt;module&gt;<br>&nbsp;&nbsp;&nbsp; &lt;inherits name='
> com.google.gwt.user.User'/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;entry-point class='com.google.gwt.sample.dynatable.client.DynaTable'/&gt;<br>&nbsp;&nbsp;&nbsp; &lt;servlet path='/calendar' class='com.google.gwt.sample.dynatable.server.SchoolCalendarServiceImpl
> '/&gt;<br>&lt;/module&gt;<br>All you have to do is to enable the calls in SchoolCalendarWidget<br>&nbsp; private final static boolean USE_STATIC_RPC_ANSWERS = false;<br>And ensure that entry point is set according to above mapping
> <br>public CalendarProvider()<br>...<br>target.setServiceEntryPoint(&quot;/calendar&quot;);<br><br>See docs for more details<br><br>
>
> ------=_Part_36005_26966217.1148056931395--

tahir akhtar

unread,
May 20, 2006, 7:54:28 AM5/20/06
to Google Web Toolkit
Hi Manu,
You have hit the common confusion point :) Welcome to the club.

Actually the compile.cmd is *not* for compiling java to byte code.
Instead it translates java *source code* to javascript.

Whenever you change a java file that is supposed to be translated to
java script *and* you want to view it in normal browser you must use
the compile.cmd and then open the generated html from www folder.

But if you have changed some server side stuff like service impl then
you may have to recompile the to java .class using javac. (I suspect
that GWT have some built in way to trigger javac compile when you
launch shell mode, but I have to confirm that)

Now back to your original issue, the RPC call.

The error you are getting means that the servlet is not mapped to
/samples/DynaTable/samples/calendar but your translated javascript is
trying to find it at this location.
You can fix either the servlet mapping or change the entry point like
target.setServiceEntryPoint("whereever/the/servlet/is/mapped");

For the Hello World program you have suggested, I would try to do a
write-up on running the Calendar example (If I get the weekend off :(
) .
I think for learning purpose, it is better to stick with the
App.gwt.xml method coupled with shell mode.

Regards
Tahir Akhtar

Manu

unread,
May 20, 2006, 3:38:04 PM5/20/06
to Google Web Toolkit
Tahir,

I really appreciate for your fast response. I changed the mapping for
the servlet and able to resolve the issue happened last time. But still
getting message failed to access data.
Rest of the classes are same with no change.


I have copied DynaTable to
C:\appl\Tomcat 5.0\webapps\samples\DynaTable\

My Web.xml have
<servlet>
<servlet-name>SchoolCalendarService</servlet-name>

<servlet-class>com.google.gwt.sample.dynatable.server.SchoolCalendarService­Impl</servlet-class>

</servlet>
<servlet-mapping>
<servlet-name>SchoolCalendarService</servlet-name>

<url-pattern>/DynaTable/calendar</url-pattern>
</servlet-mapping>

I have copied the server and client classes to
C:\appl\Tomcat 5.0\webapps\samples\DynaTable\WEB-INF\classes\

I have changed SchoolCalendarWidget.java

if (USE_STATIC_RPC_ANSWERS) {

/* Org Implementation */

//ServiceDefTarget target = (ServiceDefTarget) calService;
//String staticResponseURL = GWT.getModuleBaseURL();
//staticResponseURL += "/calendar" + startRow + ".txt";
//target.setServiceEntryPoint(staticResponseURL);

ServiceDefTarget target = (ServiceDefTarget) calService;
String staticResponseURL = GWT.getModuleBaseURL();

staticResponseURL += "/calendar";
target.setServiceEntryPoint(staticResponseURL);
}
************************************************************************************************************************************
But still calService.getPeople(), goes to onFailure() and i am getting
"Failed to access data" in Navbar. So i hope that i am able to get in
the server class, but the issue is because of data. Any idea about this
issue?

calService.getPeople(startRow, maxRows, new AsyncCallback() {
public void onFailure(Throwable caught) {
acceptor.failed(caught);
}

public void onSuccess(Object result) {
Person[] people = (Person[]) result;
lastStartRow = startRow;
lastMaxRows = maxRows;
lastPeople = people;
pushResults(acceptor, startRow, people);
}

});

Manu

unread,
May 20, 2006, 7:55:21 PM5/20/06
to Google Web Toolkit
Hi Tahir,
Sorry for the above wrong message. please ignore it. It happend coz of
some other directory issue.

1) I have copied DynaTable to


C:\appl\Tomcat 5.0\webapps\samples\DynaTable\


2) My Web.xml have
<servlet>
<servlet-name>SchoolCalendarService</servlet-name>

<servlet-class>com.google.gwt.sample.dynatable.server.SchoolCalendarService­­Impl</servlet-class>

</servlet>
<servlet-mapping>
<servlet-name>SchoolCalendarService</servlet-name>
<url-pattern>/DynaTable/calendar</url-pattern>
</servlet-mapping>


3) I have copied the server and client classes to


C:\appl\Tomcat 5.0\webapps\samples\DynaTable\WEB-INF\classes\

4) I have changed SchoolCalendarWidget.java to


ServiceDefTarget target = (ServiceDefTarget) calService;
String staticResponseURL = GWT.getModuleBaseURL();
staticResponseURL += "/calendar";
target.setServiceEntryPoint(staticResponseURL);

5) <Context path="/samples" docBase="samples" debug="0"
privileged="true"></Context>

I got the following error "HTTP Status 404 -
/samples/DynaTable/calendar"


Failed to access data: <html><head><title>Apache Tomcat/5.0.28 - Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
{color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head><body><h1>HTTP Status 404 -

/samples/DynaTable/DynaTable/calendar</h1><HR size="1"


noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b>

<u>/samples/DynaTable/DynaTable/calendar</u></p><p><b>description</b>
<u>The requested resource (/samples/DynaTable/DynaTable/calendar) is


not available.</u></p><HR size="1" noshade="noshade"><h3>Apache
Tomcat/5.0.28</h3></body></html>

Can you help me to figure out, what is wrong in the entire flow, why i
can't get the Server classes the web.xml

Manu

unread,
May 20, 2006, 10:07:57 PM5/20/06
to Google Web Toolkit
Hi Tahir,

Thanks for help.

I am able to solve the issue and able to launch the sample. I will try
to do a sample HelloWorld Service tomorrow, with all the steps to
follow. So others can use it to save time with for simple RPC.

-Binesh

Chiraz

unread,
May 22, 2006, 11:53:14 PM5/22/06
to Google Web Toolkit
I have been successful deploying to ROOT.war before on Tomcat, but
using an Ant script to build a deployable war file automatically was
more problematic. After 1hr. or so with 404's and service unavailable
messages, I finally got this to work.

I think when the app is tested, it always copies to ROOT.war, never to
a specific module directory, I think this is when the whole deployment
gets so terribly confusing for a real deploy.

I'm doing the following:

The "module.xml" needs to have the exact path as well, including the
app folder as it seems:

<module>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Specify the app entry point class. -->
<entry-point class='path.to.your.App'/>
<servlet path='/YourApp/customer'
class='path.to.your.CustomerServiceImpl'/>
</module>

Then the rest as has already been described in web.xml:

<servlet>
<servlet-name>CustomerService</servlet-name>
<servlet-class>path.to.your.CustomerServiceImpl</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>CustomerService</servlet-name>
<url-pattern>/customer</url-pattern> <!-- <-- in web.xml there is no
YourApp -->
</servlet-mapping>

The code in the data provider that goes off to the servlet:

ServiceDefTarget target = (ServiceDefTarget) customerService;
String url = GWT.getModuleBaseURL();
url += "/customer";
target.setServiceEntryPoint(url);

in build.xml for the ant, I am copying the contents of the generated
folder "www/path.to.your.app" into the root of the war file, so that
you do not have to access as "path.to.your.app/Main.html".

Then I'm copying the necessary libs to the WEB-INF/lib folder.
Including the modified gwt-user.jar (removing javax folder). Finally
deploying this on Tomcat should more or less work.

Of course, you could also consider to just copy the contents of various
generated classes directly to the tomcat installation on your computer
in ROOT.war, but that doesn't make your web application really
distributable...

Cheers,

Chiraz

Simon

unread,
May 24, 2006, 6:04:38 PM5/24/06
to Google Web Toolkit
That works nice (the app name should NOT be specified into the service
entry point URL into the servlet).

However that works when making the deployment on the tomcat server, but
it doesn't when executing the app into the eclipse-wtp plateform. In
that environment, the servlet don't answer back (the html page remains
empty, with only the title and no table).

Any idea about that bug ?

AlexCheng

unread,
May 25, 2006, 2:05:11 AM5/25/06
to Google Web Toolkit
Yeah! It really works.
Remember to remove the javax folder in gwt-user.jar, or Tomcat will not
load the jar package. So when you invoke the servlet, it will display a
stack trace including ClassNotFoundException.

LeoZ

unread,
May 25, 2006, 8:10:06 AM5/25/06
to Google Web Toolkit
can you please copy/paste these parts of your code, that's the best
example app you can give us (in no time =)... I'm new to java and got
as far as the error manu reported (The requested resource
(/DynaTable/DynaTable/calendar) is not
available)... so I just need to have the exact combination of paths in
each file... thank you!!!

Madox

unread,
May 28, 2006, 5:25:14 AM5/28/06
to Google Web Toolkit
Simon,
I had the same problem (development service entry points differs from
the one I set up in my Tomcat server).
I solved like this:

ServiceDefTarget target = (ServiceDefTarget) service;
String staticResponseURL = GWT.getModuleBaseURL();
if (GWT.isScript())
{
// I guess I'm running on my Tomcat server in web mode
staticResponseURL += "/myService";
} else {
// I have java bytecode, so I guess I'm running on
// Eclipse in Hosted (debug) mode
staticResponseURL = "/myApp/myService";
}
target.setServiceEntryPoint(staticResponseURL);

Simon

unread,
May 28, 2006, 1:08:47 PM5/28/06
to Google Web Toolkit
Thanks Madox for the tip, that works fine with that piece of code.

Anyway, the app name SHOULD be specified into the service
entry point URL into the servlet, just as Chiraz said above.

I still have a bug into Eclipse Web browser, no widgets are displayed,
while it is Ok in Firefox ...

neonguru

unread,
May 29, 2006, 1:24:06 AM5/29/06
to Google Web Toolkit
Awesome tahir, this works great! Wonder why google doesn't provide the
stripped jar and basic instructions?

Tahir Akhtar

unread,
May 29, 2006, 1:52:23 AM5/29/06
to Google-We...@googlegroups.com
Thanks :)
I think the google folks left this for the community to sort out ;)

 

dileeph

unread,
Jun 12, 2006, 6:57:49 PM6/12/06
to Google Web Toolkit
thankyou Tahir and Chiraz for your wonderful guidance. i was stuck for
two days trying to deploy an app i had created onto my wtp-eclipse
connected tomcat but was having no luck .. always the same onFailure
condition. tahir's solution didnt quite work out for me .. maybe b'coz
it was not one of the sample apps but an app of my own .. however it
showed me the path ..chiraz was more to the point and finally i got it
going ..three cheers to you guys!!

Tahir Akhtar

unread,
Jun 13, 2006, 1:56:08 AM6/13/06
to Google-We...@googlegroups.com
hurray!!! :)

mic

unread,
Jun 14, 2006, 2:41:55 AM6/14/06
to Google Web Toolkit
How would you handle this for an app that does not have a data provider
or any server side component, i.e. no servlets. How would one WAR the
desktop app (mail app) that is in the GWT samples ?

Tahir Akhtar

unread,
Jun 14, 2006, 4:36:30 AM6/14/06
to Google-We...@googlegroups.com
Just put the GWT generated html files in the war as you would put any other html. No need to put the gwt's jar in lib either. Just ensure that your generated html's can reference the gwt.js file (this won't be an issue if you simply paste all the generated files as is in a single folder)

Regards
Tahir Akhtar

mic

unread,
Jun 14, 2006, 10:53:28 PM6/14/06
to Google Web Toolkit
Thanks Tahir.

I am sending the Html through the servlet.

This is the error I get

XML tag name mismatch
http://localhost:8080/foo/gwt.js

Here is what I have

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println( "<head>");
out.println( "<meta name='gwt:module'
content='com.foo.Foo'>");
out.println( "<link rel='stylesheet' href='/foo/Mail.css'>");
out.println( "<title>Mail App</title>");
out.println( "</head>");
out.println("<body style='background-color: #EEEEEE'>");
out.println("<script language='javascript'
src='/foo/gwt.js'></script>");
out.println("</body>");
out.println("</html>");

mic

unread,
Jun 15, 2006, 1:29:06 AM6/15/06
to Google Web Toolkit
Never mind.. I got it ...

r-a-v-i

unread,
Jun 15, 2006, 11:09:05 AM6/15/06
to Google Web Toolkit
I just followed Tahir's steps that he gave in the beginning of this
listing and it works perfect .
My environment is :

JDK 1.5, Tomcat 5.5.17.

Thanks Tahir,

r-a-v-i

Tahir Akhtar

unread,
Jun 21, 2006, 3:11:30 AM6/21/06
to Google-We...@googlegroups.com
you are welcome :)

MV

unread,
Jul 3, 2006, 7:48:39 AM7/3/06
to Google Web Toolkit
What folder must contain DynaTable.html and what folder
DynaTable.gwt.xml in Tomcat web app ?
Thanks.

Reply all
Reply to author
Forward
0 new messages