• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet cannot invoke applet if run in browser

 
Jan Volkmann
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I wrote a servlet which checks passwords and (if pw is correct) invokes an applet which reads data from a database. All works fine within my IDE (JBuilder4) running on WinNT. The servlet can also be run in a browser (IE && NN) either locally or via network (the servlet, applet and database are deployed on a Linux host using jdk1.3, tomcat3.2.1 and apache). In both cases, however, the applet cannot be loaded (error msg in statusbar: class Applet1 not found).
As far as I know this occurs if code and codebase in the applet-tag are wrong or the classpath is wrongly set. But the tag, classpath and arrangement of folders is principally the same as with other applets I wrote and there's never been problems. And why does it work within the servlet-container of my IDE?
The *.class files reside in /classes/fse (fse is the name of the package)
The applet-tag is (excerpt):

I read that the code should not include a package name so I tried it without it (and copied the *.class files accordingly). Moreover, I tried codebase="./fse", tried everything with and without quotation marks and the .class ending. But it won't work.
I don't even know what the problem could be. Is it the whole concept? Is it the browsers? Is it down to applet rights? Any clues??
regards
Jan
 
Jan Volkmann
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to mention...
JBuilder's servlet-container invokes the applet allright but throws no less than six identical ClassNotFoundExceptions referring to whatever is set as code in the applet-tag (below it's for code="fse.Applet1.class"):

So, it doesn't seem to work at all. But why is the applet invoked anyway??
 
Ashwin Desai
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If the *.class files reside in /classes/fse (fse is the name of the package), then the codebase should be "classes/" (with the trailing slash) and not "."
The above codebase would hold good only if the "classes" subdir is a level below the directory from where the JSP page is loaded.
I have no idea why this setup works in an IDE.
HTH
Ashwin.
 
Jan Volkmann
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ashwin,
thanks for your quick response. I think you were on the right track. the classes folder belongs to the classpath so it should be codebase="fse" code="Applet1.class".
I tried 16 different combinations from "classes/" to "fse" with dots and slashes and without. just to be on the safe side ;-) Neither worked with a browser :-(
So I copied all class files from classes/fse to classes and now it seems to work although I get a IOException now. But that's probably due to applet restrictions (I#m testing locally, the error msg is a dynamic html page created ba the servlet, so that part is ok). I try to rearrange the stuff on the linux machine and let's see how far I'll get.
Jan
 
Jan Volkmann
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, it doesn't work on the server.
Tomcat throws up the following message:

which is strange cos the path is "/examples/WEB-INF/classes/fse/Applet1.class" and "WEB-INF/classes" is represented by "servlet", I reckon. I even copied all class-files into the "classes"-folder and to "classes/fse/fse". I know it's not very intelligent but what can I do?
Jan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic