Help SecurityException

Hello.
I'm a problem with WL6.0 that in WL5.1 i haven't. My source code is :
java.security.MessageDigest oDigest=java.security.MessageDigest.getInstance("MD5");
byte oRes=oDigest.digest(oIn);
the Exception that produce is :
java.lang.SecurityException: Prohibited package name: java.security
Could anybody tell me why? Thank you very much!

I'm having a similar problem. solaris, jdk 1.2.2 weblogic 5.1
the setCookie is calling our cryptix classes which have worked correctly
on 5.1 on linux and 4.5 on all OS's.
thanks.
Wed Feb 07 16:35:41 PST 2001:<I> <ServletContext-General> *.html: init
Wed Feb 07 16:35:41 PST 2001:<E> <ServletContext-General> Servlet failed
with Exception
java.lang.SecurityException: Prohibited package name: java.security
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(RuntimeException.java:47)
at java.lang.SecurityException.<init>(SecurityException.java:39)
at java.lang.ClassLoader.defineClass(Compiled Code)
at java.security.SecureClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.access$1(Compiled Code)
at java.net.URLClassLoader$1.run(Compiled Code)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Compiled Code)
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClassInternal(Compiled Code)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass0(Compiled Code)
at java.lang.ClassLoader.defineClass(Compiled Code)
at java.security.SecureClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.access$1(Compiled Code)
at java.net.URLClassLoader$1.run(Compiled Code)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Compiled Code)
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at weblogic.boot.ServerClassLoader.findFromParent(Compiled Code)
at weblogic.boot.ServerClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClassInternal(Compiled Code)
at
com.foo.session.SessionHandler.setCookie(SessionHandler.java:605)
at
com.foo.session.SessionHandler.processSession(SessionHandler.java:482)
at com.foo.parse.SaxonPageGen.preService(SaxonPageGen.java:119)
at com.foo.viewpage.ViewPage.preService(ViewPage.java:66)
at com.foo.parse.XslCompilerServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:106)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:907)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:851)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:252)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:364)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:252)
at weblogic.kernel.ExecuteThread.run(Compiled Code)
Luis wrote:
>
Hello.
I'm a problem with WL6.0 that in WL5.1 i haven't. My source code is :
java.security.MessageDigest oDigest=java.security.MessageDigest.getInstance("MD5");
byte oRes=oDigest.digest(oIn);
the Exception that produce is :
java.lang.SecurityException: Prohibited package name: java.security
Could anybody tell me why? Thank you very much!

Similar Messages

  • Where to Check Signature Logs

    I am getting the following error during signing.Please Help
    SecurityException in method: verify( Message, byte[], CPALookupObject ). Message: SecurityException in method: verify( Message, byte[], CPALookupObject ). WSSEThread-Exception: SecurityException in method: run(). Message: [com.sap.ASJ.wssec.030191] The found signature was not valid. Check signature logs for details.. To-String: com.sap.security.core.policy.exceptions.VerifyException: [com.sap.ASJ.wssec.030191] The found signature was not valid. Check signature logs for details.; To-String: com.sap.aii.security.lib.exception.SecurityException: SecurityException in method: run(). Message: [com.sap.ASJ.wssec.030191] The found signature was not valid. Check signature logs for details.. To-String: com.sap.security.core.policy.exceptions.VerifyException: [com.sap.ASJ.wssec.030191] The found signature was not valid. Check signature logs for details.. To-String: com.sap.aii.security.lib.exception.SecurityException: SecurityException in method: verify( Message, byte[], CPALookupObject ). WSSEThread-Exception: SecurityException in method: run(). Message: [com.sap.ASJ.wssec.030191] The found signature was not valid. Check signature logs for details.. To-String: com.sap.security.core.policy.exceptions.VerifyException: [com.sap.ASJ.wssec.030191] The found signature was not valid. Check signature logs for details.; To-String: com.sap.aii.security.lib.exception.SecurityException: SecurityException in method: run(). Message: [com.sap.ASJ.wssec.030191] The found signature was not valid. Check signature logs for details.. To-String: com.sap.security.core.policy.exceptions.VerifyException: [com.sap.ASJ.wssec.030191] The found signature was not valid. Check signature logs for details.
    Thanks
    Mridul

    Hi Mridul,
    Use XPI Inspector to get detailed error log.
    Michal's PI tips: XPI inspector - help OSS and yourself
    Michal's PI tips: XPI inspector - new functions and features (graphical message flow display)
    Also check below useful links:
    How to Load keys and certificates in SAP PI 7.3, SAP PO 7.3 EHP1 NWA's Key Storage
    Configuring WSSE (digital signing and encryption) using SAP PI 7.11 AAE SOAP Adapter

  • SecurityException with Helper.getMBeanHome()

    Hello,
    I used the Helper class to get the MBeanServer. But when I run the following piece of code
    public final void donttestMultipleGetMBeanServer() {
        MBeanHome home = Helper.getMBeanHome("weblogic", "weblogic", "t3://localhost:7001", "DevDom");
        MBeanServer server1 = home.getMBeanServer();
        home = Helper.getMBeanHome("weblogic", "weblogic", "t3://otherhost:9001", "OtherDom");
        MBeanServer server2 = home.getMBeanServer();
    }I get the following exception:
    java.lang.SecurityException: [Security:090398]Invalid Subject: weblogic
         at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
         at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:164)
         at weblogic.management.internal.MBeanHomeImpl_816_WLStub.getMBeanServer(Unknown Source)
             ...When I don't call the Helper.getMBeanHome() twice it works correct - either with the localhost statement and also with the otherhost statement. It crashes only for the second call when I call the getMBeanServer() method. Any hints what's wrong with this code?
    regards
    Oliver

    for security reason, applet can't do io unless your change the policy file, and grant the permssion to applet.

  • SecurityException when deploying to a cluster.Please help !

    Hi Guys,
              I am running a clustering scenario wherein i have an administration server and 2 managed servers(this forms the cluster). Admin server and 1 managed server is in one machine and the second managed server is in another machine.Node Manager is configured in both the machines.
              I am able to get a successful application deployment when i choose to deploy it partially to either of the manged servers in the cluster.But when i choose to deploy the application to the whole cluster i always get the following exception indicating that the run-as principal 'ProcessInjectorMessageBeanUser' is not a member of the current security realm.However, in the secuity realm that this domain is using,i can see this user listed in the Administration console.Any idea what could be wrong ?
              As i am beginner in weblogic clustering, Any help will be really appreciated.
              [Deployer:149033]preparing application COM-ORCH-expand-1.1 on grp-fred
              [Deployer:149033]preparing application COM-ORCH-expand-1.1 on new_managedServer_1
              [Deployer:149033]prepared application COM-ORCH-expand-1.1 on grp-fred
              [Deployer:149033]failed application COM-ORCH-expand-1.1 on new_managedServer_1
              [Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application COM-ORCH-expand-1.1 on TFFCluster.:
              Exception:weblogic.management.ApplicationException: prepare failed for ORCH-ejb-1.1.jar
              Module: ORCH-ejb-1.1.jar Error: Exception preparing module: EJBModule(ORCH-ejb-1.1.jar,status=NEW)
              Unable to deploy EJB: .\new_managedServer_1\stage\COM-ORCH-expand-1.1\ORCH-ejb-1.1.jar from ORCH-ejb-1.1.jar:
              weblogic.ejb20.WLDeploymentException: The run-as principal 'ProcessInjectorMessageBeanUser' for EJB 'com/OrchestratorMessageBean' is not a user in the current realm. The user must exist for the EJB to successfully deploy.
              at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.getRunAsPrincipal(MBeanDeploymentInfoImpl.java:1047)
              at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeRunAsSettings(MBeanDeploymentInfoImpl.java:838)
              at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:246)
              at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1262)
              at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:477)
              at weblogic.j2ee.J2EEApplicationContainer.prepareModule(J2EEApplicationContainer.java:2962)
              at weblogic.j2ee.J2EEApplicationContainer.prepareModules(J2EEApplicationContainer.java:1534)
              at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1188)
              at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContainer.java:1031)
              at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.prepareContainer(SlaveDeployer.java:2602)
              at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2552)
              at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2474)
              at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
              at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
              at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
              at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
              Cheers,
              Josh

    Can you post the config.xml from both boxes ?
              I think there may some mismatch in the Advanced Security Credentials on both domains.
              Dips

  • Help! java.lang.SecurityException

    Dear all,
    I am deploying my application to weblogic6.1 and got an exception as
    following:
    java.lang.SecurityException: No Permission to set the Configuration
    when i was trying to set the configuration class to be used during
    authentication:
    protected final void service(HttpServletRequest req,
    HttpServletResponse resp) throws ServletException, IOException
    hs = req.getSession(false);
    if (hs == null || hs.getValue("user.info") == null) {
    // Try to login to the application
    try {
    // Set the login configuration class to be used
    props.put("BUNDLE_MGR",
    (BundleManager)getServletContext).getAttribute("bundlemgr"));
    javax.security.auth.login.Configuration.setConfiguration(new
    MySecurityConfig(req, logWriter, props)); // Exception got right
    here...
    } catch(){}
    Where should i look at?
    Thanks in advance.
    Frank

    No, I searched the forum for jar and signed applets. The reason to sign your applet is to make sure
    nobody changes the classes of the signed jar.
    You just did that and that means re-signing the jar file. If you know a way to hack this than you just took
    away the reason for signing jars.
    What you should do is find out who signed the jar in the first place and use that keystore to resign the jar.
    Or if your clients don't mind the "do you trust" popup again or don't mind editing their policy files (again)
    than you can create a keystore and sign the jar with that keystore:
    javac ...
    keytool -genkey -keystore harm.com -keyalg rsa -dname "CN=Harm Meijer, OU=Technology, O=org, L=Amsterdam, ST=, C=NL" -alias harm -validity 3600 -keypass password -storepass password
    jar cf0 test.jar *.class
    jarsigner -keystore harm.com -storepass password -keypass password -signedjar sTest.jar test.jar harm
    del *.class

  • Exception created : flex.messaging.security.SecurityException

    Hi ,
    The message below keep appearing in the systemout.log file. Any idea?
    00002ca4 webcontainer  E com.ibm.ws.webcontainer.WebContainer handleRequest SRVE0255E: A WebGroup/Virtual Host to handle / has not been defined.
    00002ca4 servlet       E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet documents in application LiveCycleES2. Exception created : flex.messaging.security.SecurityException
        at com.adobe.workspace.users.Authentication.validateContext(Authentication.java:445)
        at com.adobe.workspace.tasks.DocumentServlet.doGet(DocumentServlet.java:166)
    00002ca4 webcontainer  E com.ibm.ws.webcontainer.WebContainer handleRequest SRVE0255E: A WebGroup/Virtual Host to handle / has not been defined.
    00002ca4 webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[documents]: com.ibm.ws.webcontainer.webapp.WebAppErrorReport: Method PROPFIND is not defined in RFC 2068 and is not supported by the Servlet API
        at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendError(WebAppDispatcherContext. java:637)
        at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendError(SRTServletResponse.java:1187)
    -Dhiyane

    Hello Nitin,
    i didnt say that its working fine with ATG REST. i mentioned that its working fine with 10.0.2 version of ATG but not with ATG10.1.1 . Also i am using SOAP only in both the versions. i am getting the boolean exception in the line where will i pass username, password and ispasswordEncrpted. i am passing defalut username,
    password and false(ispasswordencrypted).
    so can you help me on this.
    i am pasting my clinet program here
    public class LoginClient {
      * @param args
      * @throws RemoteException
      * @throws ServletException
      * @throws SecurityException
      * @throws ServiceException
      public static void main(String[] args) throws SecurityException, ServletException, RemoteException, ServiceException {
      /*System.getProperties().put("socksProxyHost", "172.26.183.65");
      System.getProperties().put("socksProxyPort", "8180");*/
      LoginUserSEIService loginService = new LoginUserSEIServiceLocator();
      LoginUserSEI loginStub = loginService.getLoginUserSEIPort();
      org.apache.axis.client.Stub axisStub = (org.apache.axis.client.Stub) loginStub;
      CookieContainer cookieContainer = new CookieContainer();
      axisStub.setMaintainSession(true);
      // Don't allow XML elements to reference other XML elements
      axisStub._setProperty(AxisEngine.PROP_DOMULTIREFS, new Boolean(false));
      // Push cookies onto the Stub
      cookieContainer.pushCookies(axisStub);
      String userId = loginStub.loginUser("[email protected]", " password", false);
      // Get cookies out of the Stub, and pass them to subsequent calls as needed
      cookieContainer.extractCookies(axisStub);
      System.out.println("User ID : " + userId);

  • Need Help With File Matching Records

    I need help with my file matching program.
    Here is how it suppose to work: FileMatch class should contain methods to read oldmast.txt and trans.txt. When a match occurs (i.e., records with the same account number appear in both the master file and the transaction file), add the dollar amount in the transaction record to the current balance in the master record, and write the "newmast.txt" record. (Assume that purchases are indicated by positive amounts in the transaction file and payments by negative amounts.)
    When there is a master record for a particular account, but no corresponding transaction record, merely write the master record to "newmast.txt". When there is a transaction record, but no corresponding master record, print to a log file the message "Unmatched transaction record for account number ..." (fill in the account number from the transaction record). The log file should be a text file named "log.txt".
    Here is my following program code:
    // Exercise 14.8: CreateTextFile.java
    // creates a text file
    import java.io.FileNotFoundException;
    import java.lang.SecurityException;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import org.egan.AccountRecord;
    import org.egan.TransactionRecord;
    public class CreateTextFile
      private Formatter output1;  // object used to output text to file
      private Formatter output2;  // object used to output text to file
      // enable user to open file
      public void openTransFile()
        try
          output1 = new Formatter("trans.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openTransFile
      // enable user to open file
      public void openOldMastFile()
        try
          output2 = new Formatter("oldmast.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openOldMastFile
      // add transaction records to file
      public void addTransactionRecords()
        // object to be written to file
        TransactionRecord record1 = new TransactionRecord();
        Scanner input1 = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
          "To terminate input, type the end-of-file indicator",   
          "when you are prompted to enter input.",
          "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
          "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s\n%s",
           "Enter account number (> 0) and amount.","? ");
        while (input1.hasNext())  // loop until end-of-file indicator
          try // output values to file
            // retrieve data to be output
            record1.setAccount(input1.nextInt());    // read account number
            record1.setAmount(input1.nextDouble());  // read amount
            if (record1.getAccount() > 0)
              // write new record
              output1.format("%d %.2f\n", record1.getAccount(), record1.getAmount());
            } // end if
            else
              System.out.println("Account number must be greater than 0.");
            } // end else
          } // end try
          catch (FormatterClosedException formatterClosedException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input1.nextLine(); // discard input so user can try again
          } // end catch
          System.out.printf("%s %s\n%s", "Enter account number (> 0) ",
            "and amount.","? ");
        } // end while
      } // end method addTransactionRecords
      // add account records to file
      public void addAccountRecords()
        // object to be written to file
        AccountRecord record2 = new AccountRecord();
        Scanner input2 = new Scanner(System.in);
        System.out.printf("%s\n%s\n%s\n%s\n\n",
          "To terminate input, type the end-of-file indicator",   
          "when you are prompted to enter input.",
          "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
          "On Windows type <ctrl> z then press Enter");
        System.out.printf("%s\n%s",
           "Enter account number (> 0), first name, last name and balance.","? ");
        while (input2.hasNext())  // loop until end-of-file indicator
          try // output values to file
            // retrieve data to be output
            record2.setAccount(input2.nextInt());    // read account number
            record2.setFirstName(input2.next());      // read first name
            record2.setLastName(input2.next());       // read last name
            record2.setBalance(input2.nextDouble());  // read balance
            if (record2.getAccount() > 0)
              // write new record
              output2.format("%d %s %s %.2f\n", record2.getAccount(), record2.getFirstName(),
                record2.getLastName(), record2.getBalance());
            } // end if
            else
              System.out.println("Account number must be greater than 0.");
            } // end else
          } // end try
          catch (FormatterClosedException formatterClosedException)
            System.err.println("Error writing to file.");
            return;
          } // end catch
          catch (NoSuchElementException elementException)
            System.err.println("Invalid input. Please try again.");
            input2.nextLine(); // discard input so user can try again
          } // end catch
          System.out.printf("%s %s\n%s", "Enter account number (> 0),",
            "first name, last name and balance.","? ");
        } // end while
      } // end method addAccountRecords
      // close file
      public void closeTransFile()
        if (output1 != null)
          output1.close();
      } // end method closeTransFile
      // close file
      public void closeOldMastFile()
        if (output2 != null)
          output2.close();
      } // end method closeOldMastFile
    } // end class CreateTextFile--------------------------------------------------------------------------------------------------
    // Exercise 14.8: CreateTextFileTest.java
    // Testing class CreateTextFile
    public class CreateTextFileTest
       // main method begins program execution
       public static void main( String args[] )
         CreateTextFile application = new CreateTextFile();
         application.openTransFile();
         application.addTransactionRecords();
         application.closeTransFile();
         application.openOldMastFile();
         application.addAccountRecords();
         application.closeOldMastFile();
       } // end main
    } // end class CreateTextFileTest-------------------------------------------------------------------------------------------------
    // Exercise 14.8: TransactionRecord.java
    // A class that represents on record of information
    package org.egan; // packaged for reuse
    public class TransactionRecord
      private int account;
      private double amount;
      // no-argument constructor calls other constructor with default values
      public TransactionRecord()
        this(0,0.0); // call two-argument constructor
      } // end no-argument AccountRecord constructor
      // initialize a record
      public TransactionRecord(int acct, double amt)
        setAccount(acct);
        setAmount(amt);
      } // end two-argument TransactionRecord constructor
      // set account number
      public void setAccount(int acct)
        account = acct;
      } // end method setAccount
      // get account number
      public int getAccount()
        return account;
      } // end method getAccount
      // set amount
      public void setAmount(double amt)
        amount = amt;
      } // end method setAmount
      // get amount
      public double getAmount()
        return amount;
      } // end method getAmount
    } // end class TransactionRecord -------------------------------------------------------------------------------------------------
    // Exercise 14.8: AccountRecord.java
    // A class that represents on record of information
    package org.egan; // packaged for reuse
    import org.egan.TransactionRecord;
    public class AccountRecord
      private int account;
      private String firstName;
      private String lastName;
      private double balance;
      // no-argument constructor calls other constructor with default values
      public AccountRecord()
        this(0,"","",0.0); // call four-argument constructor
      } // end no-argument AccountRecord constructor
      // initialize a record
      public AccountRecord(int acct, String first, String last, double bal)
        setAccount(acct);
        setFirstName(first);
        setLastName(last);
        setBalance(bal);
      } // end four-argument AccountRecord constructor
      // set account number
      public void setAccount(int acct)
        account = acct;
      } // end method setAccount
      // get account number
      public int getAccount()
        return account;
      } // end method getAccount
      // set first name
      public void setFirstName(String first)
        firstName = first;
      } // end method setFirstName
      // get first name
      public String getFirstName()
        return firstName;
      } // end method getFirstName
      // set last name
      public void setLastName(String last)
        lastName = last;
      } // end method setLastName
      // get last name
      public String getLastName()
        return lastName;
      } // end method getLastName
      // set balance
      public void setBalance(double bal)
        balance = bal;
      } // end method setBalance
      // get balance
      public double getBalance()
        return balance;
      } // end method getBalance
      // combine balance and amount
      public void combine(TransactionRecord record)
        balance = (getBalance() + record.getAmount()); 
      } // end method combine
    } // end class AccountRecord -------------------------------------------------------------------------------------------------
    // Exercise 14.8: FileMatch.java
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.lang.IllegalStateException;
    import java.util.NoSuchElementException;
    import java.util.Scanner;
    import java.util.Formatter;
    import java.util.FormatterClosedException;
    import org.egan.AccountRecord;
    import org.egan.TransactionRecord;
    public class FileMatch
      private Scanner inTransaction;
      private Scanner inOldMaster;
      private Formatter outNewMaster;
      private Formatter theLog;
      // enable user to open file
      public void openTransFile()
        try
          inTransaction = new Scanner(new File("trans.txt"));
        } // end try
        catch (FileNotFoundException fileNotFoundException)
          System.err.println("Error opening file.");
          System.exit(1);
        } // end catch
      } // end method openTransFile
      // enable user to open file
      public void openOldMastFile()
        try
          inOldMaster = new Scanner(new File("oldmast.txt"));
        } // end try
        catch (FileNotFoundException fileNotFoundException)
          System.err.println("Error opening file.");
          System.exit(1);
        } // end catch
      } // end method openOldMastFile
      // enable user to open file
      public void openNewMastFile()
        try
          outNewMaster = new Formatter("newmast.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openNewMastFile
      // enable user to open file
      public void openLogFile()
        try
          theLog = new Formatter("log.txt");
        catch (SecurityException securityException)
          System.err.println("You do not have write access to this file.");
          System.exit(1);
        } // end catch
        catch (FileNotFoundException filesNotFoundException)
          System.err.println("Error creating file.");
          System.exit(1);
      } // end method openLogFile
      // update records
      public void updateRecords()
        TransactionRecord transaction = new TransactionRecord();
        AccountRecord account = new AccountRecord();
        try // read records from file using Scanner object
          System.out.println("Start file matching.");
          while (inTransaction.hasNext() && inOldMaster.hasNext())
            transaction.setAccount(inTransaction.nextInt());     // read account number
            transaction.setAmount(inTransaction.nextDouble());   // read amount
            account.setAccount(inOldMaster.nextInt());     // read account number
            account.setFirstName(inOldMaster.next());      // read first name 
            account.setLastName(inOldMaster.next());       // read last name
            account.setBalance(inOldMaster.nextDouble());  // read balance
            if (transaction.getAccount() == account.getAccount())
              while (inTransaction.hasNext() && transaction.getAccount() == account.getAccount())
                account.combine(transaction);
                outNewMaster.format("%d %s %s %.2f\n",
                account.getAccount(), account.getFirstName(), account.getLastName(),
                account.getBalance());
                transaction.setAccount(inTransaction.nextInt());     // read account number
                transaction.setAmount(inTransaction.nextDouble());   // read amount
            else if (transaction.getAccount() != account.getAccount())
              outNewMaster.format("%d %s %s %.2f\n",
              account.getAccount(), account.getFirstName(), account.getLastName(),
              account.getBalance());         
              theLog.format("%s%d","Unmatched transaction record for account number ",transaction.getAccount());
          } // end while
          System.out.println("Finish file matching.");
        } // end try
        catch (NoSuchElementException elementException)
          System.err.println("File improperly formed.");
          inTransaction.close();
          inOldMaster.close();
          System.exit(1);
        } // end catch
        catch (IllegalStateException stateException)
          System.err.println("Error reading from file.");
          System.exit(1);
        } // end catch   
      } // end method updateRecords
      // close file and terminate application
      public void closeTransFile()
        if (inTransaction != null)
          inTransaction.close();
      } // end method closeTransFile
      // close file and terminate application
      public void closeOldMastFile()
        if (inOldMaster != null)
          inOldMaster.close();
      } // end method closeOldMastFile
      // close file
      public void closeNewMastFile()
        if (outNewMaster != null)
          outNewMaster.close();
      } // end method closeNewMastFile
      // close file
      public void closeLogFile()
        if (theLog != null)
          theLog.close();
      } // end method closeLogFile
    } // end class FileMatch-------------------------------------------------------------------------------------------------
    // Exercise 14.8: FileMatchTest.java
    // Testing class FileMatch
    public class FileMatchTest
       // main method begins program execution
       public static void main( String args[] )
         FileMatch application = new FileMatch();
         application.openTransFile();
         application.openOldMastFile();
         application.openNewMastFile();
         application.openLogFile();
         application.updateRecords();
         application.closeLogFile();
         application.closeNewMastFile();
         application.closeOldMastFile();
         application.closeTransFile();
       } // end main
    } // end class FileMatchTest-------------------------------------------------------------------------------------------------
    Sample data for master file:
    Master file                         
    Account Number            Name                     Balance
    100                            Alan Jones                   348.17
    300                            Mary Smith                    27.19
    500                            Sam Sharp                   0.00
    700                            Suzy Green                   -14.22Sample data for transaction file:
    Transaction file                    Transaction
    Account Number                  Amount
    100                                         27.14
    300                                         62.11
    300                                         83.89
    400                                         100.56
    700                                         80.78
    700                                         1.53
    900                                         82.17  -------------------------------------------------------------------------------------------------
    My FileMatch class program above has bugs in it.
    The correct results for the newmast.txt:
    100  Alan  Jones  375.31
    300  Mary  Smith  173.19
    500  Sam  Sharp  0.00
    700  Suzy Green  68.09The correct results for the log.txt:
    Unmatched transaction record for account number 400Unmatched transaction record for account number 900------------------------------------------------------------------------------------------------
    My results for the newmast.txt:
    100 Alan Jones 375.31
    300 Mary Smith 111.08
    500 Sam Sharp 0.00
    700 Suzy Green -12.69My results for the log.txt
    Unmatched transaction record for account number 700-------------------------------------------------------------------------------------------------
    I am not sure what is wrong with my code above to make my results different from the correct results.
    Much help is appreciated. Please help.

    From the output, it looks like one problem is just formatting -- apparently you're including a newline in log entries and not using tabs for the newmast output file.
    As to why the numbers are off -- just from glancing over it, it appears that the problem is when you add multiple transaction values. Since account.combine() is so simple, I suspect that you're either adding creating transaction objects incorrectly or not creating them when you should be.
    Create test input data that isolates a single case of this (e.g., just the Mary Smith case), and then running your program in a debugger or adding debugging code to the add/combine method, so you can see what's happening in detail.
    Also I'd recommend reconsidering your design. It's a red flag if a class has a name with "Create" in it. Classes represent bundles of independant state and transformations on that state, not things to do.

  • Help getting authentication=

    Greetings,
    I could use some help with getting tomcat 5.5.12 to use Kerberos against Microsoft Active Directory.
    I have been using Ethereal to sniff the packets going back and forth from tomcat and I verified that with a normal server.xml entry (remove the authentication attribute keyword below), it uses 'simple'
    authentication (clear text passwords).
    My original server.xml works just fine but now I'm trying to take it to next level and I found documentation (jdk-1_5_0-doc.zip\docs\guide\jndi\jndi-ldap.html)
    specifies that there are the following values:
    - EXTERNAL (RFC 2222). This mechanism obtains authentication information from an external source (such as SSL/TLS or IPsec).
    - DIGEST-MD5 (RFC 2831) is for Digest Authentication.
    - GSSAPI (RFC 2222) is for Kerberos V5 authentication.
    I wish to use GSSAPI to talk with Active Directory so I setup my server.xml with the following :
    <Realm className="org.apache.catalina.realm.JNDIRealm"
         debug="4"
         authentication="GSSAPI"
         connectionName="CN=Klotz\, Dennis,OU=myou,DC=company,DC=com"
         connectionPassword="myPassword"
         connectionURL="ldap://10.16.0.xx:389"
         alternateURL="ldap://10.16.0.xx:389"
         userBase="OU= myou,DC=company,DC=com"
         userSearch="(sAMAccountName={0})"
         userSubtree="true"
         userRoleName="memberOf"
    />And now I get a different type of error from Catalina.out:
    Oct 28, 2005 2:28:47 PM org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos Ticket)
            at
    sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredential
    .java:133)
    .....At least the GSSAPI is being recognized! My next step was talking with IT; they suggested a c:\winnt\krb5.ini with the following contents:
    [libdefaults]
    default_realm = COMPANY.COM
    default_tgs_enctypes = des-cbc-crc
    default_tkt_enctypes = des-cbc-crc
    [realms]
    COMPANY.COM = {
    kdc = addy.mycompany.com:88
    admin_server = addy. mycompany.com:88
    kpasswd_server = addy. mycompany.com:464 default_domain = COMPANY.COM }And that I then execute:
    $ kinit DKlotz
    Password for [email protected]:mypassword New ticket is stored in cache file C:\Documents and Settings\DKlotz\krb5cc_dklotzBut as you can see from the previous tomcat error log that something is still missing. Do I need to move the cache file or do other commands so that the code within ldap.jar can use it?
    At this time tomcat never tries connecting to the LDAP server as it can't get out of the starting gate. I've got something wrong / missing from the Kerberos setup.
    Any help is greatly appreciated!!
    -Dennis Klotz

    Ok I've made progress, whether it is backwards or not, I don't know yet.
    I've added :
    -Djavax.security.auth.useSubjectCredsOnly=false
    To my Catalina options environment variable in Catalina.bat.
    Now I get the error:
    WARNING: Exception performing authentication
    java.lang.SecurityException: Unable to locate a login configuration
         at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:97)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at javax.security.auth.login.Configuration$3.run(Configuration.java:216)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:210)
         at javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:403)
         at sun.security.jgss.LoginUtility.login(LoginUtility.java:72)
         at sun.security.jgss.krb5.Krb5Util.getTicketFromSubject(Krb5Util.java:137)
         at sun.security.jgss.krb5.Krb5InitCredential$1.run(Krb5InitCredential.java:331)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.security.jgss.krb5.Krb5InitCredential.getTgtFromSubject(Krb5InitCredential.java:328)
         at sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredential.java:131)
         at sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Krb5MechFactory.java:72)
         at sun.security.jgss.GSSManagerImpl.getCredentialElement(GSSManagerImpl.java:149)
         at sun.security.jgss.GSSCredentialImpl.add(GSSCredentialImpl.java:389)
         at sun.security.jgss.GSSCredentialImpl.<init>(GSSCredentialImpl.java:60)
         at sun.security.jgss.GSSCredentialImpl.<init>(GSSCredentialImpl.java:37)
         at sun.security.jgss.GSSManagerImpl.createCredential(GSSManagerImpl.java:96)
         at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:178)
         at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:158)
         at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:155)
         at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:105)
         at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214)
         at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2637)
         at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:283)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
         at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
         at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:197)
         at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:82)
         at org.apache.catalina.realm.JNDIRealm.open(JNDIRealm.java:1515)
         at org.apache.catalina.realm.JNDIRealm.start(JNDIRealm.java:1601)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1004)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
         at org.apache.catalina.core.StandardService.start(StandardService.java:450)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    Caused by: java.io.IOException: Unable to locate a login configuration
         at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:206)
         at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:95)
         ... 56 moreAm I moving in the right direction?
    -Dennis

  • Help with GSSAPI Kerberos in tomcat JNDIRealm

    Greetings,
    I could use some help with getting tomcat 5.5.12 to use Kerberos against Microsoft Active Directory.
    I have been using Ethereal to sniff the packets going back and forth from tomcat and I verified that with a normal server.xml entry (remove the authentication attribute keyword below), it uses 'simple'
    authentication (clear text passwords).
    My original server.xml works just fine but now I'm trying to take it to next level and I found documentation (jdk-1_5_0-doc.zip\docs\guide\jndi\jndi-ldap.html)
    specifies that there are the following values:
    - EXTERNAL (RFC 2222). This mechanism obtains authentication information from an external source (such as SSL/TLS or IPsec).
    - DIGEST-MD5 (RFC 2831) is for Digest Authentication.
    - GSSAPI (RFC 2222) is for Kerberos V5 authentication.
    I wish to use GSSAPI to talk with Active Directory so I setup my server.xml with the following :
    <Realm className="org.apache.catalina.realm.JNDIRealm"
         debug="4"
         authentication="GSSAPI"
         connectionName="CN=Klotz\, Dennis,OU=myou,DC=company,DC=com"
         connectionPassword="myPassword"
         connectionURL="ldap://10.16.0.xx:389"
         alternateURL="ldap://10.16.0.xx:389"
         userBase="OU= myou,DC=company,DC=com"
         userSearch="(sAMAccountName={0})"
         userSubtree="true"
         userRoleName="memberOf"
    />And now I get a different type of error from Catalina.out:
    Oct 28, 2005 2:28:47 PM org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos Ticket)
            at
    sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredential
    .java:133)
    .....At least the GSSAPI is being recognized! My next step was talking with IT; they suggested a c:\winnt\krb5.ini with the following contents:
    [libdefaults]
    default_realm = COMPANY.COM
    default_tgs_enctypes = des-cbc-crc
    default_tkt_enctypes = des-cbc-crc
    [realms]
    COMPANY.COM = {
    kdc = addy.mycompany.com:88
    admin_server = addy. mycompany.com:88
    kpasswd_server = addy. mycompany.com:464 default_domain = COMPANY.COM }And that I then execute:
    $ kinit DKlotz
    Password for [email protected]:mypassword New ticket is stored in cache file C:\Documents and Settings\DKlotz\krb5cc_dklotzBut as you can see from the previous tomcat error log that something is still missing. Do I need to move the cache file or do other commands so that the code within ldap.jar can use it?
    At this time tomcat never tries connecting to the LDAP server as it can't get out of the starting gate. I've got something wrong / missing from the Kerberos setup.
    Any help is greatly appreciated!!
    -Dennis Klotz

    Ok I've made progress, whether it is backwards or not, I don't know yet.
    I've added :
    -Djavax.security.auth.useSubjectCredsOnly=false
    To my Catalina options environment variable in Catalina.bat.
    Now I get the error:
    WARNING: Exception performing authentication
    java.lang.SecurityException: Unable to locate a login configuration
         at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:97)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at javax.security.auth.login.Configuration$3.run(Configuration.java:216)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.login.Configuration.getConfiguration(Configuration.java:210)
         at javax.security.auth.login.LoginContext$1.run(LoginContext.java:237)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.login.LoginContext.init(LoginContext.java:234)
         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:403)
         at sun.security.jgss.LoginUtility.login(LoginUtility.java:72)
         at sun.security.jgss.krb5.Krb5Util.getTicketFromSubject(Krb5Util.java:137)
         at sun.security.jgss.krb5.Krb5InitCredential$1.run(Krb5InitCredential.java:331)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.security.jgss.krb5.Krb5InitCredential.getTgtFromSubject(Krb5InitCredential.java:328)
         at sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredential.java:131)
         at sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Krb5MechFactory.java:72)
         at sun.security.jgss.GSSManagerImpl.getCredentialElement(GSSManagerImpl.java:149)
         at sun.security.jgss.GSSCredentialImpl.add(GSSCredentialImpl.java:389)
         at sun.security.jgss.GSSCredentialImpl.<init>(GSSCredentialImpl.java:60)
         at sun.security.jgss.GSSCredentialImpl.<init>(GSSCredentialImpl.java:37)
         at sun.security.jgss.GSSManagerImpl.createCredential(GSSManagerImpl.java:96)
         at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:178)
         at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:158)
         at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:155)
         at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:105)
         at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214)
         at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2637)
         at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:283)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
         at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
         at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:197)
         at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:82)
         at org.apache.catalina.realm.JNDIRealm.open(JNDIRealm.java:1515)
         at org.apache.catalina.realm.JNDIRealm.start(JNDIRealm.java:1601)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1004)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
         at org.apache.catalina.core.StandardService.start(StandardService.java:450)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    Caused by: java.io.IOException: Unable to locate a login configuration
         at com.sun.security.auth.login.ConfigFile.init(ConfigFile.java:206)
         at com.sun.security.auth.login.ConfigFile.<init>(ConfigFile.java:95)
         ... 56 moreAm I moving in the right direction?
    -Dennis

  • Help needed in Logging

    Hi,
    I have created a custom logging Handler and configured the same in the properties file. This handler has its own Formatter and Filter. When I iterate through the LogManager and print the available Handlers I get a NullPointerException when it prints the Formatter assoicated with the Custom Handler.
    Properties File
    com.test.logging.CustomHandler.pattern = %h/java%u.log
    com.test.logging.CustomHandler.formatter = com.sabre.logging.CustomFormatter
    com.test.logging.CustomHandler.filter = com.sabre.logging.CustomFilter
    com.test.logging.CustomHandler.level = INFO
    CustomFormatter class is in the right package.
    Iterator Code..
    for (;loggerNames.hasMoreElements();) {
                   String loggerName = loggerNames.nextElement();
                   System.out.println("Logger Name is : "+ loggerName);
                   Logger logger = Logger.getLogger(loggerName);
                   Handler[] handlers = logger.getHandlers();
                   logger.setUseParentHandlers(false);
                   for(int i=0;i<handlers.length;i++){
                        System.out.println("Handler : "+handlers.toString());
                        System.out.println("Pattern :" +handlers[i].getEncoding());
                        System.out.println("Level : "+ handlers[i].getLevel().getName());
                        // Filter cannot be printed. Donno the Reason
                        if(handlers[i].getFilter()!=null)
                             System.out.println("Filter : "+ handlers[i].getFilter().toString());
                        System.out.println("Formatter : "+ handlers[i].getFormatter().toString());
                   }// End For Loop
              } // End Outer For Loop
    I donno what is wrong with this.. Help me in resolving this..
    Thanks in advance

    public static void main(String[] args) throws SecurityException, FileNotFoundException, IOException {
              LogManager logManager = LogManager.getLogManager();
              logManager.readConfiguration(new FileInputStream("logging.properties"));
              Enumeration<String> loggerNames = logManager.getLoggerNames();
              for (;loggerNames.hasMoreElements();) {
                   String loggerName = loggerNames.nextElement();
                   Logger logger = Logger.getLogger(loggerName);
                   Handler[] handlers = logger.getHandlers();
                   for(int i=0;i<handlers.length;i++){
                        System.out.println("Handler : "+handlers.toString());
                        System.out.println("Level : "+ handlers[i].getLevel().getName());
                        System.out.println("Filter : "+ handlers[i].getFilter().toString());
                        System.out.println("Formatter : "+ handlers[i].getFormatter().toString());
                   }// End For Loop
              } // End Outer For Loop
         } // End Main
    Here it is...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help Please !!! Authentication error while starting managed server

    Hi everyone,
    is there anyone to help me in avoiding the SecurityException while starting managed
    server in a cluster. Weblogic version is 6.1.
    I have started the admin server in a cluster and is running fine. Also cluster
    is started successfully.
    When I start managed server appManaged (which is also included in the cluster),
    I get the following error:
    Starting WebLogic Server ....
    Connecting to http://appadmn:7001...
    <Nov 20, 2003 11:05:56 AM EST> <Error> <Configuration Management> <Error connect
    ing to admin server and initializing admin home: admin URL: t3://appadmin:7001
    javax.naming.AuthenticationException. Root exception is java.lang.SecurityExcep
    tion: attempting to add an object which is not an instance of java.security.Prin
    cipal to a Subject's Principal Set
    at javax.security.auth.Subject$SecureSet.add(Subject.java:1098)
    at weblogic.common.internal.BootServicesStub.writeUserInfoToSubject(Boot
    ServicesStub.java:72)
    at weblogic.common.internal.BootServicesStub.authenticate(BootServicesSt
    ub.java:80)
    at weblogic.security.acl.internal.Security.authenticate(Security.java:10
    8)
    at weblogic.jndi.WLInitialContextFactoryDelegate.pushUser(WLInitialConte
    xtFactoryDelegate.java:461)
    at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialCon
    textFactoryDelegate.java:316)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
    tialContextFactoryDelegate.java:288)
    at weblogic.jndi.Environment.getContext(Environment.java:155)
    at weblogic.jndi.Environment.getInitialContext(Environment.java:138)
    at weblogic.management.Admin.initializeRemoteAdminHome(Admin.java:951)
    The start script for managed server appManaged is :
    %JAVA_HOME%\bin\java -hotspot -ms64m -ms64m -classpath %CLASSPATH% -Dweblogic.Domain=mydomain
    -Dweblogic.management.server=appadmin:7001 -Dweblogic.Name=appManaged -Dbea.home=%BEA_HOME%
    -Dweblogic.management.username=system -Dweblogic.management.password=weblogic
    -Dweblogic.ProductionModeEnabled=%STARTMODE% -Djava.security.auth.login.config==%
    BEA_HOME%\wlserver6.1\lib\compat.config -Djava.security.policy==%BEA_HOME%\wlserver6.1\lib\weblogic.policy
    -Dweblogic.management.discover=false weblogic.Server
    thanks.

    I could see calling to setDomainEnv.cmd script:
    *@REM Call setDomainEnv here.*
    set DOMAIN_HOME=D:\Perforce\weblogic1\dev\src_crmod\wls\mytest
    for %%i in ("%DOMAIN_HOME%") do set DOMAIN_HOME=%%~fsi
    call "%DOMAIN_HOME%\bin\setDomainEnv.cmd" %*
    set SAVE_JAVA_OPTIONS=%JAVA_OPTIONS%
    set SAVE_CLASSPATH=%CLASSPATH%
    But in my environment I do not see these variable set to any, JAVA_HOME, DERBY_CLASSPATH, JAVA_OPTIONS, CLASS_PATH.
    This might be the issue? Or anything else?

  • SecurityException (how to change the group's definition)

    I have actually a big problem, I could not start my server weblogic.
    I have created a group CCFFGroup and then I made a very big mistake. I
    put the Administrators group under this group :(
    Now I get the following error when starting the server weblogic:
    java.lang.SecurityException: Authentication for user root denied
    at weblogic.security.service.SecurityServiceManager.doBootAuthorization(SecurityServiceManager.java:1028)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:1166)
    at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:697)
    at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:589)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:277)
    at weblogic.Server.main(Server.java:32)
    >
    The big problem is that I could not reinstall the weblogic server.
    Does anyone have an idea where the group are defined and how to
    configure it (Of course I do not have anymore access to the console
    webpage) ? Maybe we can delete the group's definition ?
    Thanx for your help,
    tiggy

    Technically No the system will not allow you to change as it is involved with many depreciation areas and change is not permitted for control reason.
    You only need to retire the asset, reverse the postings, assign correctly and repost the values.

  • Java.lang.SecurityException: while starting weblogic server

    Hi,
    I added a admin server on m/c 1 and a remote managed server on m/c 2. When i tried to start the admin server and the managed server and ping it using jmx, it get the following security error:
    Any help regd. this would be appreciated.
    Thanks,
    beauser2005
    <Oct 29, 2004 2:14:38 PM PDT> <Warning> <RMI> <BEA-080003> <RuntimeException thrown by rmi server: weblogic.rmi.internal.BasicServerRef@10c - hostID: '-833462563406253632S:172.20.30.37:[7001,7001,-1,-1,7001,-1,-1,0,0]:mydomain10:myserver10', oid: '268', implementation: 'weblogic.management.internal.RemoteMBeanServerImpl@191f022'
    java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators].
    java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[weblogic, Administrators]
         at weblogic.security.service.SecurityServiceManager.seal(SecurityServiceManager.java:680)
         at weblogic.rjvm.MsgAbbrevInputStream.getSubject(MsgAbbrevInputStream.java:187)
         at weblogic.rmi.internal.BasicServerRef.acceptRequest(BasicServerRef.java:827)
         at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:300)
         at weblogic.rjvm.RJVMImpl.dispatchRequest(RJVMImpl.java:996)
         at weblogic.rjvm.RJVMImpl.dispatch(RJVMImpl.java:917)
         at weblogic.rjvm.ConnectionManagerServer.handleRJVM(ConnectionManagerServer.java:225)
         at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:794)
         at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:742)
         at weblogic.socket.NTSocketMuxer.processSockets(NTSocketMuxer.java:105)
         at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

    was able to solve this
    there was corruption of reports config file

  • Urgent Help with bytes

    Hi people, I'm in urgent need of help for a project I'm working on for my degree.
    Background: I am writing a package that will allow connectivity to a c++ server via streaming sockets. The c++ server sends/receives data as unsigned bytes. This is my problem as Java does not have unsigned bytes. The ideal would be to maintain it in the unsigned byte format as the form of any data passing through is unknown.
    I have currently implemented this using the channels and byteBuffers in 1.4. The reason for this was so that I could illiminate the BigEndian to LittleEndian problem. However I can't use them to write unsinged bytes that will be readable to the server. I'm guessing that I can change the unsigned bytes recieved into shorts but it's not great.
    Does anyone have any ideas or experience with this??

    I don't know if this helps...but I use the following method (with security manager removed) to download a binary file from anywhere on the net with no problem:
       public String aok_DownLoad(String inputFile, String outputFile) {
          try
             URL url=new URL(inputFile);
             InputStream in;
             URLConnection connection=url.openConnection();
             in=connection.getInputStream();
             BufferedInputStream reader=new BufferedInputStream(in,4096);
             FileOutputStream out=new FileOutputStream(outputFile);
             BufferedOutputStream writer=new BufferedOutputStream(out,4096);
             byte[] buf=new byte[4096];
             int byteRead;
             while ((byteRead=reader.read(buf,0,4096))>=0) {writer.write(buf,0,byteRead);}
             reader.close();
             writer.flush();
             writer.close();
             return "1";
          catch (SecurityException exception) {
             exception.printStackTrace();
          catch (Throwable exception) {
             exception.printStackTrace();
       }V.V.

  • Sockets in rmi, help needed

    hi,
    I need a help on using sockets in rmi for communication between the server and the client. I am trying to establish a communication between the server and client through sockets after the remote method call is invoked but before it is fulfilled. I my code the socket is not establishing in the client side. Do help me out at the earliest pls... thanks in advance..

    I am trying to use sockets inside a rmi. Still i have the problem. I cant get my client listen from the server.
    First the client invokes a remote object. Before server sending the actual request of the requested by the remote object i want to make some communication between the server and client through sockets.
    I created a ServerSocket in the client side. The problem I have is the ServerSocket is not listening to the server request.
    Here i ve my code.I cant figure out what mistake i have done. It also dont show any error. As i am new to RMI and sockets i am in need of help. So pls do help me... Thanks in advance.
    In my example i am trying to verify the password before the server downloads the file for the client. So i want the verification done through sockets and download file using RMI.
    FileInterface.java
    import java.rmi.*;
    public interface FileInterface extends Remote
    public byte[] downloadFile(String fileName) throws RemoteException;
    FileServer.java
    import java.rmi.*;
    import java.io.*;
    public class FileServer
    public static void main(String []args)
      if(System.getSecurityManager()==null)
       System.setSecurityManager(new RMISecurityManager());
      try
       FileImpl fi=new FileImpl("FileServer");
       Naming.rebind("FileServer",fi);
         System.out.println("Server bound"+fi);
      catch(Exception e)
       System.out.println("FileServer: "+e.getMessage());
    FileImpl.java
    import java.io.*;
    import java.net.*;
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    public class FileImpl extends UnicastRemoteObject implements FileInterface
    private String name;
    public FileImpl(String s) throws RemoteException
      super();
      name=s;
    public byte[] downloadFile(String fileName)
      try
       Socket soc=new Socket(RemoteServer.getClientHost(),5000);
       OutputStream os=soc.getOutputStream();
       PrintStream ps=new PrintStream(os);
         System.out.println("Going to send message");
       ps.println("Enter the password : ");
         System.out.println("Sent message");
       InputStream is=soc.getInputStream();
       InputStreamReader isr=new InputStreamReader(is);
       BufferedReader br=new BufferedReader(isr);
       String res=br.readLine();
       PasswordControl pc=new PasswordControl(res,br);
       System.setSecurityManager(pc);
       File file=new File(fileName);
       byte [] buffer=new byte[(int)file.length()];
       BufferedInputStream input=new BufferedInputStream(new FileInputStream(fileName));
       input.read(buffer,0,buffer.length);
       input.close();
       return(buffer);
      catch(Exception e)
       System.out.println("FileImpl: "+e.getMessage());
       e.printStackTrace();
       return(null);
    public class PasswordControl extends SecurityManager
    String password;
    BufferedReader br;
    public PasswordControl(String password,BufferedReader br)
      this.password=password;
      this.br=br;
    public boolean accessOk()
      String response = "";
      try
       if(response.equals(password))
        return true;
       else
        return false;
      catch(Exception e)
       return false;
    public void checkRead(String fname)
      if(fname.equals("sample.txt"))
       if(!accessOk())
        super.checkRead(fname);
        throw new SecurityException("Access denied to read from the file sample.txt");
       else
        FilePermission fp=new FilePermission(fname,"read");
        checkPermission(fp);
    FileClient.java
    import java.io.*;
    import java.net.*;
    import java.rmi.*;
    public class FileClient  implements Runnable {
         Socket soc;
         String filename;
         byte[] filedata;
         public FileClient(String filename, String host)
         this.filename = filename;
         try
             ServerSocket ss=new ServerSocket(5000);
          System.out.println("Created a socket"+ss);
             String name = "//" + host + "/FileServer";
             FileInterface fi = (FileInterface) Naming.lookup(name);
          System.out.println("Got the interface "+fi);
             while(true)
           soc=ss.accept();
           new Thread(this).start();
            } catch(Exception e)
              e.printStackTrace();
           public static void main(String argv[]) {
            if(argv.length != 2) {
            System.out.println("Usage: java FileClient fileName machineName");
            System.exit(0);
         new FileClient(argv[0], argv[1]);
         public void run() {
         try {
         System.out.println(soc);
          InputStream is=soc.getInputStream();
          InputStreamReader isr=new InputStreamReader(is);
             BufferedReader br=new BufferedReader(isr);
         System.out.println("Created the readers"+br);
             String req=br.readLine();
          System.out.println("Going to print request");
          System.out.println(req);
          String password=br.readLine();
             OutputStream os=soc.getOutputStream();
          PrintStream ps=new PrintStream(os);
          ps.println(password);
             filedata = fi.downloadFile(filename);
             File file = new File(filename);
             BufferedOutputStream output = new
               BufferedOutputStream(new FileOutputStream(file.getName()));
             output.write(filedata,0,filedata.length);
             output.flush();
             output.close();
         } catch(Exception e) {
              e.printStackTrace();
    }

Maybe you are looking for

  • JDBC--XI---ABAP Proxy

    Dear Experts, I have a scenario from DB system I am given a stored procedure that gives me the contents for creating sales orders in SAP ECC system. Now I have written a ABAP proxy code, internally I have used BAPI for sales order creation,  the sale

  • BITMAP CONVERSION TO ROWIDS

    This is the plan used for my query in my prod database. 10.2.0.3 In dev same oracle version, the plan is not doing bitmap conversion. prod query time: 4minutes dev query time:20 seconds how can i tell oracle to stop bitmap conversing on me? BTW, i ha

  • Cannot open itunes  errorn2096 right clicked on quicktime player went to properties no compatibly tab

    cannot open itunes  errorn2096 right clicked on quicktime player went to properties no compatibly tab

  • Lightroom isn't available in the cc downloads.

    I've tried to access it directly from the site and it takes my back to the CC app but it's not listed.  I've tried the all apps filter as well as every other one.  Where can I can go to get it back?  I just switched to a new workstation and it's gone

  • Exporting test data in OTM

    Hello, I have created some test datas (req.s,tests etc) in my OTM.Suppose if I am reinstalling OATS,how can i get this test data in the new OTM.Can i export this test data to some .csv(windows) format,so that i can use by importing in to OTM. Can any