wood burning stoves*
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

Titus Abraham
Ranch Hand

Joined: Jun 03, 2009
Posts: 36
hello all,

Can some one please help me .
my applet doesn't load as its having a dependency in the jar file which even though i put in archive path its not taking...

Can any one suggest me whats the problem ?

my class file is in YagattaQApp.jar
and the dependent jar files is facebook-java-api-1.8-final.jar which itself is having a dependency on json-1.0.jar

I am able to run in net beans but when i do it outside my applet doesn't load. If i remove the dependancy (comment the function ) applet runs well.

<HTML>
<HEAD>
<TITLE>Page</TITLE>
</HEAD>
<BODY>
<APPLET CODE="YagattaQApplet"
archive="json-1.0.jar,facebook-java-api-1.8-final.jar,YagattaQApp.jar"
WIDTH=150 HEIGHT=250>
</applet>
</P>
</BODY>
</HTML>

best regards,
titus
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
Welcome to JavaRanch.

All 3 jar files need to be in the same directory as the HTML file containing the applet tag; is that the case? Are there any error messages in the Java Console?


Ping & DNS - my free Android networking tools app
Titus Abraham
Ranch Hand

Joined: Jun 03, 2009
Posts: 36
Thanks a ton for replying.

yes all the 3 jar files and the html are in the same folder and i am getting 2 types of errors from JAVA console.

the first time i load the page
Exception in thread "thread applet-YagattaQApplet-1" java.lang.ExceptionInInitializerError
at YagattaQApplet.init(YagattaQApplet.java:26)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkMemberAccess(Unknown Source)
at java.lang.Class.checkMemberAccess(Unknown Source)
at java.lang.Class.getDeclaredField(Unknown Source)
at com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredField(Unknown Source)
at com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredField(Unknown Source)
at com.sun.xml.internal.bind.v2.model.impl.RegistryInfoImpl.<init>(Unknown Source)
at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.addRegistry(Unknown Source)
at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
at javax.xml.bind.ContextFinder.find(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at com.facebook.api.FacebookRestClient.<clinit>(FacebookRestClient.java:124)
... 3 more


and if i refresh the page
----------------------------------------------------
Exception in thread "thread applet-YagattaQApplet-2" java.lang.NoClassDefFoundError: Could not initialize class com.facebook.api.FacebookRestClient
at YagattaQApplet.init(YagattaQApplet.java:26)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


any ideas.. Do help me out as i am absolutely stuck in my work.

Best regards,


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)

Sounds like JAXB does something that applets are not generally allowed to do. The two ways around that are a) to sign the applet, or b) to alter the local security policy. See HowCanAnAppletReadFilesOnTheLocalFileSystem for more detail.
Titus Abraham
Ranch Hand

Joined: Jun 03, 2009
Posts: 36
Hello ,

Thank you once again for the reply.

I am going to host the html page on a public server (external : joyent) so I am not sure changing my local security policy will help?
so is signing the only way for the same ? can you suggest me a link or guide me for how to sign an applet if that's my only go ?

best regards

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
Correct, every user of the applet would have to change their individual local security policy.

The FAQ page links to various pages that explain applet signing in detail.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet not loading
 
Similar Threads
How to embed JavaFX 2.0 application with jsp (to deploy it on server)
Applet to MySQL DB connection Success!!!!
Calling a JApplet Class in subfolder of a JAR
applet not loading
Deploying an Applet.