You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Coughlan <mp...@yahoo.com> on 2003/12/22 20:10:22 UTC

HelloWorld embedded applet not being served

I'm having trouble serving up a fairly simple embedded applet from the
O'reilly Servlet Programming tutorials.

Tomcat can't seem to find the applet that I request from loginpage.html
using this line of HTML.
<applet CODE="DaytimeApplet" CODEBASE="/" WIDTH=300 HEIGHT=180></applet>

The HTML page is served just fine, but both IE and Netscape seem to bring up
an empty applet. I see the Sun logo in the browser so I am assuming it's a
Tomcat config issue and not a local client problem.

Does Tomcat expect applets to reside next to servlets in the WEB-INF/classes
directory? I can't seem to find much documentation and Tomcat and the
<applet> tag.

This was the web.xml IN used for the example above. It was my best guess. I
scanned the DTD but didn't find the relevant ELEMENTS or ATTRIBUTES.

<web-app>
  <servlet>
    <servlet-name>DT</servlet-name>
    <servlet-class>DaytimeApplet</servlet-class>
  </servlet>
  <servlet-mapping>
     <servlet-name>DT</servlet-name>
     <url-pattern>/DaytimeApplet</url-pattern>
  </servlet-mapping>
</web-app>


Tomcat version 4.1.27 gave me this output with debug=99

2003-12-22 13:24:52 StandardHost[localhost]: Mapping request URI
'/loginpage.html'
2003-12-22 13:24:52 StandardHost[localhost]:   Trying the longest context
path prefix
2003-12-22 13:24:52 StandardHost[localhost]:  Mapped to context ''
2003-12-22 13:24:52 StandardHost[localhost]: Mapping request URI
'/DaytimeApplet.class'
2003-12-22 13:24:52 StandardHost[localhost]:   Trying the longest context
path prefix
2003-12-22 13:24:52 StandardHost[localhost]:  Mapped to context ''
2003-12-22 13:24:52 StandardHost[localhost]: Mapping request URI
'/DaytimeApplet.class'
2003-12-22 13:24:52 StandardHost[localhost]:   Trying the longest context
path prefix
2003-12-22 13:24:52 StandardHost[localhost]:  Mapped to context ''
2003-12-22 13:24:57 HostConfig[localhost]: Deploying discovered web
applications


TIA,

Mike C



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: HelloWorld embedded applet not being served

Posted by Rod Giffin <ro...@giffinscientific.com>.
Michael Coughlan said:
> I'm having trouble serving up a fairly simple embedded applet from the
> O'reilly Servlet Programming tutorials.
>
> Tomcat can't seem to find the applet that I request from loginpage.html
> using this line of HTML.
> <applet CODE="DaytimeApplet" CODEBASE="/" WIDTH=300 HEIGHT=180></applet>
>
> The HTML page is served just fine, but both IE and Netscape seem to
> bring up an empty applet. I see the Sun logo in the browser so I am
> assuming it's a Tomcat config issue and not a local client problem.

You're treating an applet as if it was a servlet.  An applet is a client
java class you want the server to send to the browser's vm.  The applet
tag is part of html telling the browser what class, and what parameters to
use.  A servlet is a java class you want the server to execute in its own
vm.  It looks to me like you're trying to specify an applet as a
servlet...which would cause some funny behaviour to be sure.

Check out
http://java.sun.com/docs/books/tutorial/applet/appletsonly/html.html
for proper use of the applet tag.

The reason you can't find information on using the applet tag in web.xml
is because it doesn't usually belong there.

Hope this helps.

Rod.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: HelloWorld embedded applet not being served

Posted by Michael Coughlan <mp...@yahoo.com>.
> I'm having trouble serving up a fairly simple embedded applet from the
> O'reilly Servlet Programming tutorials.

Nevermind.

I now see the debudding information at the bottom of the browser:

"error.java.long.NoClassDefFoundError:com/oreilly/servlet/HttpMessage"

I need to point out the Oreilly com package to the servlet by changing the
applet codebase to the proper path.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org