?
Solved

applet works inconsistenlty

Posted on 1999-01-25
12
Medium Priority
?
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

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 600 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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 …
Suggested Courses
Course of the Month8 days, 21 hours left to enroll

764 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