Solved

applet works inconsistenlty

Posted on 1999-01-25
12
206 Views
Last Modified: 2013-12-22
I have created an applet that uses Novell's JavaBeans to get a user's NDS name from the tree.  In the process of getting this to work, I experimented with signed applets, editing policy files, changing classpath, etc. on my machine.  Then I downloaded Sun's Java Plug-in.  I couldn't get that to
work, so I downloaded a couple of different versions.  Then I upgraded my Netscape to version 4.07 and tried again, and this time it worked.  I now have two applets created and compiled on my computer, and copied to our intranet server, so that when I visit their pages in Netscape, the
applets work completely.
  The problem - my computer is the only one that will run these applets.  I have tried copying the class and JavaBeans to the other computers, using the same version of Netscape, downloading both plugin versions, changing classpath, even copying files such as java.security and java.policy to their
respective places on the other machine.  None of this works.  I get 'AccessControlException' and 'PropertyPermissionError' when I try to run them.
  Please help, I have been working on this for over a week with no solution in sight.

0
Comment
Question by:candace
  • 6
  • 6
12 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 1234652
probably your applet uses some third party classes that are installed only on your computer (As development enviroment)
0
 

Author Comment

by:candace
ID: 1234653
I copied every base directory with .class or .jar files, and am still getting the same errors.  Any other suggestions?
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1234654
if your applet code is very simple, you can post it here.
also it will help us if you post the whole eception stacktrace ...
0
 

Author Comment

by:candace
ID: 1234655
import java.awt.*;
import java.awt.event.*;
import java.awt.image.ImageObserver;
import java.net.*;
import java.io.*;
import java.util.*;
import java.applet.*;
import com.novell.beans.NWSess.*;
import com.novell.service.nds.naming.*;
import javax.naming.*;
import javax.naming.directory.*;
import javax.naming.spi.*;

public class GetNameEmail extends Applet implements Runnable {
AppletContext ac;
String fullname, shortname, shortfull, straddress;
NWNetworkName  name, connTree;
NWNetworkNames trees;
String str, treename, filename;
NWSess nwSession;
StringBuffer strbuffull, strbufdot, strbufemail;
int i, j, k;

public void init()
{
  try {
        nwSession = new NWSess();
      trees = nwSession.getConnectedTrees();  
      treename = new String(nwSession.getCurrentFullName());
      name = nwSession.getLoginName(treename);
      fullname = new String(name.getFullName());
      shortname = new String(name.getShortName());
      String desiredAttrs[] = {"NGW: GroupWise ID"};
      Properties systemProps = System.getProperties();
      systemProps.put("java.naming.factory.initial",
            "com.novell.service.nds.naming.NdsInitialContextFactory");
      System.setProperties(systemProps);
        Properties myProps = new Properties(systemProps);
      myProps.put("java.naming.provider.url", "MYTREE");
        DirContext initialCtx = new InitialDirContext(myProps);
      j=0;
      for (int i=0; i<3; i++)
      {      j = fullname.indexOf('\\', j);
            j++; }
      shortfull = new String(fullname.substring(j-1));
      i = shortfull.lastIndexOf('\\');
      strbufdot = new StringBuffer(shortfull.substring(i+1));
      j = i;
      i = shortfull.lastIndexOf('\\', j-1);
      while (i != -1)
      {      strbufdot.append(".");
            strbufdot.append(shortfull.substring(i+1, j));
            j = i;
            i = shortfull.lastIndexOf('\\', j-1);
      }
      
      Object obj = initialCtx.lookup(strbufdot.toString());
      if (obj != null)
      {      DirContext currDSCtx = (DirContext) obj;
            Attributes attrSet=currDSCtx.getAttributes("", desiredAttrs);
            NamingEnumeration attrEnum=attrSet.getAll();
                  while(attrEnum.hasMoreElements())
                  {             Attribute attr = (Attribute)attrEnum.next();
                           Enumeration attrValueEnum = attr.getAll();
                           while(attrValueEnum.hasMoreElements())
                           {                 Object value = attrValueEnum.nextElement();
                  straddress = new String(value.toString());
                           }
                }
      }
      i = 0;
      i = straddress.lastIndexOf(" ");
      j = straddress.indexOf("{");
      strbufemail = new StringBuffer(straddress.substring(i+1, j));
      
            ac = getAppletContext();
      }
      catch (Exception e)
      {        System.out.println(e.toString());
      }
}

public void start()
{
      try
      {
            ac.showDocument(new URL("http://10.1.1.18/scripts/get_trouble_ticket.pl?email="+strbufemail.toString()));
            System.out.println("show doc");
      }
      catch (Exception e)
      {      System.out.println(e.toString());
      }
}

public void run()
{}
}

The error message is:
Java(TM) Plug-in
Using JRE version 1.2
User home directory = C:\WINNT\Profiles\mistest
Proxy Configuration: Manual Configuration
     Proxy: http=10.1.1.6:8080;https=10.1.1.6:8080;ftp=10.1.1.6:8080;gopher=10.1.1.6:8080;socks=10.1.1.6:8080
     Proxy Overrides: *10.1.1.18,*oracle,*help

JAR cache enabled.
Opening http://10.1.1.18/request/GetNameEmail.class no proxy
No holding
CacheHandler trying caching. http://10.1.1.18/request/GetNameEmail.class
CacheHandler file name: C:\Program Files\Netscape\Users\default\cache\M0O1862O.CLA
Got cached copy
java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
java.lang.NullPointerException
0
 

Author Comment

by:candace
ID: 1234656
Adjusted points to 200
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1234657
lets define the problem.

- you have the applet classes on you intranet server,
- you can see this applet on your computer, using Netscape 4.07 (downloading the applet from the intranet server)
- you can't see the applet on all the other machines (using the same software configuration).

this looks strange ...

Is your applet signed. Unsigned applets are not allowed to use this code
     System.setProperties(systemProps);

It seems that the applet has permissions on your machine, but does not have on the other ...

hope this helps
  heyhey
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:candace
ID: 1234658
I don't think I ever successfully signed the applet - I know I experimented with creating my own certificates, but none show up under Netscape - Security - Certificates.  I edited my prefs.js file and added a line to allow the codebase to serve as a certificate.  I also added this line to the prefs file on the other computer, however.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1234659
this statement will sure give you SecurityException.
  System.setProperties(systemProps);

untrusted applets are not allowed to manipulate the system properties object.
if this applet works on some computer:
- either applet is signed
- either borwser (or Java plug-in) is configured to allow applets to access System properties object.

this statement will fail on all other unconfigured computers.


0
 

Author Comment

by:candace
ID: 1234660
It turns out that it was a combinations of rights issues (I had my own account on the server, and others didn't have the correct rights) and the fact that the user I was using to test didn't have the attributes that I was trying to extract (in this case, no groupwise account).  So, I finally got it to work.  Thanks so much for your help.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1234661
so will I get some points ? :))
0
 

Author Comment

by:candace
ID: 1234662
I don't know how to close a problem, or if I'm supposed to do it or someone else.  
And if it's up to me, you get the points. ;)
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 200 total points
ID: 1234663
thanks - I am answering your question. :)

If you are really satisfied with my help, you can give me 'grade A' :))
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now