• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet deployment in Tomcat / Turbine

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. I found the error.

I put my jar file in /webapps/autos/ but was trying to access it through http://host-name.com:port/autos/servlet/autos/ImageUploader.jar instead of just http://host-name.com:port/autos/ImageUploader.jar.

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?

[SOLVED]

Edit:

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!



 
Sasparilla and fresh horses for all my men! You will see to it, won't you tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic