* Error when compiling to a servlet
@ 2015-02-14 16:07 Ben
2015-02-14 19:16 ` Per Bothner
0 siblings, 1 reply; 9+ messages in thread
From: Ben @ 2015-02-14 16:07 UTC (permalink / raw)
To: kawa
It is not possible to compile a servlet like described in :
http://www.gnu.org/software/kawa/Servlets.html
system:
- kawa-2.9
- /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
- ubuntu 14.04.1
command:
kawa --servlet -C script.scm
what works though isa
kawa -C script.scm and
kawa --servlet script.scm
but not the combination of --servlet and -C
script.scm:
(format "The time is <~s>." (java.util.Date))
error:
(compiling script.scm to script)
internal error while compiling script.scm
java.lang.RuntimeException: no such class: gnu.kawa.servlet.KawaServlet
at gnu.bytecode.ObjectType.getReflectClass(ObjectType.java:122)
at gnu.bytecode.ClassType.getModifiers(ClassType.java:105)
at gnu.bytecode.ClassType.isInterface(ClassType.java:522)
at gnu.bytecode.ClassType.getSuperclass(ClassType.java:426)
at gnu.bytecode.ClassType.isSubclass(ClassType.java:1348)
at gnu.bytecode.ClassType.compare(ClassType.java:1380)
at gnu.bytecode.Type.isSubtype(Type.java:439)
at gnu.expr.Compilation.generateBytecode(Compilation.java:2048)
at gnu.expr.Compilation.process(Compilation.java:2001)
at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:290)
at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:272)
at kawa.repl.compileFiles(repl.java:824)
at kawa.repl.processArgs(repl.java:444)
at kawa.repl.main(repl.java:871)
Caused by: java.lang.ClassNotFoundException:
gnu.kawa.servlet.KawaServlet
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at gnu.bytecode.ObjectType.getContextClass(ObjectType.java:88)
at gnu.bytecode.ObjectType.getReflectClass(ObjectType.java:115)
t
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Error when compiling to a servlet
2015-02-14 16:07 Error when compiling to a servlet Ben
@ 2015-02-14 19:16 ` Per Bothner
2015-02-16 10:14 ` Ben
0 siblings, 1 reply; 9+ messages in thread
From: Per Bothner @ 2015-02-14 19:16 UTC (permalink / raw)
To: Ben, kawa
On 02/14/2015 08:07 AM, Ben wrote:
> It is not possible to compile a servlet like described in :
>
> http://www.gnu.org/software/kawa/Servlets.html
>
> system:
> - kawa-2.9
There is no "kawa-2.9". The kawa-2.0.jar that I released
does include gnu/kawa/servlet/KawaServlet.class. Are you using
some other kawa-XX.jar? Did you build it yourself? If so, how?
> - /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
> - ubuntu 14.04.1
>
> command:
> kawa --servlet -C script.scm
>
> what works though isa
> kawa -C script.scm and
> kawa --servlet script.scm
>
> but not the combination of --servlet and -C
The --servlet option doesn't do anything without -C, so that makes sense.
Note that you also need the servlet-api.jar (available various places including Tomcat
or Glassfish). This containss javax/servlet/http/HttpServlet. However, if you had
gnu/kawa/servlet/KawaServlet but were missing javax/servlet/http/HttpServlet you'd get:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
So I'm assuming there is a problem with your Kawa installation.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Error when compiling to a servlet
2015-02-14 19:16 ` Per Bothner
@ 2015-02-16 10:14 ` Ben
2015-02-16 17:04 ` Per Bothner
0 siblings, 1 reply; 9+ messages in thread
From: Ben @ 2015-02-16 10:14 UTC (permalink / raw)
To: Per Bothner, kawa
thanks, for your quick answer.
> There is no "kawa-2.9". The kawa-2.0.jar
yes, sorry this was a typo
> Are you using
> some other kawa-XX.jar? Did you build it yourself?
yes, I've built it myself and besides this error, it worked well. Now to
make error finding easier I've switched to the precompiled kawa-2.0.jar
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/servlet/http/HttpServlet
yup :-)
- i now work with the 2.0.jar version
- I've tried the servlet-api-2.5.jar and the 3.0. version from tomcat 6.
- I've tried to run 'kawa --servlet -C myscript' in various ways like
" java -cp ./servlet-api-3.0.jar:/home/ben/local/kawa/kawa/kawa.jar
-jar ./kawa.jar --servlet -C script.scm"
but I keep getting the same error::
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/servlet/http/HttpServlet
at java.lang.ClassLoader.defineClass1(Native Method)
....
On Sat, Feb 14, 2015, at 08:15 PM, Per Bothner wrote:
>
>
> On 02/14/2015 08:07 AM, Ben wrote:
> > It is not possible to compile a servlet like described in :
> >
> > http://www.gnu.org/software/kawa/Servlets.html
> >
> > system:
> > - kawa-2.9
>
> There is no "kawa-2.9". The kawa-2.0.jar that I released
> does include gnu/kawa/servlet/KawaServlet.class. Are you using
> some other kawa-XX.jar? Did you build it yourself? If so, how?
>
> > - /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
> > - ubuntu 14.04.1
> >
> > command:
> > kawa --servlet -C script.scm
> >
> > what works though isa
> > kawa -C script.scm and
> > kawa --servlet script.scm
> >
> > but not the combination of --servlet and -C
>
> The --servlet option doesn't do anything without -C, so that makes sense.
>
> Note that you also need the servlet-api.jar (available various places
> including Tomcat
> or Glassfish). This containss javax/servlet/http/HttpServlet. However,
> if you had
> gnu/kawa/servlet/KawaServlet but were missing
> javax/servlet/http/HttpServlet you'd get:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/servlet/http/HttpServlet
>
> So I'm assuming there is a problem with your Kawa installation.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Error when compiling to a servlet
2015-02-16 10:14 ` Ben
@ 2015-02-16 17:04 ` Per Bothner
2015-02-16 21:12 ` Per Bothner
0 siblings, 1 reply; 9+ messages in thread
From: Per Bothner @ 2015-02-16 17:04 UTC (permalink / raw)
To: Ben, kawa
On 02/16/2015 02:14 AM, Ben wrote:
> thanks, for your quick answer.
>> There is no "kawa-2.9". The kawa-2.0.jar
> yes, sorry this was a typo
>
>> Are you using
>> some other kawa-XX.jar? Did you build it yourself?
>
> yes, I've built it myself and besides this error, it worked well. Now to
> make error finding easier I've switched to the precompiled kawa-2.0.jar
Ah. You need to configure with the flag --with-servlet or
--with-servlet=/path/to/servlet.jar
I'm embarrassed to admit that doesn't appear to be mentioned in the manual. Oops.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Error when compiling to a servlet
2015-02-16 17:04 ` Per Bothner
@ 2015-02-16 21:12 ` Per Bothner
[not found] ` <2AF1422A-71B1-4EE1-904D-4F87BAB86629@sent.com>
0 siblings, 1 reply; 9+ messages in thread
From: Per Bothner @ 2015-02-16 21:12 UTC (permalink / raw)
To: kawa
On 02/16/2015 09:03 AM, Per Bothner wrote:
> Ah. You need to configure with the flag --with-servlet or
> --with-servlet=/path/to/servlet.jar
>
> I'm embarrassed to admit that doesn't appear to be mentioned in the manual. Oops.
I checked in documentation on using --with-servlet, as well as more information
on other configure options. (This is only to Subversion doc/kawa.texi; the website
will be updated later, probably when Kawa 2.1 is released.)
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Error when compiling to a servlet
[not found] ` <2AF1422A-71B1-4EE1-904D-4F87BAB86629@sent.com>
@ 2015-02-17 13:25 ` Per Bothner
2015-02-18 11:09 ` Ben
0 siblings, 1 reply; 9+ messages in thread
From: Per Bothner @ 2015-02-17 13:25 UTC (permalink / raw)
To: Ben, kawa
On 02/17/2015 02:33 AM, Ben wrote:
> I've tried to run 'kawa --servlet -C myscript' in various ways like
> " java -cp ./servlet-api-3.0.jar:/home/ben/local/kawa/kawa/kawa.jar
> -jar ./kawa.jar --servlet -C script.scm"
>
> but I keep getting the same error::
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/servlet/http/HttpServlet
> at java.lang.ClassLoader.defineClass1(Native Method)
Hm. There does seem to be a problem when using the -jar option.
Not sure what is going on.
However, the following seems to work:
java -cp /path/to/servlet.jar:/path/to/kawa-2.0.jar kawa.repl --servlet -C script.scm
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Error when compiling to a servlet
2015-02-17 13:25 ` Per Bothner
@ 2015-02-18 11:09 ` Ben
2015-02-18 19:29 ` Per Bothner
2015-02-19 20:23 ` Kawa servlet updates [was: Error when compiling to a servlet] Per Bothner
0 siblings, 2 replies; 9+ messages in thread
From: Ben @ 2015-02-18 11:09 UTC (permalink / raw)
To: kawa, per
thanks, the compilation seems to work now.
Next problem : a runtime error when calling the servlet. I don't know
what could be the reason behind, found noting usable on the web,
therefor the whole error.:
HTTP Status 500 - Error allocating a servlet instance
type Exception report
message Error allocating a servlet instance
description The server encountered an internal error that prevented it
from fulfilling this request.
exception
javax.servlet.ServletException: Error allocating a servlet instance
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:745)
root cause
java.lang.NoClassDefFoundError: gnu/expr/RunnableModule
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:800)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2854)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:745)
root cause
java.lang.ClassNotFoundException: gnu.expr.RunnableModule
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:800)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2854)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:745)
note The full stack trace of the root cause is available in the Apache
Tomcat/6.0.39 logs.
Apache Tomcat/6.0.39
On Tue, Feb 17, 2015, at 02:23 PM, Per Bothner wrote:
>
>
> On 02/17/2015 02:33 AM, Ben wrote:
> > I've tried to run 'kawa --servlet -C myscript' in various ways like
> > " java -cp ./servlet-api-3.0.jar:/home/ben/local/kawa/kawa/kawa.jar
> > -jar ./kawa.jar --servlet -C script.scm"
> >
> > but I keep getting the same error::
> >
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > javax/servlet/http/HttpServlet
> > at java.lang.ClassLoader.defineClass1(Native Method)
>
> Hm. There does seem to be a problem when using the -jar option.
> Not sure what is going on.
>
> However, the following seems to work:
>
> java -cp /path/to/servlet.jar:/path/to/kawa-2.0.jar kawa.repl
> --servlet -C script.scm
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Error when compiling to a servlet
2015-02-18 11:09 ` Ben
@ 2015-02-18 19:29 ` Per Bothner
2015-02-19 20:23 ` Kawa servlet updates [was: Error when compiling to a servlet] Per Bothner
1 sibling, 0 replies; 9+ messages in thread
From: Per Bothner @ 2015-02-18 19:29 UTC (permalink / raw)
To: Ben, kawa
On 02/18/2015 03:09 AM, Ben wrote:
> Next problem : a runtime error when calling the servlet. I don't know
> what could be the reason behind, found noting usable on the web,
> therefor the whole error.:
> HTTP Status 500 - Error allocating a servlet instance
>
> type Exception report
>
> message Error allocating a servlet instance
>
> description The server encountered an internal error that prevented it
> from fulfilling this request.
>
> exception
>
> javax.servlet.ServletException: Error allocating a servlet instance
> ...
> root cause
> java.lang.NoClassDefFoundError: gnu/expr/RunnableModule
> java.lang.ClassLoader.defineClass1(Native Method)
...
That to me suggests Tomcat isn't seeing the kawa.jar.
The documentation recommends copying kawa.jar into
webapps/MYAPP/WEB-INF/lib/kawa.jar
where MYAPP is your web application. Did you try that?
I just tried it again with apache-tomcat-8.0.18 and it works for me.
You could try some of the examples in kawa-NNN/testsuite/webtest.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Kawa servlet updates [was: Error when compiling to a servlet]
2015-02-18 11:09 ` Ben
2015-02-18 19:29 ` Per Bothner
@ 2015-02-19 20:23 ` Per Bothner
1 sibling, 0 replies; 9+ messages in thread
From: Per Bothner @ 2015-02-19 20:23 UTC (permalink / raw)
To: kawa
I checked in various minor fixes and improvements to the Kawa servlet support.
Nothing major - for example (current-servlet) now works (and returns #!null if not
in the context of a KawaServlet). Also, (resource-url) returns a valid URL even if the file doesn't exist.
You might also try out testsuite/webtest/info/+default+ . This file displays in your browser
a bunch of information on the current request and server. It works as-is in these 3 contexts:
(1) Self-configuring web scripts, using the JDK 6 built-in HttpServer. See:
http://www.gnu.org/software/kawa/Self-configuring-page-scripts.html
You can try it by running 'make check-server' in the testsuite directory, and
opening http://localhost:8888/info/anything in your browser.
(2) Self-configuring web scripts, using KawaPageServlet in a servlet container
like Tomcat or Glassfish.
(3) Compiled with --servlet and installed in a servlet container
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-02-19 20:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-14 16:07 Error when compiling to a servlet Ben
2015-02-14 19:16 ` Per Bothner
2015-02-16 10:14 ` Ben
2015-02-16 17:04 ` Per Bothner
2015-02-16 21:12 ` Per Bothner
[not found] ` <2AF1422A-71B1-4EE1-904D-4F87BAB86629@sent.com>
2015-02-17 13:25 ` Per Bothner
2015-02-18 11:09 ` Ben
2015-02-18 19:29 ` Per Bothner
2015-02-19 20:23 ` Kawa servlet updates [was: Error when compiling to a servlet] Per Bothner
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).