Recently we were working on a JAVA Applet for one our clients. Applet was working fine at our end and in client’s testing enviroment but when applet was integrated with live site, problems began. We got an error “Incompatible magic value 218774561 in class file javax/xml/messaging/URLEndpoint”..
Normally this message comes if sandbox (browser) blocks applet execution. There are following normal causes where sandbox (browser) can block the applet:
1) When JAR is not properly signed
2) When JAR has some dependency but that dependency is not properly signed
3) When JAR and its dependency lib are signed using different certificates
4) When file is not available for download
These points were not the cause in our case, because our applet didn’t have any dependency. JAR was also properly signed.
After some research adn trying things, we found that Sandbox (browser) was blocking our applet, most likely because of cross domain web service calls from our applet.
Here was our situation: our applet was hosted on http://prod.domain.com and making web service calls to http://repo.domain.com, to pull some data. As you can see, the applet was hosted on one domain and web services were hosted on a different domain. So when applet was trying to make web service calls, Sandbox was not allowing applet to make the call since it was a cross domain call that could cause security issues. When applet and web services were hosted on same domain, applet worked like a charm!
We did not fully pinpoint this as cause, but since putting both the applet and web services on one domain resolved the issue, and since cross-origin resource sharing (CORS) is becoming stricter by the day in browsers, we guessed this might be root cause.
In any case, hosting both applet and web services on single domain solved our issue. So if you have an applet and it calls web services on a different domain, and you get this error message, try putting both on one domain and retry. If there are no other issues to cause this message, maybe hosting on single domain will work for you like it did for us!