ClassNotFoundException when accessing applet, but only for some - java

I recently got an email from a customer saying that they were getting errors on one of our web apps. We have a date/time picker applet that's used throughout this app and it's not displaying for this user. The tag in the HTML page is:
<APPLET CODE="com.enerwise.applet.datetime.DateTimeSelector" WIDTH=250 HEIGHT=30 codebase="/japps" name="app_date_start" align="middle" archive="DateTimeSelector.jar,VisualSoftJBCalendar.jar">
<PARAM NAME="locale" VALUE= "en_US" ><PARAM NAME="interval" VALUE= "-1" >
</APPLET>
The error he's reporting is ClassNotFoundException in com.enerwise.applet.datetime.DateTimeSelector. He's tried accessing the page from several different computers in his office and gets the same error. He has Java 1.7 installed (the applet is old; likely compiled with 1.4) and has tried from Win XP/IE8 and Win 7/IE9 machines. I've tried it from a Win XP/IE8 and a Win 7/IE9 machine with java 1.7 and had no problem.
He's the only customer (that I know of) having this problem. I'm stumped! I suggested that he try from a computer that's NOT on his work network; I haven't gotten a reply yet.
Can anyone suggest something to check on his system? I found another thread where the problem was the users proxy setting in the Java Console. I'll have him check that as well.
Is it possible that his company's IT dept. Made a change to their security and it's blocking applets/jar files? Would he get a ClassNotFound message in that case?

The JAR files of java applets are downloaded by the browser like any other files. You should be able to create a URL to those JARs, and ask the user to enter them in the browser and see if they are downloaded.
For example, if your applet is embedded in a page accessible by
http://yoursite.com/some/page.html
then the JAR URLs (in your case) should be something like:
http://yoursite.com/japps/DateTimeSelector.jar
http://yoursite.com/japps/VisualSoftJBCalendar.jar
(you have the /japps codebase specified in the applet tag).
Make your user enter them in the browser, and if they won't download, it's the company firewall, or they are physically missing from the web server.

Related

Java Applet Security Issues

I'm having a lot of difficulty getting an applet I made to run in a web browser. Java security keeps blocking it. I have the jar sitting on my desktop and I made a simple html file that embeds the jar using . I'm trying to embed this in html for my website. I don't have any root access to the site at all so I want to avoid using Web Start and Apache Tom Cat stuff because it seems those tutorials assume you're uploading the app itself to the directory of the site itself. I can only embed html here, so I have a jar located in my googledrive.com/host that I'm trying to link.
Here's the code for the tag.
<applet
codebase="https://bb2f18b1cb19b925c50b747c1c65afcc4ad11720.googledrive.com/host/0B34NA0csYJZufm5ZeFFEcUMyQnR5bmw1eVl2M3BOcXItNGxxZTZvaFExNVhXQnY4dzY3QTg"
archive="AsteroidGameApp.jar"
code="asteroidgame.AsteroidGame.class"
width=500
height=500>
</applet>
I don't even know if it would run correctly or not because I can't get past the security. I've read stuff about getting the code signed but I can't find a clear tutorial how to do that.
As reported on the Java related site Starting with Java 7 Update 51, trying to run unsigned Java applications generates error messages and prevents executing the applet.
Follow the instructions about the Oracle proper solution (I my experience I had to get a valid certificate from a trusted root like Verisign and then used this certificate to sign my applet jar) but if you can't do this way, try the suggested workaround in the correspondent section.
Obviously, as stated by the Java site:
It is highly recommended not to run these types of applications. However if you still want to run these apps, run only if you understand the risks and implications.

ClassNotFoundException for applet on some computers but not others -- related to operating system?

Some users report a ClassNotFoundException error with our Java applet, but others are able to use the applet without issue.
We have observed that the problem seems correlated to the system's operating system.
The users who can successfully use the applet have newer computers whereas the ones who cannot are using Windows XP Home SP3. We verified the ability to directly download the applet by typing the applet URL into the browser. A firewall doesn't appear to be the issue.
We asked everyone to use Chrome to remove the browser as a variable.
Do we need to sign the applet in a different way or reference the applet differently within the HTML?
We know the applet tag is deprecated, but that doesn't explain why it's generating this error for some users and not others.
Another relevant detail: if you use the IP address directly, not the domain name, the applet loads fine.
Reproduce:
1) Visit http://www.cengraving.com/s/item?itemId=CH003
2) Tap Customize.
3) On XP machines, the page generates the ClassNotFoundException error saying that com.designapplet.ui.DesignApplet is not found. (We have also referenced com.designapplet.ui.DesignApplet.class but that also fails.)
4) If you try again the IP addr, the applet loads fine on those same XP machines: 67.212.167.170/s/item?itemId=CH003. We can load the applet directly from the browser with www.cengraving.com/SecureApplet.jar, so firewall rules don't appear to be an issue.
HTML:
<applet name="app" archive="/SecureApplet.jar" code="com.designapplet.ui.DesignApplet" width="770" height="800">
<param name="itemId" value="CH003">
<param name="layoutId" value="CH0031395363931437.lay">
<param name="process" value="Engraving">
<param name="qty" value="1">
<param name="id" value="171">
<param name="sessionId" value="3BF3610C74B4BB5CC5193E479CD1D930">
(HTML)
</applet>
Could it be an inconsistency between the versions of Java on the different versions of Windows? These other places I've looked seem to have similar issues with the result being the wrong version of Java is being used. The error message itself seems to refer to a missing component.
http://developer.appcelerator.com/question/15151/windows-xp-and-classnotfoundexception-with-titanium-dev-121
http://discussions.blackboard.com/forums/t/43951.aspx
In my opinion there is a problem with applet tag (missing attribute or a bit wrong value). Change way to publish your applet on the website, I will give you some example here.
You have to pay attention to values of some attributes like codebase or java_codebase - they have to contains full url to jar (without extension) - I had a lot of problems with publishing applet (different browsers and systems) and in my answer (link above) is essence of my hard work.

Deploy Applet on Apache server

I've written a Java applet game that I want to deploy on my Apache server. Code + resources are in a self signed .jar with accompanying HTML doc both in the root dir. When I run it on my local machine everything works fine. When I try to run on the server I get a class not found exception. index.html contains
<applet code=SpaceRaiderz.class
archive=spaceraiderz.jar
width=1024 height=768>
</applet>
The class not found is the class named above. Opened up the .jar and its contents are complete. File permissions set to 755. If I click the index.html on my local machine it loads up and runs perfectly. Ftp the same docs to the server and it doesn't work. Anyone had this problem? I found a similar question to this on here but none of the suggested solutions have worked in this case.
The applet (seen here) works (e.g. showing an asteroids style game featuring a pale green ship that appears suspiciously familiar + sound track) for me in Java 1.7.0_21 on Windows using FF. Refreshing the class cache in the console & then refresh the page might fix the problem for you.
If that fails, there are still more options for testing the applet:
Usually installing another browser (these things are often due to a problem in the particular browser/JRE combo.).
There is also the Appleteer applet testing environment. I can highly recommend it, Since I wrote it.
Go to an internet cafe or the local library to check an applet, if all else fails.

How to upload files with java applet?

I know similar questions have been asked but i have searched for hours and as of yet have not come up with a workable solution.
I have a Java applet which will be a "paint" like application. So, I need the user to be able to upload images from their file system. I first tried using a JFileChooser which works great in the eclipse environment. However, when put online i get a "java.security.AccessControlException: access denied" exception.
I was thinking that perhaps within the applet i could call a script (located on my server) which would prompt the user to select a file - but i have no idea how to do this. I am using zymic web hosting, so the only supported scripting language is PHP.
I also tried signing the applet. Since i don't want to spend money on certificates, i self signed the applet. When i tried running it, I got an error stating "The Publisher Cannot Be Verified By A Trusted Source".
Any help would be greatly appreciated. - Thanks:)
A trusted applet can most certainly load files from the local file-system. The "Publisher Cannot Be Verified By A Trusted Source" message that is produced by self-signed applets is onerous & scary (for good reason), but if the user OKs it, it works just fine.
Here is a small demo. of exactly that.
Since the 'Next Generation' Plug-In, even sand-boxed applets can access the local file system. See the last 2 links on the Applet tag info page for further details.
Here is an applet that uses the Next Generation file abilities.
Unsigned applets can not access the file system for security reasons.
There is a tutorial about uploading files using PHP here
Maybe you can work that into your page in order to allow the file to be uploaded and then load it from your web server with the applet.
Do keep in mind the warning at the end of that example under the section "php - file upload: safe practices"

Ways to open a folder/explorer client side from a web page.... Java applet?

I have a need to "pop up" operating system folders from my web app, mostly to locate files in them. My users don’t want to use a conventional web upload/download paradigm. I have 7 or 8 static folders that need to be opened in explorer on a PC or in Finder on a mac. These folders are all network available, but are buried, and for convenience need to be shown on a web page.
There are IE tricks to do this, and I've written a sample flash app that only allows the browser to open, but I know most browsers sandbox this, and keep me from calling these folders. I am aware that some Java libraries deal with the opening of folders, does anyone have any thoughts or samples for this?
The only way I can imagine is to create a Signed Java Applet.
Applets cannot access the filesystem (and a lot of other ressources) if they are not valid signed. Maybe you can also grant the permission by a policyfile.
There ist a tutorial at JavaRanch.
But I am not sure, if this solution will be very helpful, because the JavaPlugin will be removed from a lott of browsers in near future. (I think FireFox already removed it).
I think there is actually NO solution to this problem.
There may be some workarrounds:
Put a Batch-File onto the server, which opens the folder, if executed
Can you create a local service, which handles requests from you webpage and opens the folder.
Create a webapplication, which opens the folder at serverside, and create a webpage, which displays the content in you website.

Categories

Resources