public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Using Kawa with Apache Tomcat
@ 2015-06-15  2:04 Tony West
  2015-06-15  2:46 ` Per Bothner
  0 siblings, 1 reply; 7+ messages in thread
From: Tony West @ 2015-06-15  2:04 UTC (permalink / raw)
  To: kawa

Hi.

I have been trying to get Kawa to work with Tomcat but so far I haven't succeeded.

At the moment, when I browse to the url, Firefox's console is showing [HTTP/1.1 200 OK 0ms] so I seem to be finding the file, but the screen comes back blank.

My web.xml is as follows:
<web-app>
  <display-name>My Application</display-name>

  <servlet>
    <servlet-name>MyHello</servlet-name>
    <servlet-class>hello</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>MyHello</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
</web-app>


My hello.scm is simply:
(require 'http)
(display (html:p "Hello world from Kawa"))


I have been compiling the file with:
java kawa.repl --servlet -C hello.scm

The file compiles ok and produces:
hello$frame.class
hello.class


I would be grateful if anyone could suggest what I am doing wrong.

Thanks.

Tony 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using Kawa with Apache Tomcat
  2015-06-15  2:04 Using Kawa with Apache Tomcat Tony West
@ 2015-06-15  2:46 ` Per Bothner
  2015-06-15  4:13   ` Tony West
  0 siblings, 1 reply; 7+ messages in thread
From: Per Bothner @ 2015-06-15  2:46 UTC (permalink / raw)
  To: Tony West, kawa

On 06/14/2015 07:04 PM, Tony West wrote:
> I have been trying to get Kawa to work with Tomcat but so far I haven't succeeded.
>
> At the moment, when I browse to the url, Firefox's console is showing [HTTP/1.1 200 OK 0ms] so I seem to be finding the file, but the screen comes back blank.
> ...
> My hello.scm is simply:
> (require 'http)
> (display (html:p "Hello world from Kawa"))

Leave off the display call:

(require 'http)
(html:p "Hello world from Kawa")

In a Kawa servlet, you don't "print" the response.
It's like a REPL - the servlet is evaluated to a value
and *that* becomes the response.

Try copying the file in testsuite/info/+default+
to your hello.scm and you'll get a very detailed response,
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Using Kawa with Apache Tomcat
  2015-06-15  2:46 ` Per Bothner
@ 2015-06-15  4:13   ` Tony West
  2015-06-15  4:37     ` Per Bothner
  0 siblings, 1 reply; 7+ messages in thread
From: Tony West @ 2015-06-15  4:13 UTC (permalink / raw)
  To: kawa


----------------------------------------
> Date: Sun, 14 Jun 2015 19:45:57 -0700
> From: per@bothner.com
> To: tonys-mailbox@hotmail.com; kawa@sourceware.org
> Subject: Re: Using Kawa with Apache Tomcat
>
> On 06/14/2015 07:04 PM, Tony West wrote:
>> I have been trying to get Kawa to work with Tomcat but so far I haven't succeeded.
>>
>> At the moment, when I browse to the url, Firefox's console is showing [HTTP/1.1 200 OK 0ms] so I seem to be finding the file, but the screen comes back blank.
>> ...
>> My hello.scm is simply:
>> (require 'http)
>> (display (html:p "Hello world from Kawa"))
>
> Leave off the display call:
>
> (require 'http)
> (html:p "Hello world from Kawa")
>
> In a Kawa servlet, you don't "print" the response.
> It's like a REPL - the servlet is evaluated to a value
> and *that* becomes the response.
>
> Try copying the file in testsuite/info/+default+
> to your hello.scm and you'll get a very detailed response,
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/

I made the above change to hello.scm but I still get a blank screen in the browser.

I downloaded the source (kawa-2.0.tar.gz) and found the testsuite directory, but I can't find /info/+default+ under it.

Puzzled.

Tony
 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using Kawa with Apache Tomcat
  2015-06-15  4:13   ` Tony West
@ 2015-06-15  4:37     ` Per Bothner
  2015-06-15  4:56       ` Tony West
  0 siblings, 1 reply; 7+ messages in thread
From: Per Bothner @ 2015-06-15  4:37 UTC (permalink / raw)
  To: Tony West, kawa


> I made the above change to hello.scm but I still get a blank screen in the browser.


What if the entire hello.scm is just the following

"Hello world\n"

> I downloaded the source (kawa-2.0.tar.gz) and found the testsuite directory, but I can't find /info/+default+ under it.

Sorry, it's actually testsuite/webtest/info/+default+

And it appears it's only in the Subversion sources, but doesn't
get included in the source tar-balls.

You can get it from here:
https://sourceware.org/viewvc/kawa/trunk/testsuite/webtest/info/+default+

Given that this file is mentioned in the documentation, I should fix the
tar-building script to includes this file.

Note I haven't actually tried your example configuration - I'll try tomorrow
if you can't get it to work with my suggestions.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Using Kawa with Apache Tomcat
  2015-06-15  4:37     ` Per Bothner
@ 2015-06-15  4:56       ` Tony West
  2015-06-15  6:45         ` Per Bothner
  0 siblings, 1 reply; 7+ messages in thread
From: Tony West @ 2015-06-15  4:56 UTC (permalink / raw)
  To: kawa


----------------------------------------
> Date: Sun, 14 Jun 2015 21:36:47 -0700
> From: per@bothner.com
> To: tonys-mailbox@hotmail.com; kawa@sourceware.org
> Subject: Re: Using Kawa with Apache Tomcat
>
>
>> I made the above change to hello.scm but I still get a blank screen in the browser.
>
>
> What if the entire hello.scm is just the following
>
> "Hello world\n"
>
>> I downloaded the source (kawa-2.0.tar.gz) and found the testsuite directory, but I can't find /info/+default+ under it.
>
> Sorry, it's actually testsuite/webtest/info/+default+
>
> And it appears it's only in the Subversion sources, but doesn't
> get included in the source tar-balls.
>
> You can get it from here:
> https://sourceware.org/viewvc/kawa/trunk/testsuite/webtest/info/+default+
>
> Given that this file is mentioned in the documentation, I should fix the
> tar-building script to includes this file.
>
> Note I haven't actually tried your example configuration - I'll try tomorrow
> if you can't get it to work with my suggestions.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/

I have tried replacing the contents of hello.scm with just "Hello world\n", and also replacing it with the contents of +default+.

In both cases it continues to show a blank screen.

Some additional information about my setup if this helps:

Operating System: Windows 7 Pro x64 SP1
Tomcat version: 8.0.23 (running as a Windows service)
Java version: J2SE 8u45 x64 JDK
Kawa version: 2.0 (the precompiled jar file)

CLASSPATH=.;E:\Languages\Kawa\kawa-2.0.jar;C:\apache-tomcat-8.0.23\lib\servlet-api.jar

Thanks for your help with this by the way.

Tony
 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Using Kawa with Apache Tomcat
  2015-06-15  4:56       ` Tony West
@ 2015-06-15  6:45         ` Per Bothner
  2015-06-15  7:09           ` Tony West
  0 siblings, 1 reply; 7+ messages in thread
From: Per Bothner @ 2015-06-15  6:45 UTC (permalink / raw)
  To: Tony West, kawa

Well, it works for me ...

Note that Tomcat doesn't seem to automatically re-load manually compiled classes.
So if you change something, I suggest running $CATALINA_HOME/shutdown.bat and then
$CATALINA_HOME/startup.bat.  There is probably some way to get Tomcat to
re-load classes without shutting it down, but I'm not a Tomcat expert.

Note if you use "self-configuring web page" feature (which is somewhat like JSP),
then you don't need to manually compile servlets, or stop/start the server.  See here:
http://www.gnu.org/software/kawa/Self-configuring-page-scripts.html

I'm assuming you have a copy of the kawa jar file as WEB-INF/lib/kawa.jar.
I'm also assuming your hello.class is WEB-INF/classes/hello.class.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: Using Kawa with Apache Tomcat
  2015-06-15  6:45         ` Per Bothner
@ 2015-06-15  7:09           ` Tony West
  0 siblings, 0 replies; 7+ messages in thread
From: Tony West @ 2015-06-15  7:09 UTC (permalink / raw)
  To: kawa

----------------------------------------
> Date: Sun, 14 Jun 2015 23:44:17 -0700
> From: per@bothner.com
> To: tonys-mailbox@hotmail.com; kawa@sourceware.org
> Subject: Re: Using Kawa with Apache Tomcat
>
> Well, it works for me ...
>
> Note that Tomcat doesn't seem to automatically re-load manually compiled classes.
> So if you change something, I suggest running $CATALINA_HOME/shutdown.bat and then
> $CATALINA_HOME/startup.bat. There is probably some way to get Tomcat to
> re-load classes without shutting it down, but I'm not a Tomcat expert.
>
> Note if you use "self-configuring web page" feature (which is somewhat like JSP),
> then you don't need to manually compile servlets, or stop/start the server. See here:
> http://www.gnu.org/software/kawa/Self-configuring-page-scripts.html
>
> I'm assuming you have a copy of the kawa jar file as WEB-INF/lib/kawa.jar.
> I'm also assuming your hello.class is WEB-INF/classes/hello.class.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/

Good grief.

You are right.  Tomcat wasn't automatically reloading the classes.

Simply restarting it did the trick.

Thank you for all your help and sorry to bother you with such a silly problem.

Tony

 		 	   		  

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-06-15  7:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15  2:04 Using Kawa with Apache Tomcat Tony West
2015-06-15  2:46 ` Per Bothner
2015-06-15  4:13   ` Tony West
2015-06-15  4:37     ` Per Bothner
2015-06-15  4:56       ` Tony West
2015-06-15  6:45         ` Per Bothner
2015-06-15  7:09           ` Tony West

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).