File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Applet deployment in Tomcat / Turbine Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet deployment in Tomcat / Turbine " Watch "Applet deployment in Tomcat / Turbine " New topic

Applet deployment in Tomcat / Turbine

A Shehadi

Joined: Jul 13, 2009
Posts: 19
Although I have read the forum for some time now, it's my first post. So hello everyone!

Ok, I have read several threads in different forums regarding applet deployment under Tomcat, but still can't get it to work.

I have a Turbine project in /webapps/autos, and I need to embed an applet inside a Velocity page (which ultimately translates into a regular HTML page), so I have put my ImageUploader.jar file under /webapps/autos, and I'm embedding it this way:

However, I get a "java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file ImageUploaderApplet", which as far as I know and have read means that, since Tomcat can't find the applet, it's serving an error HTML page, such that the JVM tries to "interpret" it resulting in incompatible magic numbers, obviously because Java files and HTML are different.

Any pointers on how to embed a Java Applet in a Turbine dynamic page?

The thing is, I've read somewhere else that changes should be made inside the Tomcat config files, but the problem is I need to deploy the whole Turbine project as a War file into another server I have no config privileges in.

Thanks a lot!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
So the HTML file containing the applet and the ImageUploader.jar file are both located in "/webapps/autos"? The first thing I'd do is remove the "codebase" attribute from the applet tag - it serves no purpose here.

The next thing is to check the Java Console to see whether there are any error messages. If there are, post them here.

Also, try to download the jar file manually through the browser by entering its URL in the browser; it should be something like http://myServer:myPort/auto/ImageUploader.jar (replace "myServer" and "myPort" as appropriate). Does the jar file get downloaded?

Lastly, take a look at the access logs in Tomcat's log directory. In it, you should see which files the browser JVM is actually trying to download. In particular, look for the attempts to download the jar files, and make a note of their HTTP status code - it's generally the last item in the log entry. If that's not 200, then there's a problem.
A Shehadi

Joined: Jul 13, 2009
Posts: 19
Ok. I found the error.

I put my jar file in /webapps/autos/ but was trying to access it through instead of just

Phew, thanks a lot! I guess I was way too tired yesterday to realize my mistake.

But now my problem is, I have put the address hard coded, i.e.

and I would like to be relative to the server, since I'm deploying it elsewhere.

Any pointers?



Ok. I solved the issue. I just have to put my jar file at /webapps/autos/ root folder (i.e. what would be the root of the war file) and reference it as:

and everything works as expected.

Thanks for your help Ulf!

I agree. Here's the link:
subject: Applet deployment in Tomcat / Turbine
It's not a secret anymore!