File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes applet not loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "applet not loading" Watch "applet not loading" New topic
Author

applet not loading

bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi,

what does the following error mean




i have a applet file.
i can run it fine in eclipse. ( right click--> run as applet).
now i wanted to run that in browser.
i tried writing html file and i could not run it.



so now i'm trying the same file in jsp ( my java file is testapp.java)
now i have written the jsp code as



now,

my java file( testapp.java) is in
D:\eclipse\workspace\soft\bin

my class file in
D:\eclipse\workspace\soft\bin and
D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Samples and
D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Samples\testapp

my jsp file (testapp.jsp) is in
D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Samples\
D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Samples\testapp

i started the tomcat server
my code uses dll file. that file is in system32 folder.

i tried to run in firefox.. it asked me to install missing plugins.
so as it suggested i downloaded jre6 update 14 and installed in c:\jre folder.

but still same error in firefox.
so i tried in IE.
it shows "error. click for details"
when i click that the errors posted above appear.

as per my little java knowledge is concerned, nullpointerexception occurs when the java compiler/interpretor does not recognize some of the values of the file.(maybe i'm wrong).

any suggestions,

thanks in advance.


Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10248
    
    8

Moving to a more appropriate forum


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Shashank Rudra
Ranch Hand

Joined: Mar 26, 2009
Posts: 131
how can you simply use the class name while inside a JSP. you will have to specify the complete path to the class. May be using codebase will help.


Programmer Analyst || J2EE web development/design
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
thank you sam...

as suggested by you, i replaced code=<filename> with codebase=<filename>

now it throws



i even replaced with entire path of the file, but it also throws the same error.

any suggestions

thank you in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
Sam Giraldo wrote:how can you simply use the class name while inside a JSP. you will have to specify the complete path to the class. May be using codebase will help.

Using that in a JSP page is perfectly fine. The "code" attribute should NOT have a "complete path" - it's a class name, not a file name.

It looks as if the stack trace in your first post is not complete - is there more to it?


Ping & DNS - my free Android networking tools app
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf,

the trace i posted in was the complete thing i got. there is nothing more to it.


thank you in advance
Shashank Rudra
Ranch Hand

Joined: Mar 26, 2009
Posts: 131
Please don't remove the code parameter in the jsp:plugin action tag. Use it with codebase.

Plugin: Mandatory attribute code missing
- this will be gone

Now if again the same error as you said in your first post - is coming then may be you need to check in your Applet code that you are not using anything which has not been properly initialized.

Mozilla Firefox error - may be coming due to some missing param in action tag. Or may be some additional tags are required. First let it run in IE where at least you are able to see the error message.
george tonkin
Greenhorn

Joined: Jul 17, 2009
Posts: 5
This is an issue w/ Java 1.6.0_14-b08. Try v1.5. I believe there's an issue open for this already.
george tonkin
Greenhorn

Joined: Jul 17, 2009
Posts: 5
george tonkin wrote:This is an issue w/ Java 1.6.0_14-b08. Try v1.5. I believe there's an issue open for this already.


I looked into this a bit more since it's also affecting my website. So far, it seems the problem is with the Version 2 of Sun's Java Applet Plugin. Using the other version seems to work fine (at least on Linux, I'm yet to test on Windows).
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
thank you george...
will try and let you know the status
george tonkin
Greenhorn

Joined: Jul 17, 2009
Posts: 5
A very simple applet of mine works fine w/ the V2/Next-Generation Applet Plugin. The applet's job is simply to report the version of Java which the user has (it's part of the troubleshooting on my site), and thus uses only very basic parts of the Java SDK (not even Swing).

With that in mind, is this occurring for a test/prototype/sample Applet of yours? Are you able to share the source? If so, how big is it? If not, can you share some of the techniques & technologies the Applet uses? Swing? Custom painting? Database? XML? etc.

Unfortunately, the applet of mine which this issue affects is relatively large, so the process of finding the offending part may not be easy. But if we identify common traits between our applets, that can point me in a direction to start.
george tonkin
Greenhorn

Joined: Jul 17, 2009
Posts: 5
I've verified that using the original plugin (ie. not the "next generation"/v2 plugin) on Windows also functions properly.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi george,

in my first post on this thread ( Post New posted Friday, July 17, 2009 3:40:22 PM ) you can see the complete output of the error window.


the same code is running fine in eclipse ( eclipse-----> right click---> run as applet. )

i just wanted to run from JSP.

you can see my jsp coding and other details in the first post said above.

this is no sample code........ this is my application code.


thank you in advance
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
think this the complete stack trace

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
Looks like you're still missing the CODE attribute which is required.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf.

where will be that CODE attribute??



thank you
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
It looked correct to me in your first post.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf,

what is wrong with my code. i'm trying for three days now to run it in jsp.


thank you in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
what is wrong with my code.

One problem is that you made it worse by removing the code attribute.

Then I'd investigate if the class file is being requested and successfully downloaded from the web server. That would be logged in TOMCAT_HOME/logs/localhost_access_log.2009-07-20.txt file, either with a 200 or 404 result in the second to last column.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi,

when i rename my file from testapp.jsp to testapp.html it shows some message written in the jsp:fallback tag ( unable to load applet )

when i include codebase="/samples" or codebase = "." it shows class not found error.

any help please.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
Do not use codebase; there's no need for that.

Start with the HTML file you showed in your first post; once you get that working you can convert it to a JSP.

Now look into the issue I mentioned in my previous post about the server access log.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf,

i never removed my code attribute tag... it is still there.. for your reference i'm posting the testapp.jsp/html file for you



and the log file



bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf,

this is what i get when i run the html file




these errors has no change so i shifted to jsp.
even i googled it lots of timed but google shows results in just only 1 page.

thank you in advance
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi,

when the above said error occurs, the applet window shows

start: applet not initialized.
when i closed that window it shows,



in command prompt.

thank you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
What you posted is not an HTML file - it's a JSP file. As I said, use the HTML file you posted in your first post.

Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.testall)

Applets need to be signed in order to use native libraries. See HowCanAnAppletReadFilesOnTheLocalFileSystem for more information.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf,

what i have posted in my first post are html and jsp files respectively

the html file is





the jsp file is




the difference is that the html file is in the eclipse working directory ( as you must have seen in the command prompt output, from the path i'm running the html file) and the jsp file is in the apache tomcat's my custom folder.

i do not know which file you are specifying.

in the mean while i will try the details in the link you provided.



thank in advance.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
I'm confused. You said yourself "i have posted in my first post are html and jsp files respectively". So when I say "use the HTML file", what's unclear about that? Forget about the JSP file; in fact, just delete it, and put the HTML file into the proper Tomcat directory.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf,

i'm even more confused now....

i'm trying to run the .html file which is in eclipse workspace from the command prompt as

ecpilse workspace location where the .html file is located>appletviewer <filename>.html

then

i'm trying to load the .jsp file, which is a complete different file in a web browser...

steps are..

1.created a .jsp file for the java class file.
2.placed the .jsp file in my custom folder in the installed path of my apache tomcat ( exactly here D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Samples )

3.runnuing the apache tomcat server 5
4.opening IE and entering

ttp://localhost:8080/Samples/testapp.jsp



is there anything wrong in my approach??

thank you
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
is there anything wrong in my approach?

You mean, except that it's not working?

It's a well-known debugging strategy to keep things simple in order to get them to work. Then, once everything works fine, you can start adding bells and whistles. Since you were struggling for a long time (and apparently still are) to get the JSP file to work, I advised to just get rid of it, and use the HTML instead, thereby eliminating troublesome steps.

Of course, in order to use the HTML file, it must be in the proper Tomcat directory. Whatever is done in Eclipse has no bearing once you properly deploy the code into Tomcat.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf,

lol,
thats fine..

now i'm struggling with the java policy.

hope i will solve it


thank you
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi,

i resolved it to some extent...
when i enter http://localhost:8080/Samples/testapp.html in the web browser i get the gui. but the functionalities are still not working.

then i created a jsp file and put it in the same folder as the html file.
now i run http://localhost:8080/Samples/testapp.jsp and it is showing



then from the log i get



any suggestions

thanks in advance

george tonkin
Greenhorn

Joined: Jul 17, 2009
Posts: 5
My posts were specifically targeting the first set of error messages which you reported (lines 20-25):

I think Ulf Dittmer is giving good advice to stick w/ the HTML file--using JSP will only add another variable to deal with.

If you can get back to the state you were in w/ your original post, getting the same error & stack trace as above, then change your applet plugin version and see what happens.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi george and ulf,

i'm able to run the html file from the tomcat server.

i'm getting the GUI, but the functionalities are not working... i mean nothing is happening when i click the buttons

any suggestions.

thank you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41506
    
  53
Bharani, since the applet is now working, please start a new topic for any unrelated problems that you're now encountering. Keep in mind that we don't have the applet's source code, so a problem description of "nothing is happening when i click the buttons" means precisely nothing to us. When you start the new topic, be sure to include information on what you expected to happen when you clicked any button, whether your button action listeners were called, and any other relevant information.
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi ulf,

thank you very much..
i'll start new topic
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: applet not loading