Java Junk

For almost a week now I have been struggling to get my Powerbook G4 (Aluminum) running Tiger OSX 4.10 to run properly afgter a fatal crash that required running a complete clean reinstall.
It's difficult to remember where it all started. I first noticed problems about 2 months ago when I tried to use an iSweet cam with iChat. I got no video output, and since a different camera worked, I eventually decided it was a compatibility issue with the 4.10 upgrade I had recently installed, so I wanted to go back to 4.7. I did an archived reinstall, and things worked fairly well...except I was unable to download new files from the internet, especially using software updater. Once things stablised a bit I thought I would try to put 4.10 back on...but it wouldn't download. Some "codex" error...or "version not signed by Apple"...even though I always go through the Apple download site for my upgrades.
So, for several weeks I continued to try to patch things together, but I never did really get it running smoothly again. Then 5 days ago, all **** broke loose. I was running 10.4.10 with Firefox (the browser I have been using) and I went to a sight I have been to often (Yahoo! Bridge) and repeatedly was unable to log on. The browser would freeze, such that I would have to "force quit" it everytime it got to this one point where you have to click past the advertisement. I notices a progress message about JS2E 5.yimg.
I tried several things. Including reinstalling java (threw away receipts). I tried running "Disk Warrior" (a maintenance software that has always worked well in the past) and it got to this point in the scan where it said "overlapping files found" and then refused to budge. I even tried restarting it...nothing. I took it out and tried running the computer...(Blue screen with progress bar making no progress). That's when I decided I had no choice but to run a clean install.
That went fine. So, the first thing I did was upgrade all the OS things first. It didn't progress smoothly, but I did eventually get them on. The camera works in iChat but I couldn't for the life of me get ANY browser to open the Yahoo! Bridge site. I even tried using an alternate ID. So I decided the problem must be systemic. I threw away all things java, and ran system updater to reinstall all things java. Again, not smooth, but I got it all on...restarting after each install. And now I'm faced with the damnedest thing...I have never seen such a thing.
My HD icon is just a grey box on the desktop (no stethoscope or anything). When I open any folder, the icons for the files are there, but as soon as I select on, it disappears, never to return. The dock icons are there, and in all other ways the computer seems to be running ok. I tried restarting and running the disk utility (and Disk Warrior), but neither of those things helped.
Does anyone know how to get my icons back? And...is it indicative of a deeper problem? Apple just changed out this logic board a year ago.

Thank-you HenryG4.
Your post at http://discussions.apple.com/message.jspa?messageID=4484998
resolved my issue.
Others also addressed this int heir posts. It seems to be a .ds_store issue with 10.4.10

Similar Messages

  • SQL Insert Error - Please help. RESOLVED

    I have a page with several VOs and search options. One of the search options is a list of Emp IDs which (when one is selected and user clicks 'search') results in an editable table of profiles for that Emp Id.
    I have in the Footer of the results table an input field and a button 'add' bound to a method that takes two params and inserts a 'new' profile for the searched Emp Id and the value entered in the input field.
    When I enter a value and click 'add' I get the following:
    JBO-29000: Unexpected exception caught: oracle.jbo.DMLConstraintException, msg=JBO-26048: Constraint "BADGE_ACCESS_EMP_FK" violated during post operation:"Insert" using SQL Statement "BEGIN INSERT INTO BADGE_ACCESS(EMPLOYEE_ID,BADGE,ROW_ID) VALUES (?,?,?) RETURNING ROW_ID INTO ?; END;".
    JBO-26048: Constraint "BADGE_ACCESS_EMP_FK" violated during post operation:"Insert" using SQL Statement "BEGIN INSERT INTO BADGE_ACCESS(EMPLOYEE_ID,BADGE,ROW_ID) VALUES (?,?,?) RETURNING ROW_ID INTO ?; END;".
    ORA-02291: integrity constraint (HR.BADGE_ACCESS_EMP_FK) violated - parent key not found ORA-06512: at line 1
    My Emp table is simple - just an ID, First and Last names with ID as PK. My profile table (called Badge_Access) has the EmpId as FK and it's own PK set by a DBSequence. The other column in Badge_Access is for the input value (number).
    I do not know how to debug in JDeveloper such that I can see the values that are being passed to the method. My 'add' button method is:
    public void createBadgeAccess(Number empId, Number badge) {
    BadgeAccessImpl ba = (BadgeAccessImpl)getDBTransaction().createEntityInstance(BadgeAccessImpl.getDefinitionObject(), null);
    ba.setEmployeeId(empId);
    ba.setBadge(badge);
    getDBTransaction().commit();
    I have the 'value' of the empId param = ${bindings.AccessByEmployeeEmployeeId.inputValue}
    This is the selectOneChoice field the user uses to search...
    and the 'value' of the badge param = ${bindings.Badge.inputValue}
    This is the input field the user fills in before clicking 'add'...
    The values I think I am passing are empId=106 and badge=102 - both are valid & the 'parent key' 106 is valid...
    any help will be greatly appreciated!!! Thanks
    Ginni
    Message was edited by:
    ginnim
    I found a Tip that described what was happening.

    Wrap some try/catch around the statements instead of trying to decipher the Java junk. Could be a problem in the PS, could be a number of things. At least figure where in the application the error takes place.

  • Access properties outside executable jar

    OK I have spent long and hard trying to figure out this jar system. I even created my little junk test
    See executable http://homepage.ntlworld.com/jeff.burden/paulb/java/junk.jar (source code is in junk.jar)
    My problem is this
    /pjb/deployed/prog/program.jar
    /pjb/deployed/prog/
    /pjb/deployed/prog/res/test.jar
    /pjb/deployed/prog/props/mainConfig.propertiesmyprogram.jar has the following in manifest
    "class-path: res/ props/" test.jar contains
    pjb/apps/progsub/res/myfirst.class
    pjb/apps/progsub/res/myfirstConfig.properties
    the program.jar can read the mainConfig.properties, but it cant read the test.jar's myfirstConfig.properties
        private static String getResource(String fc, String key, Locale  lc) {
                String out = java.util.ResourceBundle.getBundle(fc,lc).getString(key);
                return out;       
        String moduleName = getResource("pjb.apps.progsub.res.myfirstConfig","greeting",eng);myfirstConfig.properties contains
    greeting=Hi from inside a Jar
    I dont want to add test.jar to the class-path as I want to add more jar files
    What am i doing wrong? I thought if i specifiy a directory in the classpath it will pick up all the resources in it.

    The program works when it is not in a deployed environment. That is
    When im developying in NetBeans I mount the directories required for the sourcode to run
    Everything works fine.
    But when i try and delopy the stuff as described above, i get them anoying
    MissingResourceException Can't find bundle for base name pjb.apps.progsub.res.myfirstConfig, locale en

  • Fastest Way to Load Text Files Containing Thousands of Words

    Hi, can anyone give me suggestions for fast loading of files containing many bytes in the form of a single word on a different line. The average file size is 45 kb. I'm currently splitting the words into separate files each containing 4000 words a piece. I use a different thread to read each file and then add all of the words into a single vector, formed by joining the vectors of each reader thread. Any suggestions for speeding up the process? (Currently, it takes about 30 seconds to load 52,000 words). My OS is Windows2000

    Something seems wrong. There is no way that what you describe should take anywhere close to that amount of time, unless the computer is a constraint. I created a file of 56,000 lines, each line consisted of the byte string "abcdefgh" plus a \r\n,
    for a total of 10 bytes per line - a total file size of 560,000 bytes (547 kb)
    The following program read the file, created an ArrayList, and added the 56,000 lines to the list in less than 1 second, about what I expected. You might want to run it and see what you get.
    import java.io.*;
    import java.util.*;
    class Zxin
        public static void main(String[] args)
            throws IOException
            FileInputStream fis = new FileInputStream(
                "C:/Documents and Settings/Chuck/My Documents/Java/junk/word.txt");
            InputStreamReader isr = new InputStreamReader(fis);
            BufferedReader br = new BufferedReader(isr);
            List<String> list = new ArrayList<String>();
            String data;
            while ((data = br.readLine()) != null)
                list.add(data);
            System.out.println("The list contains " + list.size() + " entries");
            System.out.println("The first entry in the list is: " + list.get(0));
            br.close();
    }It printed these 2 lines:
    The list contains 56000 entries
    The first entry in the list is: abcdefgh

  • Junk characters in java

    Hi,
    How to block the junk characters in java when csv file uploading.
    Thanks

    Not possible. You can only do it during processing the upload at the server side. If you also don´t know how to do that, then you need to be more specific about the problem before I could give an extended answer. For instance, you should elaborate "junk" here. At least, are you familiar with character encodings and the sense of it?

  • Cannot convert ÿØÿà of type class java.lang.String to class BFileDomain.

    Hi All,
    I am using Jdeveloper 11.1.2.3.0.
    I have a scenario of making an ADF page where I have a IMAGE field to show on the page. So,I have a table called "PRODUCT" with fields called photo with BFILE type. Now when I the data i have inserted using the DML command and i can see the path at the backend.
    However,when i am runnig my ADF page in the Filed called "PHOTO" I can only see a junk character stating 'yoyo'.
    When I click on it, it says ERROR "Cannot convert ÿØÿà of type class java.lang.String to class oracle.jbo.domain.BFileDomain".
    Your help will be appreciated ASAP.
    Regards,
    Shahnawaz

    Hi,
    did you show the id-value in the user interface as a input-component, and did the input-component include a converter?
    If yes, show the id as output-text and remove any existing converter-components.
    Best Regards

  • Need help on returning arrays from C++ to Java

    Hi all, I hava a C++ application that contains a method that will return a float array to Java. I was able to write the Java Code, the JNI code to call the C++ method and compile them successfully. However on calling the native method from Java, the data in the array returned was not what I want. Please look through my code and see what is wrong with it.
    My Java Code:
    public native float[] Statistics(int inputKey); // This is the native method
    public float[] Stats(int k){ //Java method to call the native method so that I can use it in a Bean for a JSP.
    inputKey = k;
    float[] p = new float[4];
    p = Statistics(inputKey);
    return p;
    For this native method, an integer is passed from Java to the native side and the native method will use this integer to generate a float array size of 4 and populate it with data and return it back to Java.
    My JNI code
    extern "C"
    JNIEXPORT jfloatArray JNICALL
    Java_com_jspsmart_upload_FinalWaterMark_Statistics(JNIEnv *env, jobject obj, jint inputKey)
         jfloatArray floatArray = env->NewFloatArray(4); //This creates a new Java floatArray to store the C++ array
         CWatermarker2App p; // This is the C++ class to be used
         jfloat *stats = p.OnWatermarkStatistics(inputKey) // The C++ method returns a float pointer for an array of size 4
         env->SetFloatArrayRegion(floatArray, 0 , 4 , stats); //storing the C++ float array into the Java float Array
         return floatArray; // return the Array to Java
    In this example, I should have the data returned as [4952.0 2529.0 1706.0 33.6] in the array.
    But i am getting junk instead like 2.53E-23, 1.402E-15 etc..
    Is this a type conversion mistake?
    Please help!

    The first thing I notice - probably not the problem - is the line defining p. There is no reason to define this as an array of size 4, because the return from the native method is going to wipe that definition, replacing it with the return value of the native method. Alternatives:
    1. float[] p = null.
    2. float[] p = Statistics(inputKey);
    3. return Statistics(k);

  • James Send to Junk Mail

    Hello , i am using james 2.2.0 installed on a server with a online DNS , it recives mails properly , but when i try to send emails ( also when using Authenticated SMTP) , mail go to junk mails ( as hotmail and yahoo) , When i use Outlook express outside the server to send mail i get the following error :
    The message could not be sent because one of the recipients was rejected by the server. The rejected e-mail address was '[email protected]'. Subject 'hahahhaha', Account: 'mytrans-port.com', Server: 'mytrans-port.com', Protocol: SMTP, Server Response: '550 - Requested action not taken: relaying denied', Port: 25, Secure(SSL): No, Server Error: 550, Error Number: 0x800CCC79
    here is my config.xml , Thanks
    <?xml version="1.0"?>
    <!DOCTYPE config [
    <!ENTITY listserverConfig SYSTEM "../conf/james-listmanager.xml">
    <!ENTITY listserverStores SYSTEM "../conf/james-liststores.xml">
    <!ENTITY fetchmailConfig SYSTEM "../conf/james-fetchmail.xml">
    ]>
    <!--  Configuration file for the ASF James server -->
    <!--  This file contains important settings that control the behaviour -->
    <!--  of all of the services and repositories. -->
    <!--                               README!                            -->
    <!-- This configuration file is designed to run without alteration for simple tests. -->
    <!-- It assumes you have a DNS server on localhost and assigns a root password of root. -->
    <!-- In case the defaults do not suit you, the items you are most likely to need to change -->
    <!-- are preceded by a CHECKME! or CONFIRM? comment in the left margin. -->
    <!-- For production use you will probably need to make more extensive changes, see -->
    <!-- http://james.apache.org/documentation_2_1.html -->
    <!-- $Revision: 1.40.2.26 $ Committed on $Date: 2004/06/16 02:42:08 $ by: $Author: noel $ -->
    <config>
       <James>
    <!-- CHECKME! -->
          <!-- This is the postmaster email address for this mail server. -->
          <!-- Set this to the appropriate email address for error reports -->
          <!-- If this is set to a non-local email address, the mail server -->
          <!-- will still function, but will generate a warning on startup. -->
          <postmaster>Postmaster@localhost</postmaster>
          <!-- servernames identifies the DNS namespace served by this instance of James. -->
          <!-- These servernames are used for both matcher/mailet processing and SMTP auth -->
          <!-- to determine when a mail is intended for local delivery. -->
          <!-- -->
          <!-- If autodetect is TRUE, James wil attempt to discover its own host name AND -->
          <!-- use any explicitly specified servernames. -->
          <!-- If autodetect is FALSE, James will use only the specified servernames. -->
          <!-- -->
          <!-- If autodetectIP is not FALSE, James will also allow add the IP address for each servername. -->
          <!-- The automatic IP detection is to support RFC 2821, Sec 4.1.3, address literals. -->
          <!-- -->
          <!-- To override autodetected server names simply add explicit servername elements. -->
          <!-- In most cases this will be necessary. -->
          <!-- By default, the servername 'localhost' is specified. This can be removed, if required. -->
          <!-- -->
          <!-- Warning: If you are using fetchpop it is important to include the -->
          <!-- fetched domains in the server name list to prevent looping.       -->
          <servernames autodetect="true" autodetectIP="true">
    <!-- CONFIRM? -->
             <servername>mytrans-port.com</servername>
          </servernames>
          <!-- Set whether user names are case sensitive or case insensitive -->
          <!-- Set whether to enable local aliases -->
          <!-- Set whether to enable forwarding -->
          <usernames ignoreCase="true" enableAliases="true" enableForwarding="true"/>
          <!-- The inbox repository is the location for users inboxes -->
          <!-- Default setting: file based repository - enter path ( use  "file:///" for absolute) -->
          <inboxRepository>
             <repository destinationURL="file://var/mail/inboxes/" type="MAIL"/>
          </inboxRepository>
          <!-- Alternative inbox repository definition for DB use. -->
          <!-- The format for the destinationURL is "db://<data-source>/<table>" -->
          <!-- <data-source> is the datasource name set up in the database-connections block, below -->
          <!-- <table> is the name of the table to store user inboxes in -->
          <!-- The user name is used as <repositoryName> for this repository config. -->
          <!--
          <inboxRepository>
             <repository destinationURL="db://maildb/inbox/" type="MAIL"/>
          </inboxRepository>
          -->
          <!-- Alternative inbox repository definition for DB use. -->
          <!-- Stores message body in file system, rest in database -->
          <!--
          <inboxRepository>
             <repository destinationURL="dbfile://maildb/inbox/" type="MAIL"/>
          </inboxRepository>
          -->
          <!-- Alternative inbox repository definition for mbox use. -->
          <!-- This method uses UNIX standard mbox files and is meant for people using mbox files -->
          <!-- with systems such as mail list archive displayers -->
          <!-- Note that dot-locking is not currently supported -->
          <!-- so network (write) accesses may cause mbox corruption -->
          <!-- the sample mbox URL is an absolute URL; mbox:///var/mail will put the users mbox files in /var/mail/-->
          <!--
          <inboxRepository>
             <repository destinationURL="mbox:///var/mail/" type="MAIL"/>
          </inboxRepository>
          -->
       </James>
       <!-- Fetch pop block, fetches mail from POP3 servers and inserts it into the incoming spool -->
       <!-- Warning: It is important to prevent mail from looping by setting the  -->
       <!-- fetched domains in the <servernames> section of the <James> block     -->
       <!-- above. This block is disabled by default.                             -->
       <!-- FetchPOP is being deprecated in favor of FetchMail                    -->
        <fetchpop enabled="true">
            <!-- You can have as many fetch tasks as you want, but each must have a -->
            <!-- unique name by which it identified -->
            <fetch name="mydomain.com">
                <!-- Host name or IP address -->
                <host>mail.mydomain.com</host>
                <!-- Account login username -->
                <user>username</user>
                <!-- Account login password -->
                <password>pass</password>
                <!-- How frequently this account is checked - in milliseconds. 600000 is every ten minutes -->
                <interval>600000</interval>
            </fetch>
        </fetchpop>
        <!-- This is an example configuration for FetchMail, a JavaMail based gateway  -->
        <!-- service that pulls messages from other sources, and inserts them into the -->
        <!-- spool.  They are then processed normally, although FetchMail generally    -->
        <!-- has to fabricate some of the envelope information.  FetchMail should be   -->
        <!-- considered a mail gateway, rather than a relay, in RFC terms.             -->
        <!-- Fetchmail is a functionally richer replacement for FetchPOP.              -->
        <!-- CHECKME: FetchMail is disabled by default, and must be configured to use. -->
        <!-- Edit the file referred to by fetchmailConfig to enable and configure.     -->
        &fetchmailConfig;
       <!-- The James Spool Manager block  -->
       <!-- -->
       <!-- This block is responsible for processing messages on the spool. -->
       <spoolmanager>
          <!-- Number of spool threads -->
          <threads> 10 </threads>
          <!-- Set the Java packages from which to load mailets and matchers -->
          <mailetpackages>
             <mailetpackage>org.apache.james.transport.mailets</mailetpackage>
          </mailetpackages>
          <matcherpackages>
             <matcherpackage>org.apache.james.transport.matchers</matcherpackage>
          </matcherpackages>
          <!-- The root processor is a required processor - James routes all mail on the spool -->
          <!-- through this processor first. -->
          <!-- -->
          <!-- This configuration is a sample configuration for the root processor. -->
          <processor name="root">
             <!-- Checks that the email Sender is associated with a valid domain. -->
             <!-- Useful for detecting and eliminating spam. -->
             <!-- For this block to function, the spam processor must be configured. -->
             <!--
             <mailet match="SenderInFakeDomain=64.55.105.9,64.94.110.11,194.205.62.122,194.205.62.62,195.7.77.20,206.253.214.102,212.181.91.6,219.88.106.80,194.205.62.42,216.35.187.246,203.119.4.6" class="ToProcessor">
                <processor> spam </processor>
             </mailet>
             -->
             <!-- Important check to avoid looping -->
             <mailet match="RelayLimit=30" class="Null"/>
             <!--
             <mailet match="All" class="XMLVirtualUserTable">
                <!- 1:1 mapping ->
                <mapping>morgoth@middle-earth=sauron@mordor</mapping>
                <!- 1:n mapping ->
                <mapping>istari@middle-earth=saruman@isengard;radigast;gandalf</mapping>
                <!- DSN mapping ->
                <mapping>boromir@osgilliath=error:550 Requested action not taken: no such user here</mapping>
                <!- regex based mapping ->
                <mapping>*@osgilliath=regex:(.*)@osgilliath:${1}@minas-tirith</mapping>
                <!- both standard and regex mapping ->
                <mapping>ring@*=onering@mordor;regex:ring@(.*):ring@${1}</mapping>
                <!- conditional regex mapping example ->
                <mapping>*@listserver=regex:(.*)-on@listserver:${1}-subscribe@listserver;
                                      regex:(.*)-off@listserver:${1}-unsubscribe@listserver
                </mapping>
             </mailet>
             -->
             <!-- White List:
                  If you use block lists, you will probably want to check
                  for known permitted senders.  This is particularly true
                  if you use more aggressive block lists, such as SPEWS,
                  that are prone to block entire subnets without regard
                  for non-spamming senders.
              -->
             <!-- specific known senders -->
             <!--
             <mailet match="SenderIs=goodboy@goodhost"
                     class="ToProcessor">
                <processor> transport </processor>
             </mailet>
             -->
             <!-- People on this list agree to pay a penalty if they send spam -->
             <mailet match="InSpammerBlacklist=query.bondedsender.org"
                     class="ToProcessor">
               <processor> transport </processor>
             </mailet>
             <!-- E-mail legally required not to be spam (see: http://www.habeas.com) -->
             <!--
             <mailet match="HasHabeasWarrantMark" class="ToProcessor">
                <processor> transport </processor>
             </mailet>
             -->
             <!-- End of White List -->
             <!-- Check for delivery from a known spam server -->
             <!-- This set of matchers/mailets redirect all emails from known -->
             <!-- black holes, open relays, and spam servers to the spam processor -->
             <!-- For this set to function properly, the spam processor must be configured. -->
             <mailet match="InSpammerBlacklist=dnsbl.njabl.org"
                     class="ToProcessor">
               <processor> spam </processor>
               <notice>550 Requested action not taken: rejected - see http://njabl.org/ </notice>
             </mailet>
             <mailet match="InSpammerBlacklist=relays.ordb.org"
                     class="ToProcessor">
               <processor> spam </processor>
               <notice>550 Requested action not taken: rejected - see http://www.ordb.org/ </notice>
             </mailet>
             <!-- Sample matching to kill a message (send to Null) -->
             <!--
             <mailet match="RecipientIs=badboy@badhost" class="Null"/>
             -->
             <!-- Send remaining mails to the transport processor for either local or remote delivery -->
             <mailet match="All" class="ToProcessor">
                <processor> transport </processor>
             </mailet>
          </processor>
          <!-- The error processor is required.  James may internally set emails to the -->
          <!-- error state.  The error processor is generally invoked when there is an -->
          <!-- unexpected error either in the mailet chain or internal to James. -->
          <!-- -->
          <!-- By default configuration all email that generates an error in placed in -->
          <!-- an error repository. -->
          <processor name="error">
             <!-- If you want to notify the sender their message generated an error, uncomment this       -->
             <!--
             <mailet match="All" class="Bounce"/>
             -->
             <!-- If you want to notify the postmaster that a message generated an error, uncomment this  -->
             <!--
             <mailet match="All" class="NotifyPostmaster"/>
             -->
             <!-- Logs any messages to the repository specified -->
             <mailet match="All" class="ToRepository">
                <repositoryPath> file://var/mail/error/</repositoryPath>
                <!-- An alternative database repository example follows. -->
                <!--
                <repositoryPath> db://maildb/deadletter/error </repositoryPath>
                -->
             </mailet>
          </processor>
          <!-- Processor CONFIGURATION SAMPLE: transport is a sample custom processor for local or -->
          <!-- remote delivery -->
          <processor name="transport">
            <!-- This is an example configuration including configuration for a list server. -->
            <!-- CHECKME: before uncommenting this, edit the configuration file's contents   -->
            <!--
              &listserverConfig;
            -->
             <!-- Is the recipient is for a local account, deliver it locally -->
             <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <!-- If the host is handled by this server and it did not get -->
             <!-- locally delivered, this is an invalid recipient -->
             <mailet match="HostIsLocal" class="ToProcessor">
                <processor> local-address-error </processor>
                <notice>550 - Requested action not taken: no such user here</notice>
             </mailet>
    <!-- CHECKME! -->
             <!-- This is an anti-relay matcher/mailet combination -->
             <!-- -->
             <!-- Emails sent from servers not in the network list are  -->
             <!-- rejected as spam.  This is one method of preventing your -->
             <!-- server from being used as an open relay.  Make sure you understand -->
             <!-- how to prevent your server from becoming an open relay before -->
             <!-- changing this configuration. See also <authorizedAddresses> in SMTP Server -->
             <!-- -->
             <!-- This matcher/mailet combination must come after local delivery has -->
             <!-- been performed.  Otherwise local users will not be able to receive -->
             <!-- email from senders not in this remote address list. -->
             <!-- -->
             <!-- If you are using this matcher/mailet you will probably want to -->
             <!-- update the configuration to include your own network/addresses.  The -->
             <!-- matcher can be configured with a comma separated list of IP addresses  -->
             <!-- wildcarded IP subnets, and wildcarded hostname subnets. -->
             <!-- e.g. "RemoteAddrNotInNetwork=127.0.0.1, abc.de.*, 192.168.0.*" -->
             <!-- -->
             <!-- If you are using SMTP authentication then you can (and generally -->
             <!-- should) disable this matcher/mailet pair. -->
             <mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
                <processor> relay-denied </processor>
                <notice>550 - Requested action not taken: relaying denied</notice>
             </mailet>
             <!-- Attempt remote delivery using the specified repository for the spool, -->
             <!-- using delay time to retry delivery and the maximum number of retries -->
             <mailet match="All" class="RemoteDelivery">
                <outgoing> file://var/mail/outgoing/ </outgoing>
                <!-- alternative database repository example below -->
                <!--
                <outgoing> db://maildb/spool/outgoing </outgoing>
                -->
                <!-- Delivery Schedule based upon RFC 2821, 4.5.4.1 -->
                <!-- 5 day retry period, with 4 attempts in the first
                     hour, two more within the first 6 hours, and then
                     every 6 hours for the rest of the period. -->
                <delayTime>  5 minutes </delayTime>
                <delayTime> 10 minutes </delayTime>
                <delayTime> 45 minutes </delayTime>
                <delayTime>  2 hours </delayTime>
                <delayTime>  3 hours </delayTime>
                <delayTime>  6 hours </delayTime>
                <maxRetries> 25 </maxRetries>
                <!-- The number of threads that should be trying to deliver outgoing messages -->
                <deliveryThreads> 1 </deliveryThreads>
                <!-- If false the message will not be sent to given server if any recipients fail -->
                <sendpartial>false</sendpartial>
                <!-- A single mail server to deliver all outgoing messages. -->
                <!-- This is useful if this server is a backup or failover machine, -->
                <!-- or if you want all messages to be routed through a particular mail server, -->
                <!-- regardless of the email addresses specified in the message -->
                <!-- -->
                <!-- The gateway element specifies the gateway SMTP server name. -->
                <!-- If your gateway mail server is listening on a port other than 25, -->
                <!-- you can set James to connect to it on that port using the gatewayPort -->
                <!-- element. -->
                <!-- Although normally multiple addresses are implemented through proper -->
                <!-- DNS configuration, the RemoteDelivery mail does allow specifying -->
                <!-- multiple gateway elements, each of which may also have a port -->
                <!-- e.g., mygateway:2525 -->
                <!-- the gatewayPort element is used as a default -->
                <!--
                <gateway> mytrans-port.com</gateway>
                <gatewayPort>25</gatewayPort>
                -->
             </mailet>
          </processor>
          <!-- Processor CONFIGURATION SAMPLE: spam is a sample custom processor for handling -->
          <!-- spam. -->
          <!-- You can either log these, bounce these, or just ignore them. -->
          <processor name="spam">
             <!-- To destroy all messages, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="Null"/>
             -->
             <!-- To notify the sender their message was marked as spam, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="Bounce"/>
             -->
             <!-- To notify the postmaster that a message was marked as spam, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="NotifyPostmaster"/>
             -->
             <!-- To log the message to a repository, this matcher/mailet configuration should be uncommented. -->
             <!-- This is the default configuration. -->
             <mailet match="All" class="ToRepository">
                <repositoryPath>file://var/mail/spam/</repositoryPath>
                <!-- Changing the repositoryPath, as in this commented out example, will -->
                <!-- cause the mails to be stored in a database repository.  -->
                <!-- Please note that only one repositoryPath element can be present for the mailet -->
                <!-- configuration. -->
                <!--
                <repositoryPath> db://maildb/deadletter/spam </repositoryPath>
                -->
             </mailet>
          </processor>
          <!-- This processor handles messages that are for local domains, where the user is unknown -->
          <processor name="local-address-error">
             <!-- To notify the sender the address was invalid, uncomment this matcher/mailet configuration -->
             <!-- The original message is not attached to keep the bounce processor from deliverying spam -->
             <!--
             <mailet match="All" class="Bounce">
                <attachment>none</attachment>
             </mailet>
             -->
             <!-- To notify the postmaster that a message had an invalid address, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="NotifyPostmaster"/>
             -->
             <mailet match="All" class="ToRepository">
                <repositoryPath> file://var/mail/address-error/</repositoryPath>
                <!-- An alternative database repository example follows. -->
                <!--
                <repositoryPath> db://maildb/deadletter/address-error </repositoryPath>
                -->
             </mailet>
          </processor>
          <!-- This processor handles messages that are for foreign domains, where relaying is denied -->
          <!-- As of James v2.2, this processor can be deprecated by using the <authorizedAddresses> tag
               in the SMTP Server, and rejecting the message in the protocol transaction.  -->
          <processor name="relay-denied">
             <!-- To notify the sender the address was invalid, uncomment this matcher/mailet configuration -->
             <!-- The original message is not attached to keep the bounce processor from deliverying spam -->
             <!--
             <mailet match="All" class="Bounce">
                <attachment>none</attachment>
             </mailet>
             -->
             <!-- To notify the postmaster that a relay request was denied, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="NotifyPostmaster"/>
             -->
             <mailet match="All" class="ToRepository">
                <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
                <!-- An alternative database repository example follows. -->
                <!--
                <repositoryPath> db://maildb/deadletter/relay-denied </repositoryPath>
                -->
             </mailet>
          </processor>
       </spoolmanager>
       <!-- DNS Server Block -->
       <!-- -->
       <!-- Specifies DNS Server information for use by various components inside -->
       <!-- James. -->
       <!-- -->
       <!-- If autodiscover is true, James will attempt to autodiscover the DNS servers configured on your underlying system.-->
       <!-- Currently, this works if the OS has a unix-like /etc/resolv.conf,-->
       <!-- or the system is Windows based with ipconfig or winipcfg.-->
       <!-- -->
       <!-- If no DNS servers are found and you have not specified any below, 127.0.0.1 will be used-->
       <!-- If you use autodiscover and add DNS servers manually a combination of all the dns servers will be used  -->
       <!--  -->
       <!-- Information includes a list of DNS Servers to be used by James.  These are -->
       <!-- specified by the server elements, each of which is a child element of the -->
       <!-- servers element.  Each server element is the IP address of a single DNS server. -->
       <!-- The servers element can have multiple server children. -->
       <dnsserver>
          <servers>
             <!--Enter ip address of your DNS server, one IP address per server -->
             <!-- element. -->
             <!--
              <server>216.251.32.100</server>
             -->
          </servers>
          <!-- Change autodiscover to false if you would like to turn off autodiscovery -->
          <!-- and set the DNS servers manually in the <servers> section -->
          <autodiscover>true</autodiscover>
          <authoritative>false</authoritative>
       </dnsserver>
       <remotemanager>
          <port>4555</port>
          <!--  Uncomment this if you want to bind to a specific inetaddress -->
          <!--
          <bind> </bind>
          -->
          <!--  Uncomment this if you want to use TLS (SSL) on this port -->
          <!--
          <useTLS>true</useTLS>
          -->
          <handler>
             <!-- This is the name used by the server to identify itself in the RemoteManager -->
             <!-- protocol.  If autodetect is TRUE, the server will discover its -->
             <!-- own host name and use that in the protocol.  If discovery fails, -->
             <!-- the value of 'localhost' is used.  If autodetect is FALSE, James -->
             <!-- will use the specified value. -->
             <helloName autodetect="true">myMailServer</helloName>
             <administrator_accounts>
    <!-- CHECKME! -->
                <!-- Change the default login/password. -->
                <account login="username" password="password"/>
             </administrator_accounts>
             <connectiontimeout> 60000 </connectiontimeout>
          </handler>
       </remotemanager>
        <!-- The POP3 server is enabled by default -->
        <!-- Disabling blocks will stop them from listening, -->
        <!-- but does not free as many resources as removing them would -->
       <pop3server enabled="true">
          <!-- port 995 is the well-known/IANA registered port for POP3S  ie over SSL/TLS -->
          <!-- port 110 is the well-known/IANA registered port for Standard POP3 -->
          <port>110</port>
          <!-- Uncomment this if you want to bind to a specific inetaddress -->
          <!--
          <bind> </bind>
          -->
          <!--  Uncomment this if you want to use TLS (SSL) on this port -->
          <!--
          <useTLS>true</useTLS>
          -->
          <handler>
             <!-- This is the name used by the server to identify itself in the POP3 -->
             <!-- protocol.  If autodetect is TRUE, the server will discover its -->
             <!-- own host name and use that in the protocol.  If discovery fails, -->
             <!-- the value of 'localhost' is used.  If autodetect is FALSE, James -->
             <!-- will use the specified value. -->
             <helloName autodetect="true">myMailServer</helloName>
             <connectiontimeout>120000</connectiontimeout>
          </handler>
       </pop3server>
        <!-- The SMTP server is enabled by default -->
        <!-- Disabling blocks will stop them from listening, -->
        <!-- but does not free as many resources as removing them would -->
       <smtpserver enabled="true">
          <!-- port 25 is the well-known/IANA registered port for SMTP -->
          <port>25</port>
          <!-- Uncomment this if you want to bind to a specific inetaddress -->
          <!--
          <bind> </bind>
          -->
          <!-- Uncomment this if you want to use TLS (SSL) on this port -->
          <!--
          <useTLS>true</useTLS>
          -->
          <handler>
             <!-- This is the name used by the server to identify itself in the SMTP -->
             <!-- protocol.  If autodetect is TRUE, the server will discover its -->
             <!-- own host name and use that in the protocol.  If discovery fails, -->
             <!-- the value of 'localhost' is used.  If autodetect is FALSE, James -->
             <!-- will use the specified value. -->
             <helloName autodetect="true">myMailServer</helloName>
             <connectiontimeout>360000</connectiontimeout>
             <!--  Uncomment this if you want to require SMTP authentication. -->
             <!--
             <authRequired>true</authRequired>
             -->
    <!-- CHECKME! -->
             <!--  Uncomment this if you want to authorize specific addresses/networks.
                   If you use SMTP AUTH, addresses that match those specified here will
                   be permitted to relay without SMTP AUTH.  If you do not use SMTP
                   AUTH, and you specify addreses here, then only addresses that match
                   those specified will be permitted to relay.
                   Addresses may be specified as a an IP address or domain name, with an
                   optional netmask, e.g.,
                   127.*, 127.0.0.0/8, 127.0.0.0/255.0.0.0, and localhost/8 are all the same
                   See also the RemoteAddrNotInNetwork matcher in the transport processor.
                   You would generally use one OR the other approach.
             -->
             <authorizedAddresses>127.0.0.0/8</authorizedAddresses>
             <!--  Uncomment this if you want to verify sender addresses, ensuring that -->
             <!--  the sender address matches the user who has authenticated. -->
             <!--  This prevents a user of your mail server from acting as someone else -->
             <!--
             <verifyIdentity>true</verifyIdentity>
             -->
             <!--  This sets the maximum allowed message size (in kilobytes) for this -->
             <!--  SMTP service. If unspecified, the value defaults to 0, which means no limit. -->
             <maxmessagesize>0</maxmessagesize>
          </handler>
       </smtpserver>
        <!-- The NNTP server is enabled by default -->
        <!-- Disabling blocks will stop them from listening, -->
        <!-- but does not free as many resources as removing them would -->
        <!-- NNTP-specific: if you disable the NNTP Server, you should also set the nntp-repository's
             threadCount to 0, otherwise there will be threads active and polling  -->
       <nntpserver enabled="true">
       <!-- THE NNTP PROTOCOL IS EXPERIMENTAL AND NOT AS WELL TESTED AS SMTP AND POP3 IN THIS RELEASE.
            The James project recommends that you check the James web site for updates to the NNTP
            service.  -->
          <!-- port 563 is the well-known/IANA registered port for NNTP over SSL/TLS -->
          <!-- port 119 is the well-known/IANA registered port for Standard NNTP -->
          <port>119</port>
          <!-- Uncomment this if you want to bind to a specific inetaddress -->
          <!--
          <bind> </bind>
          -->
          <!-- Uncomment this if you want to use TLS (SSL)  on this port -->
          <!--
          <useTLS>true</useTLS>
          -->
          <handler>
             <!-- This is the name used by the server to identify itself in the NNTP -->
             <!-- protocol.  If autodetect is TRUE, the server will discover its -->
             <!-- own host name and use that in the protocol.  If discovery fails, -->
             <!-- the value of 'localhost' is used.  If autodetect is FALSE, James -->
             <!-- will use the specified value. -->
             <helloName autodetect="true">myMailServer</helloName>
             <co                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    hi
    you have to change the config.xml to allow the server accept relay mails from your host machine from which you are sendign the mail ...
    ie
    change
    <mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
    <processor> relay-denied </processor>
    <notice>550 - Requested action not taken: relaying denied</notice>
    </mailet>
    add few more ips (your network / subnet ip)
    so that it accpets mails from that machine to be relayed ...
    you can also change the smtp autheriZation part and do that ...
    any one is enough ..
    Regards
    Venkat

  • How to upload file from java client to php

    hi
    i am trying to upload/send a file from client using swing/applet
    and receiving it with php code.
    here is the php code which uploads the post file from the client
    $uploaddir = "/home/raghavendra/Documents/";
    $file = basename( $_FILES["uploadedfile"]["name"]);
    echo "file:\n".$file;
    $uploadfile = $uploaddir. $file;
    if (move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],$uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
    else {
    echo "File upload failure Possible file upload attack!\n";
    and corresponding different java code which post the
    1)
    public void postmethodTest(String filefrom){
    try{
    String hostname = "localhost";
    int port = 80;
    InetAddress addr = InetAddress.getByName(hostname);
    Socket socket = new Socket(addr, port);
    // Send header
    String path ="/php_prgs/var/www/nsboxng/htdocs/tryupdate.php";
    File theFile = new File(filefrom);
    System.out.println ("size: " + (int) theFile.length());
    DataInputStream fis = new DataInputStream(new BufferedInputStream(new FileInputStream(theFile)));
    byte[] theData = new byte[(int) theFile.length( )];
    fis.readFully(theData);
    fis.close();
    DataOutputStream raw = new DataOutputStream(socket.getOutputStream());
    Writer wr = new OutputStreamWriter(raw);
    String command =
    "POST "+path+" HTTP/1.0\r\n"
    + "Content-type: multipart/form-data, boundary=mango\r\n"
    + "Content-length: " + ((int) theFile.length()) + "\r\n"
    + "\r\n"
    + "--mango\r\n"
    + "content-disposition: name=\"MAX_FILE_SIZE\"\r\n"
    + "\r\n"
    + "\r\n--mango\r\n"
    + "content-disposition: attachment; name=\"datafile\"" ;
    String filename="test.doc\"\r\n"
    + "Content-Type: text/doc\r\n"
    + "Content-Transfer-Encoding: binary\r\n"
    + "\r\n";
    wr.write(command);
    wr.flush();
    raw.write(theData);
    raw.flush( );
    wr.write("\r\n--mango--\r\n");
    wr.flush( );
    BufferedReader rd = new BufferedReader(new
    InputStreamReader(socket.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
    System.out.println("out"+line);
    wr.close();
    raw.close();
    socket.close();
    } catch (Exception e) {System.out.println(e.toString());}
    2)
    public void postMethod(String strURL, String filefrom){
    try {
    String fname = filefrom.substring(filefrom.lastIndexOf("/")+1, filefrom.length());
    File input=new File(filefrom);
    // Prepare HTTP post
    PostMethod post = new PostMethod(strURL);
    // Request content will be retrieved directly
    // from the input stream
    // Per default, the request content needs to be buffered
    // in order to determine its length.
    // Request body buffering can be avoided when
    // content length is explicitly specified
    post.setRequestEntity(new InputStreamRequestEntity(new FileInputStream(input), input.length()));
    // Specify content type and encoding
    // If content encoding is not explicitly specified
    // ISO-8859-1 is assumed
    //post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
    post.setRequestHeader("Content-Type","multipart/form-data");
    post.setRequestHeader("Content-Disposition", "form-data; name="+fname);
    // Get HTTP client
    HttpClient httpclient = new HttpClient();
    // Execute request
    try {
    int result=httpclient.executeMethod(post);
    // Display status code
    System.out.println("Response status code: " +result);
    // Display response
    System.out.println("Response body: ");
    // System.out.println(post.getResponseBodyAsString());
    BufferedReader console = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream()));
    String name = null;
    String line = null;
    try {
    while ((line = console.readLine()) != null) {
    System.out.println("output"+line);
    //name = console.readLine();
    catch (IOException e) { name = "<" + e + ">"; }
    // System.out.println("Hello " + name);
    } finally {
    // Release current connection to the connection pool
    // once you are done
    post.releaseConnection();
    catch(IOException e){
    but am getting else condition response from php code
    but if i post with html code it is working fine.
    can anybody help me please where i have to change the code
    please suggest me. am in a big trouble and i have to complete this as soon as possible

    One thread is enough.
    http://forum.java.sun.com/thread.jspa?threadID=5198449
    You could have bumped it instead. Also, you still just posted a junk of unformatted stuff. Furthermore, for HttpClient support ask at an HttpClient mailing list of rorum.

  • How to submit a HTTP Request from a Java Program

    I am working on an web based application where in I need to submit the HttpRequest through a Java Program and not through browser. Moreover my intent is just to submit the HttpRequest. I donot want to wait for the response to come back. I have used the URL Connection class to do the same and I am trying to post this request. The contents of the methods that I am using are as below:-
    public void doPost(URL url, String inputXMLString) throws IOException
              //Create URLConnection based on the passed URL
              URLConnection connection = url.openConnection();
              connection.setDoOutput(true);
              connection.setDoInput(false);
              connection.setUseCaches(false);
              connection.setAllowUserInteraction(false);
              connection.setRequestProperty("Content-type", "application/x-www-form-
    urlencoded");
              //Get the Connection's output stream and write the request to it.
              PrintWriter out = new PrintWriter(connection.getOutputStream());
              out.print("&ena-request-input=" + URLEncoder.encode(inputXMLString));
              out.flush();
              out.close();
    Call to the above method does not invoke the URL I am intending to submit the request at.
    Can anybody give me the clue....................................................?

    I agree with the advice to launch a new thread to read and ignore the response. I don't think you should have to do it to make it work, but it's worth trying for two reasons:
    1) If it turns out it does make it work, well, then either you can leave it that way, or use that as a clue to help figure out how to make it work the way you want.
    2) There may be an error message there that will give you an idea why it's not working.
    When you say it's not invoking the servlet, what does that mean, and how do you know? Is it just that the final results aren't being seen? Put a bunch of logging statements in the servlet. It could be that it's getting hit, but you're corrupting the string you're building, or sending some extra junk that it can't handle. Spit out a log statement from the start of doPost, to see if it's even getting there. Then log the parameter. Enclose the output in quotes or braces or something to make sure there's not extra junk. I've had XML docs not parse because there was a blank line at the beginning.
    If it works in the browser but not from your standalone app, then you need to have the servlet tell what difference it sees in the two cases. Print out headers, other params, everything you can think of.
    Re-read the docs for URL, HttpURL, whatever, to make sure you're doing all the right steps in the right order. Make a servlet that just takes a single, simple param=value via POST and see if you can get that to work.

  • Error in weblogic7.0 :java.security.NoSuchAlgorithmException:

    Hi All
    thanks in advance.
    i am facing a peculiar problem while using SunJce provider
    i have some classes to encrypt& decrypt some information using
    DeffieHellman protocol.
    Problem 1
    while i am running those classes in command prompts
    some time it gives me correct results where as other time during decryption i am unable to get the plaintext (i am getting some junk character),where as some time it gives me Badpadding exception
    I am using JDK1.3 which comes with weblogic and jce1.2.2
    for classpath and path setting
    set path=D:\bea\jdk131_03\bin
    set classpath=%classpath%; D:\bea\jdk131_03\jre\lib\ext\ jce1_2_2.jar
    set classpath=%classpath%; D:\bea\jdk131_03\jre\lib\ext\sunjce_provider.jar
    set classpath=%classpath%; D:\bea\jdk131_03\jre\lib\ext\local_policy.jar
    set classpath=%classpath%; D:\bea\jdk131_03\jre\ext\US_export_policy.jar
    my BEA_HOME=d\bea and JAVA_HOME=D:\bea\jdk131_03\jre
    Problem 2
    While i am using those classes in servlet and jsp which are deployed in weblogic 7
    Some time i am getting correct results
    but as i stop and start the weblogic server ,i am getting .NoSuchAlgorithmException.
    So mainly i am having two classes DiffieHellmanKeyGeneRation and DHEncryptDecrypt given below
    import java.io.*;
    import java.math.BigInteger;
    import java.security.*;
    import java.security.spec.*;
    import java.security.interfaces.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import javax.crypto.interfaces.*;
    import com.sun.crypto.provider.SunJCE;
    public class DiffieHellmanKeyGeneRation {
    PublicKey alicePubKey=null;
         PublicKey bobPubKey=null;
         KeyAgreement aliceKeyAgree =null;
         KeyAgreement bobKeyAgree =null;
    * DiffieHellmanKeyGeneRation() constructor -Set the mode and call run method to generate Keypairs
    * and assigns it to the instance variables .
    * @param nil
    * @returns nil
    public DiffieHellmanKeyGeneRation(){
         try {
    String mode = "GENERATE_DH_PARAMS";
                   run(mode);
    } catch (Exception e) {
    System.err.println("Error: " + e);
    System.exit(1);
    * getAlicePubKey() -Return the Instance Variable alicePubKey
    * @param nil
    * @returns PublicKey
    public PublicKey getAlicePubKey()
    return alicePubKey;
    * getBobPubKey() -Return the Instance Variable bobPubKey
    * @param nil
    * @returns PublicKey
    public PublicKey getBobPubKey()
    return bobPubKey;
    * getAliceKeyAgree() -Return the Instance Variable aliceKeyAgree
    * @param nil
    * @returns KeyAgreement
         public KeyAgreement getAliceKeyAgree()
    return aliceKeyAgree;
    * getBobKeyAgree() -Return the Instance Variable bobKeyAgree
    * @param nil
    * @returns KeyAgreement
    public KeyAgreement getBobKeyAgree()
    return bobKeyAgree;
    *run() method -Generate Algorithm instance,KeySpec,and keypair
    * and assigns it to the instance variables .
    * @param String
    * @returns nil
    private void run(String mode) throws Exception {
    DHParameterSpec dhSkipParamSpec=null;
    // System.out.println("Creating Diffie-Hellman parameters (takes VERY long) ...");
    AlgorithmParameterGenerator paramGen=AlgorithmParameterGenerator.getInstance("DH");
    paramGen.init(512);
    AlgorithmParameters params = paramGen.generateParameters();
    dhSkipParamSpec = (DHParameterSpec)params.getParameterSpec(DHParameterSpec.class);
    * Alice creates her own DH key pair, using the DH parameters from
    * above
    // System.out.println("ALICE: Generate DH keypair ...");
    KeyPairGenerator aliceKpairGen = KeyPairGenerator.getInstance("DH");
    aliceKpairGen.initialize(dhSkipParamSpec);
    KeyPair aliceKpair = aliceKpairGen.generateKeyPair();
    // Alice creates and initializes her DH KeyAgreement object
    // System.out.println("ALICE: Initialization ...");
    aliceKeyAgree = KeyAgreement.getInstance("DH");
    aliceKeyAgree.init(aliceKpair.getPrivate());
    // Alice encodes her public key, and sends it over to Bob.
    byte[] alicePubKeyEnc = aliceKpair.getPublic().getEncoded();
    * Let's turn over to Bob. Bob has received Alice's public key
    * in encoded format.
    * He instantiates a DH public key from the encoded key material.
    KeyFactory bobKeyFac = KeyFactory.getInstance("DH");
    X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(alicePubKeyEnc);
    alicePubKey = bobKeyFac.generatePublic(x509KeySpec);
    * Bob gets the DH parameters associated with Alice's public key.
    * He must use the same parameters when he generates his own key
    * pair.
    DHParameterSpec dhParamSpec = ((DHPublicKey)alicePubKey).getParams();
    // Bob creates his own DH key pair
    // System.out.println("BOB: Generate DH keypair ...");
    KeyPairGenerator bobKpairGen = KeyPairGenerator.getInstance("DH");
    bobKpairGen.initialize(dhParamSpec);
    KeyPair bobKpair = bobKpairGen.generateKeyPair();
    // Bob creates and initializes his DH KeyAgreement object
    // System.out.println("BOB: Initialization ...");
    bobKeyAgree = KeyAgreement.getInstance("DH");
    bobKeyAgree.init(bobKpair.getPrivate());
    // Bob encodes his public key, and sends it over to Alice.
    byte[] bobPubKeyEnc = bobKpair.getPublic().getEncoded();
    * Alice uses Bob's public key for the first (and only) phase
    * of her version of the DH
    * protocol.
    * Before she can do so, she has to instanticate a DH public key
    * from Bob's encoded key material.
    KeyFactory aliceKeyFac = KeyFactory.getInstance("DH");
    x509KeySpec = new X509EncodedKeySpec(bobPubKeyEnc);
    bobPubKey = aliceKeyFac.generatePublic(x509KeySpec);
    2)
    import java.io.*;
    import java.math.BigInteger;
    import java.security.*;
    import java.security.spec.*;
    import java.security.interfaces.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import javax.crypto.interfaces.*;
    import sun.misc.*;
    import com.sun.crypto.provider.SunJCE;
    public class DHEncryptDecrypt {
    PublicKey alicePubKey=null;
         PublicKey bobPubKey=null;
         KeyAgreement aliceKeyAgree =null;
         KeyAgreement bobKeyAgree =null;
         SecretKey bobDesKey = null;
         SecretKey aliceDesKey =null;
    * DHEncryptDecrypt constructor -it intancetiate DiffieHellmanKeyGeneRation object to get Public key of both party and Shared Secrete
    * and assigns it to the instance variables .
    * @param nil
    * @returns nil
         public DHEncryptDecrypt()
              try{
              init();
         }catch(Exception e){e.printStackTrace();}
    * init() -it DiffieHellmanKeyGeneRation object to get Public key of both party and Shared Secrete
    * and assigns it to the instance variable ds.
    * @param nil
    * @returns nil
    private void init() throws Exception
         System.out.println("Initialising...");
                   DiffieHellmanKeyGeneRation dhPubKey=new DiffieHellmanKeyGeneRation();
                   alicePubKey=dhPubKey.getAlicePubKey();
                   bobPubKey=dhPubKey.getBobPubKey();
    aliceKeyAgree=dhPubKey.getAliceKeyAgree();
                   bobKeyAgree=dhPubKey.getBobKeyAgree();
    //System.out.println("ALICE: Execute PHASE1 ...");
    aliceKeyAgree.doPhase(bobPubKey, true);
         * Bob uses Alice's public key for the first (and only) phase
         * of his version of the DH
         * protocol.
    // System.out.println("BOB: Execute PHASE1 ...");
    bobKeyAgree.doPhase(alicePubKey, true);
    * At this stage, both Alice and Bob have completed the DH key
    * agreement protocol.
    * Both generate the (same) shared secret.
    byte[] aliceSharedSecret = aliceKeyAgree.generateSecret();
    int aliceLen = aliceSharedSecret.length;
    byte[] bobSharedSecret = new byte[aliceLen];
    int bobLen;
    /* try {
    // show example of what happens if you
    // provide an output buffer that is too short
    bobLen = bobKeyAgree.generateSecret(bobSharedSecret, 1);
    } catch (ShortBufferException e) {
    System.out.println(e.getMessage());
    // provide output buffer of required size
    bobLen = bobKeyAgree.generateSecret(bobSharedSecret, 0);
              if (!java.util.Arrays.equals(aliceSharedSecret, bobSharedSecret))
    throw new Exception("Shared secrets differ");
    //System.out.println("Shared secrets are the same");
    // System.out.println("Return shared secret as SecretKey object ...");
    // Bob
    // Note: The call to bobKeyAgree.generateSecret above reset the key
    // agreement object, so we call doPhase again prior to another
    // generateSecret call
    bobKeyAgree.doPhase(alicePubKey, true);
    bobDesKey = bobKeyAgree.generateSecret("DES");
    // Alice
    // Note: The call to aliceKeyAgree.generateSecret above reset the key
    // agreement object, so we call doPhase again prior to another
    // generateSecret call
    aliceKeyAgree.doPhase(bobPubKey, true);
    aliceDesKey = aliceKeyAgree.generateSecret("DES");
    * encrypt() - Alice encrypts, using DES in ECB mode
    * and assigns it to the instance variable ds.
    * @param String
    * @returns String
              public String encrypt(String ClearText) throws Exception
         String CipherText=null;
                   try{
                   // byte[] iv = {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF,(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF};
              Cipher aliceCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
         aliceCipher.init(Cipher.ENCRYPT_MODE, aliceDesKey);
                   byte[] cleartext = ClearText.getBytes();
                   //System.out.println("cleartext Array:"+ cleartext.size);
                   byte[] ciphertext = aliceCipher.doFinal(cleartext);
    // BASE64Encoder b64e = new BASE64Encoder();
                   //CipherText = b64e.encode(ciphertext);
                   CipherText = new String(ciphertext);
                   }catch(Exception e){e.printStackTrace();}
         return CipherText;
    * encrypt() - Bob Decrypts, using DES in ECB mode
    * and assigns it to the instance variable ds.
    * @param String
    * @returns String
    public String decrypt(String CipherText) throws Exception
    String Recovered=null;
         try{
              // byte[] iv = {(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF,(byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF};
    // System.out.println("Length of String is:"+CipherText.length());
                   Cipher bobCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
              bobCipher.init(Cipher.DECRYPT_MODE, bobDesKey);
                   byte[] CipherTextBytes=CipherText.getBytes();
    byte[] recovered = bobCipher.doFinal(CipherTextBytes);
                   Recovered=new String(recovered);
              // System.out.println("Decryption:"+Recovered+"length:="+Recovered.length());
    }catch(Exception e){e.printStackTrace();}
         return Recovered;
    and i am using following logic to encrypt and decrypt
    String MyPlainText ="sm_user=residential&csol_account=383784";
    //String MyPlainText ="This is my message";
         System.out.println("\nPlain Text:="+MyPlainText+"\n\n");
    try{
         DHEncryptDecrypt ed=new DHEncryptDecrypt();
    String CipherText=(ed.encrypt(MyPlainText));
                   BASE64Encoder b64e = new BASE64Encoder();
                   String CipherText1 = b64e.encode(CipherText.getBytes());
    System.out.println("\n\nUserInfo="+CipherText1);
         String DecryptedMessage=ed.decrypt(CipherText);
    System.out.println("\n\nDecrypedMessage=:"+DecryptedMessage);
         }catch(Exception e){e.printStackTrace();}
    and my java.security file in D:\ bea\jdk131_03\jre\lib\security
    is changed to add the provider as
    # List of providers and their preference orders (see above):
    security.provider.1=sun.security.provider.Sun
    security.provider.2=com.sun.crypto.provider.SunJCE
    security.provider.3=com.sun.rsajca.Provider
    # Class to instantiate as the system Policy. This is the name of the class
    # that will be used as the Policy object.
    policy.provider=sun.security.provider.PolicyFile
    Pls help me to resolve the magic shown by these classes.....some time right and some time worng
    mainly i need help in
    Badpadding Exception and NosuchAlogorithm exception in weblogic
    Thanks
    And regards
    Arati

    replace all calls of getBytes() and new String(text) with the versions where you can state a charset: getBytes(charset), new String(text, charset). i use "iso-8859-1" as the charset.
    this should at least fix your "Badpadding exception" problem (it did fix it for me).

  • Help - Safari won't open it just bounces, installed Java 2012-04 but java preferences is not picking it up

    I''m new to the MacBook, I've got a late 2007 model running Lion 10.7.  I installed iLife and removed some junk (software installed from previous user that was not properly licensed) then tried to open Safari.  The icon just bounced and I got the error Safari quit unexpectedly.  I downloaded the new Java that should fix the Flashback Malware issue (I did this because in the log it stated that garbage collection was turned off) onto my thumb drive, installed it on the Mac, opened Java Preferences and it only lists the 32 and 64 bit Java SE6.  So now what???

    Right or control click the Safari app in the Applications folder then click Get Info.
    For Version. If you see 5.1.6 or 5.1.7 updating to Safari 6 may help. Apple has not posted a standalone Safari 6 intaller but there is a workaround.
    Click here >  Safari Quits Every Time Opened: Apple Support Communities
    Then click the link posted by:  gregoryfromcork
    That will automatically download this file >  Safari6Lion.pkg.download
    Now quit Safari.
    Go to your Downloads folder and double click that file and follow the instructions for installing.
    Then restart your Mac, try Safari.

  • Error while sending mail when using Java Mail API

    Hi Experts,
    I am trying to execute a webdynpro application which uses the Java Mail API to send emails. The exception that I get on executing the application is :
    Sending failed;  nested exception is: javax.mail.SendFailedException: Invalid Addresses;  nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected]
    Can anybody please help me sort out the issue.
    Regards
    Abdullah

    Hi,
    Usually one get this error if the SMTP server is configured not to relay mails (a security measure) or the SMTP server need the mail to be sent from a trusted IP or with proper authentication. Some SMTP servers are configured to block junk mails.
    Pls check with your  mail server administrator.
    Regards

  • URGENT:- Running a batch file from java program

    Author: pkanury
    I am trying to execute a batch file from my java program using RunTime and Process . It can execute any dos command except for a batch file. Can anyone throw
    some light ?? My code looks like this .....
    cmd = "command.com /c X:\\grits\\scripts\\test.bat"; Runtime rt = Runtime.getRuntime(); Process p = rt.exec(cmd);
    The weird part is that p.waitFor() returns a status of 0 implying that the cmd has been executed successfully. But that is not the case. And my batch file is as simple as - type "ADADA" > junk.txt
    Any help would be appreciated.

    I think it should work when you use a String[] array
    instead of a single String:
    String[] cmd = { "command.com", "/C", "D:\\batch\\do.bat" };
    Note: If the batchfile creates any output (i.e. files),
    they will be stored in the directory of the application
    which calls the batch file, not in d:\batch\...

  • Very simple Java AWT Frame resize question

    In the following code, I create an awt Frame. Unfortunately, when I run the resulting Java application (on Windows) and use the mouse to resize the window, none of the Frame's resize/setSize methods get called. Can anyone explain why this is?
    Thanks
    Greg
    import java.awt.* ;
    public class Junk extends Frame {
    public static void main (String args[])
    Junk j = new Junk ();
    j.show ();
    public void resize(Dimension arg0)
    super.resize(arg0);
    public void resize(int arg0, int arg1)
    super.resize(arg0, arg1);
    public void setSize(Dimension arg0)
    super.setSize(arg0);
    public void setSize(int arg0, int arg1)
    super.setSize(arg0, arg1);
    }

    When the user resizes the frame with the mouse, the resizing action probably happens entirely on the Frame's peer, without the java.awt.Frame getting involved at all. setSize() and [deprecated] resize() allow an application to programmatically change the size of a Frame, but the Frame just passes the new size to its peer.
    If you want to detect when your Frame has been resized, use addComponentListener to register a component listener on the Frame, and then put your code in the componentResized method of the listener.

Maybe you are looking for

  • Trying to Download a Software Image to Cisco 2800 series router through TFTP Using the tftpdnld ROMmon Command

    Trying to Download a Software Image to Cisco 2800 series router through TFTP Using the tftpdnld ROMmon Command and I am getting an Error , I cant figure out what I am doing wrong. I have also pasted my display down here can someone help me out, thank

  • Clear text  password - how to send it from java.

    I am trying to reset the password of a user from java. So I have to open a socket connection to Unix box and send a packet in following format "<adminUserid> <adminPassword> PASSWORD <target-userId> <new-passwd>\n" So they say that user credentials a

  • Surround Mixing - Can't enable 7.1

    I am playing with surround mixing for the first time. When I select 'Surround' as the output of my channel the 'Sound Panner' appears and allows me to write surround automation to my track. It defaults to a 5.1 panner, but when I go into 'Preferences

  • Can`t contact to the child Component in JInternalFrame!!!

    I have made JInternalFrames, which have the child component( a TextArea). with JFrame set the ContentPane with JDesktopPane, now I am trying to contact to the TextArea. <<<<<below is sample code for original>>>> JInternalFrame internalFrame = desktop

  • Adobe Flash Settings Issue

    Hello, I am having the issue with the flash settings, where you cannot click on Allow.  I am running OSX Lion, the latest adobe flash (10.3.183.7) I have added the website to the Local Storage Settings by Site options, with Allow.  When the space rea