Form login with java, then change URL

this is my problem, theres a site where I need to login with a login + pass. now when I try to take a new url (on the same host) I'm back at the login page, so basically I want to login, and then keep that login to parse several pages on the server... I didn't write this code myself, but it works for the login :p now I just need to change the url in the same connection I guess
String argus[]= {url,"name",name,"password",password};
          URL u = new URL(argus[0]);
          String postdata = URLEncoder.encode(argus[1]) + "=" + URLEncoder.encode(argus[2]);
          for (int i=3;i+1<argus.length;i+=2) {
          postdata = postdata + "&" + URLEncoder.encode(argus) + "=" + URLEncoder.encode(argus[i+1]);
          URLConnection uc = u.openConnection();
          uc.setDoOutput(true);
          OutputStreamWriter out =
          new OutputStreamWriter(uc.getOutputStream(),"ASCII");
          out.write(postdata);
          out.close();
     String s;
          while ((s = r.readLine()) != null) {
          System.out.println(s);
so far it works perfectly, but now I need to get another html page on that server, but when I create a new URL it goes back to the login page...
any ideas ?

The page probably sets a cookie. This article tells about one way to handle cookies:
http://www.javaworld.com/javaworld/jw-04-2002/jw-0426-cookie.html

Similar Messages

  • Run .sh script with Java, then change window position

    Is the following possible?:
    From java, run a .sh script, which opens a total of 4 windows. (I know how to do this part).
    Once the 4 windows (or more) are opened, I want to position them in specific locations on the screen. Is this possible, since the .sh script actually opens the windows?. Use the setLocation method in java.awt.Component??
    any help is appreciated.
    thx

    As I recall, -geometry can have 4 numbers, I think it was {width}x{height}+{X location}+{Y location}, for example "-geometry 400x300+20+20". The + signs can be - signs if you want to count from the right or bottom margins.
    Yeah, here's a quote from "man X":
    most X programs accept a command line argument of
    the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF,
    and YOFF are numbers) for specifying a preferred size and location for
    this application's main window.
    Check out the man page for more details.

  • No user other than root can login with Java Desktop System

    Dear guys,
    I have a issue with loging in Oracle Solaris 10 using X-Browser and need your help.
    I can login to console login using X-Browser but only root can login that use Java Desktop Release 3 and
    all rest user cannot login with the session use Java Desktop Release 3.
    I have tried to rename .dt directory to reinitialize the user's environment but still not work.
    Any person have occurred this problem ? Can u suggest me an idea to solve this :(
    Thx for all !
    Edited by: ThangTT on Jul 18, 2011 12:29 AM

    Dear Nik,
    You're right ;) but no solved the problem when I change permission for /tmp dir. :(
    Let I show to u the log from .dt/startlog
    $more .dt/startlog
    --- Mon Jul 18 16:40:22 ICT 2011
    --- /usr/dt/bin/Xsession starting...
    --- starting /bin/true
    --- Xsession started by dtlogin
    --- starting /usr/dt/bin/dtsession_res -load -system
    --- sourcing /oracle/home/.dtprofile...
    --- sourcing /usr/dt/config/Xsession.d/0010.dtpaths...
    --- sourcing /usr/dt/config/Xsession.d/0015.sun.env...
    --- sourcing /usr/dt/config/Xsession.d/0020.dtims...
    --- sourcing /usr/dt/config/Xsession.d/0030.dttmpdir...
    --- sourcing /usr/dt/config/Xsession.d/0040.xmbind...
    --- sourcing /usr/dt/config/Xsession.d/1001.swupnot...
    --- sourcing /usr/dt/config/Xsession.d/1099.br...
    /usr/dt/bin/Xsession[659]: /var/tmp/brlog: cannot create
    --- starting /usr/dt/bin/dtsearchpath
    --- starting /usr/dt/bin/dtappgather &
    --- starting /usr/dt/bin/dsdm &
    --- session log file is /dev/null
    --- DTSOURCEPROFILE is 'true' (see /oracle/home/.dtprofile)
    --- execing /usr/dt/config/Xsession2.jds with a /usr/bin/bash login shell ...
    --- starting desktop on /dev/pts/10
    Oracle Corporation SunOS 5.10 Generic Patch January 2005
    Couldn't open /tmp/_sttyFile_fGaO1i
    /usr/dt/bin/Xsession[788]: 4518 Hangup
    X connection to 172.24.30.34:1.0 broken (explicit kill or server shutdown).
    Have any idea from u :(

  • PO Form Issue with Header Level Changes

    Issue:
    It has been observed that whenever changes are done in PO Header (e.g. Header Text), system prints Billing Address and Communications Details as blank. If the changes are made to Line Item level along with header then system prints the Billing address and Communication Details correctly.
    Analyse:
    we are using the SELECT statement below to fetch the field for
    Billing Address and Communications Details.
    SELECT SINGLE
    mandt z_plant z_company_code z_toll_free_no z_local_no z_fax_no
    z_email z_name1 z_name2 z_street z_house_no z_district z_post_code
    z_city z_country z_vat_no z_loc_term_cond z_langu
      FROM zptp_poformdata
      INTO w_poformdata
      WHERE z_plant = ls_ekpo-werks
    AND   z_company_code = ls_ekpo-bukrs .  
    And when we only change the header level  data no value is passing for comany code and plant . as a result Select statement gets failed and we are getting blank window.
    NOTE: we are getting blank box only when we fire a print or fax.The preview is coming fine.

    by asking so many questions in a single post,you are violating the rule of engagement given below
    Only One Question Per Posting
    For each question that you have, make a separate posting. Don't ask multiple questions in one posting, this is confusing for people and might not get answered, since the subject line does not reflect all your problems. If a new and unrelated question comes up during a thread, start a new thread.

  • Headstart Designer generated form crashes with Java EOF error

    When closing a form while in Enter Query mode, the form crashes & user is
    disconnected from the database with error:
    FRM-92100: Your connection to the server was interrupted.
    Details:
    Java Excepton
    java.io.EOF Exception
    at java.io.DataInputStream.readUnsignedByte(Unknown Source)
    at oracle.forms.engine.Message.readDetails(Unknown Source)
    at oracle.forms.netStreamMessageReader.run(Unknown Source)

    Designer generates the ON-ERROR block level trigger. It has
    execution style of BEFORE. Therefore, both the block level and
    form level ON-ERROR triggers will fire.
    Normally, in the block level trigger, Designer will generate
    calls to its own message handling package to display any
    constraint errors. However, Designer also allows you to specify
    your own custom message handling package.
    The package must contain:
    - a procedure called PUSH
    - a function called MSGGETTEXT, and
    - a procedure called RAISE_FAILURE.
    The preference MSGSFT, Package Used for Messaging, allows you to
    record the name of the custom package.
    Once you have recorded this in the preference, whenever you
    generate a form, Designer will use your package and procedures
    for its error handling code. That is why you see calls to
    Headstart specific code in the block level ON-ERROR triggers.
    If you want to customize the ON-ERROR triggers, you need to make
    sure you understand how the MSGSFT preference is used. Read the
    online help. Then, you can customize individual blocks by adding
    application logic to the block, or you can add your own ON-ERROR
    trigger to the object library in the CG$BLOCK object.
    However, be warned that the Headstart error handling mechanism
    depends on this code. Depending on what you do, you could end up
    breaking things.

  • How to read a Value from Excel Cell into Oracle Forms 10g with Java

    Did any one Implamented a Java PJC to integrate Excel on Oracle Forms 10g?
    I Open Excel Applikation.
    Open a File like c:\import_test.xls
    read a number 05 from A:1 (i get it as return value).
    Save a number in a variable in Forms 10g
    Can any one help my please?
    Thanks

    why don't you use webutil.
    it has package client_ole2 which allows you to have programmatic interface with excel application.
    this is especially useful if the excel to be read is available in the client.

  • Running forms web with java

    Hello everybody.
    Normally Im running Forms (10g) from Windows client using Firefox 2.0 with Jinitiator 1.3.1.22.
    It is obsoleted I think.
    My questions are 2.
    There is any new version of Jinitiator that can be used with Window 7 or XP but with Firefox 3 or IE later versions?. If true please send me the link.
    Also
    Where I can find documentation to install the java to run Forms with latest IE.
    Thanks in advanced and regards to all.

    No versions of Oracle Jinitiator are supported on Vista, Win7, or any other newer MS OS. You must use the Sun JRE/JPI on these platforms. You did not mention which Forms version you are using so I will assume by "10g" you mean 10.1.2.x. Please refer to the following:
    http://www.oracle.com/technetwork/middleware/ias/downloads/as-certification-r2-101202-095871.html#BABGCBHA
    Be aware that in most cases, you must patch your Forms (or Application Server) installation to 10.1.2.3 if you have not already done so.

  • CS3 JS create textFrame with label then change content at a later stage.

    Is it possible to select a textframe by label?
    Here is a simple script which creates 2 text boxes labeled JSLabel and JSLabel2.
    var myDocument = app.documents.add();
    var myTextFrame = myDocument.pages.item(0).textFrames.add();
    myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
    myTextFrame.contents = "Hello World!";
    myTextFrame.label = "JSLabel";
    var myTextFrame = myDocument.pages.item(0).textFrames.add();
    myTextFrame.geometricBounds = ["8p", "8p", "24p", "24p"];
    myTextFrame.contents = "Hello World Again";
    myTextFrame.label = "JSLabel2";
    Here is a script you can run at a later stage to change the content of JSLabel textframe.
    if (app.activeDocument.textFrames[1].label == "JSLabel"){
    var mySelect = app.activeDocument.textFrames[1];
    app.select (mySelect);
    mySelect.contents = "Text has been changed.";
    Rather than using if (app.activeDocument.textFrames[1].label == "JSLabel") can I just select the textframe labeled JSLbel and change the content?

    Just bear in mind that if you have multiple frames with the same label, they'll all be affected if you set the content.
    Dave

  • How to upgrade Forms 11gR2 to use JAVA 7 after it was installed with JAVA 6

    I recently installed Forms 11gR2 on a development server.  We are trying to have the latest versions of everything to migrate from Forms 10g and assure we have support for the next few years.
    Our platform has the following software configuration:
    Solaris 10 (Update 19) SPARC 64 bits
    Weblogic 11g (10.3.6) that was installed with Java JDK 1.6.0_38
    Forms 11g R2 (11.1.2.1) that was also installed with
    Java JDK 1.6.0_38
    I tried to install Weblogic and Forms using the latest Java 7 JDK (1.7.0_25) but I got an error in the final steps of Forms setup, when I was configuring the domain.  I searched online and found a couple of tips but nothing worked.  The installation was stuck at the
    Creating Weblogic Domain step.  So I decided to try the installation process with the Java 6 JDK that we are using right now for Forms 10g, and it worked perfectly.  I have now two options but I don't know which one might be the better path:
    Uninstall Weblogic and Forms 11g completely, and try to re-install them again with Java 7, trying to fix the error that I got at the end of the configuration process.
    Try to upgrade the current Forms 11g installation from Java 6 to Java 7.  I found a blog that might suggest it is possible, but I don't know if it may cause additional issues along the road. http://pitss.com/us/2013/02/20/how-to-use-java-7-with-oracle-forms-11g-in-an-oracle-supported-environment/
    Thanks in advance for any suggestions you might have, or if any of you has experience installing Forms 11gR2 with Java 7 it might be great to know how to fix this error.  It might be worth mentioning that when I installed Forms and Weblogic with Java 6 I used exactly the same values, ports, options and paths.  The error appears like this in the installation logs and the process hangs there:
    XXX: adding task: oracle.as.install.classic.ca.standard.DomainProvisioningTask
      AdminServer port is 7001
      trying to connect to admuxas09.adminsrvad.sa.gov.au 7001
      Creating Weblogic Domain.
    oracle.as.provisioning.exception.ASProvWorkflowException
            at oracle.as.provisioning.weblogic.ASDomain._createDomain(ASDomain.java:2958)
            at oracle.as.provisioning.weblogic.ASDomain.createDomain(ASDomain.java:2476)
            at oracle.as.provisioning.engine.WorkFlowExecutor._createDomain(WorkFlowExecutor.java:633)
            at oracle.as.provisioning.engine.WorkFlowExecutor.executeWLSWorkFlow(WorkFlowExecutor.java:391)
            at oracle.as.provisioning.engine.Config.executeConfigWorkflow_WLS(Config.java:866)
            at oracle.as.install.classic.ca.standard.StandardWorkFlowExecutor.execute(StandardWorkFlowExecutor.java:65)
            at oracle.as.install.classic.ca.standard.AbstractProvisioningTask.execute(AbstractProvisioningTask.java:26)
            at oracle.as.install.classic.ca.standard.StandardProvisionTaskList.execute(StandardProvisionTaskList.java:61)
            at oracle.as.install.classic.ca.ClassicConfigMain.doExecute(ClassicConfigMain.java:124)
            at oracle.as.install.engine.modules.configuration.client.ConfigAction.execute(ConfigAction.java:371)
            at oracle.as.install.engine.modules.configuration.action.TaskPerformer.run(TaskPerformer.java:88)
            at oracle.as.install.engine.modules.configuration.action.TaskPerformer.startConfigAction(TaskPerformer.java:105)
            at oracle.as.install.engine.modules.configuration.action.ActionRequest.perform(ActionRequest.java:15)
            at oracle.as.install.engine.modules.configuration.action.RequestQueue.perform(RequestQueue.java:64)
            at oracle.as.install.engine.modules.configuration.standard.StandardConfigActionManager.start(StandardConfigActionManager.java:160)
            at oracle.as.install.engine.modules.configuration.boot.ConfigurationExtension.kickstart(ConfigurationExtension.java:81)
            at oracle.as.install.engine.modules.configuration.ConfigurationModule.run(ConfigurationModule.java:86)
            at java.lang.Thread.run(Thread.java:662)
    oracle.as.provisioning.exception.ASProvisioningException
            at oracle.as.provisioning.engine.Config.executeConfigWorkflow_WLS(Config.java:872)
            at oracle.as.install.classic.ca.standard.StandardWorkFlowExecutor.execute(StandardWorkFlowExecutor.java:65)
            at oracle.as.install.classic.ca.standard.AbstractProvisioningTask.execute(AbstractProvisioningTask.java:26)
            at oracle.as.install.classic.ca.standard.StandardProvisionTaskList.execute(StandardProvisionTaskList.java:61)
            at oracle.as.install.classic.ca.ClassicConfigMain.doExecute(ClassicConfigMain.java:124)
            at oracle.as.install.engine.modules.configuration.client.ConfigAction.execute(ConfigAction.java:371)
            at oracle.as.install.engine.modules.configuration.action.TaskPerformer.run(TaskPerformer.java:88)
            at oracle.as.install.engine.modules.configuration.action.TaskPerformer.startConfigAction(TaskPerformer.java:105)
            at oracle.as.install.engine.modules.configuration.action.ActionRequest.perform(ActionRequest.java:15)
            at oracle.as.install.engine.modules.configuration.action.RequestQueue.perform(RequestQueue.java:64)
            at oracle.as.install.engine.modules.configuration.standard.StandardConfigActionManager.start(StandardConfigActionManager.java:160)
            at oracle.as.install.engine.modules.configuration.boot.ConfigurationExtension.kickstart(ConfigurationExtension.java:81)
            at oracle.as.install.engine.modules.configuration.ConfigurationModule.run(ConfigurationModule.java:86)
            at java.lang.Thread.run(Thread.java:662)
    Caused by: oracle.as.provisioning.exception.ASProvWorkflowException: Error Executing workflow.
            at oracle.as.provisioning.engine.WorkFlowExecutor._createDomain(WorkFlowExecutor.java:686)
            at oracle.as.provisioning.engine.WorkFlowExecutor.executeWLSWorkFlow(WorkFlowExecutor.java:391)
            at oracle.as.provisioning.engine.Config.executeConfigWorkflow_WLS(Config.java:866)
            ... 13 more
    Cheers,
    Ivan Neva
    Oracle DBA

    Well if I got it to work with java 6 I'd leave it alone, to say the least. The elephant in the room is the certification matrix.
    http://www.oracle.com/technetwork/developer-tools/forms/overview/index.html
    there's 2 issues, what jdk does forms on the server want? Bigger question, what JRE is acceptable on the client?
    You would surely want the jre to be 7 on the client. Regarding the jdk on the server, you could leave it as is IMHO.
    Note that there was a patch to 11gr2. In conclusion, be sure to check the cert matrix regarding what is certified for the jdk for the server.
    I think the matrices are saying that if you have forms 11.1.2.1.0 that you can use the jdk 7. but like I said the big issue is what can the client use?
    As I read the matrix I think it is saying you have to have 11.1.2.1.0 to use the jre 7 on the client.
    So I would say if you have 11.1.2.1.0 on the server you are good because it's not a problem to have the jdk 6 on the server, if not you have to apply the patch in order to enable the jre 7 on the client.

  • Connection refused with java, but not javaw

    I have a ServerSocket based program...listening on a port. It is really a very simple program. And I can run it with javaw. Then I can use another problem, for example, telnet to connect to that port, just to prove I can connect to that port. Everything is fine.
    Now if I run the exactly the same ServerSocket program with java, then I got the connection refused error.
    It is weird.
    Do you know why? Do you know a good socket troubleshooting tool on Windows? I am afraid of the viruses, so I haven't downloaded any free tools yet.

    You're right.
    The Norton personal firewall does not handle localhost to localhost correctly. I do all the tests on the same machine. The netstat -an shows the port is listening in either case. But now I know the firewall blocks one of them silently. No rule prompt was triggered. Worse, no logging produced for that particular access.
    Thanks. You've been very helpful.

  • How to login to eBay programmatically with Java

    Hi,
    I'm trying to write a Java program that can handle logging in to eBay in order to retrieve certain user-specific information, for example My eBay, or list of items with email address. The way I've done is like this:
    Retrieve (HTTP GET) the initial page at http://cgi1.ebay.com/aw-cgi/eBayISAPI.dll?MyEbayLogin. Then capture all the cookies. The resulting HTML page has a form with some <input...> fields in there. So I concatenate all these <input...>, then send a HTTP POST to the URL on that form together with the concatenated parameters. For some reason, the resulting HTML page is back at http://cgi1.ebay.com/aw-cgi/eBayISAPI.dll?MyEbayLogin
    I've pretty sure I've handled the cookies alright, because when I leave out the cookies, I'll get a "Cookies Rejected" HTML page. I've also been able to log in to hotmail in similar fashion, so I think most (if not all) technical details are ok. These are the calls I made (among others):
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setDoOutput(true);
    conn.setDoInput(true);
    conn.setRequestMethod("POST");
    conn.setAllowUserInteraction(false);
    conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded" );
    conn.setInstanceFollowRedirects(false);
    conn.setUseCaches(false);
    conn.setRequestProperty("Cookie", cookie);
    My question is, has anyone succeeded in logging into eBay using Java, and if so could you share how you've done it (like, is there anything special to be done?). I'm asking this because when logging to hotmail.com, there were some twists that I had to look into (in javascript code) before the thing works. But I can't see anything similar in the eBay login page.
    Alternatively, is there away to intercept and peek into HTTP requests sent by IE? I have Ethereal but it's at protocol level only (I think), not HTTP messages/requests. I figure if I can read these requests that IE makes when it logs in, I can try applying the same behaviour (simulate) in my Java code.
    Many thanks!

    Right after I posted this, I tried again in desperation and guess what, it already works! It turns out that I was just impatient, the second time the page http://cgi1.ebay.com/aw-cgi/eBayISAPI.dll?MyEbayLogin is returned, you just have to retrieve it again, this time using the cookies that you got from previous log in. Keep going like that (when you see a 3xx Redirect code) and you'll get to your My eBay page eventually.
    Anyway, these are the pages that I access in case anyone is attempting to do the same thing:
    1. Use HTTP GET on http://cgi1.ebay.com/aw-cgi/eBayISAPI.dll?MyEbayLogin, get a 302 (Moved) header with location=http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn&UsingSSL=0&pUserId=&ru=http%3A%2F%2Fcgi1.ebay.com%2Faw-cgi%2FeBayISAPI.dll%3FMyEbayLogin&pp=pass&co_partnerid=2&pageType=174&i1=0 (Let's call this page 1a)
    2. Use HTTP GET on page 1a, get a HTML content page (with login form) and 2 cookies.
    3. Use HTTP POST to send form data to the URL in the login form (which is http://signin.ebay.com/aw-cgi/eBayISAPI.dll), remember to send all cookies as well. (Also this is provided you have an eBay account, the form will ask for username and passwd). Get back a 302 (Moved) with Location=http://cgi1.ebay.com/aw-cgi/eBayISAPI.dll?MyEbayLogin, and 7-8 cookies. Store all these cookies.
    4. Use HTTP GET to access http://cgi1.ebay.com/aw-cgi/eBayISAPI.dll?MyEbayLogin , again remember to send all the cookies. Get back 302 (Moved) with Location=http://cgi1.ebay.com/aw-cgi/ebayISAPI.dll?MyEbayItemsBiddingOn&userid=xxxxxxxxxxx&pass=xxxxxxxxxxxxxx&first=N&sellerSort=3&bidderSort=3&watchSort=3&dayssince=2&p1=0&p2=0&p3=0&p4=0&p5=0&ssPageName=MerchMax (Let's call this page 4a)
    5. Finally! Use HTTP GET to access page 4a and you're at the "My Ebay" page.
    After manually going through all this, you'll appreciate how much work the browser does each time it logs in to something. Also if you're planning to do this, it may save time in the long run to create a rudimentary browser that can display and handle the cookies automatically, (and takes care of form data too).

  • Unable to use free version regardless of browser on any machine. I login with adobe id but then the loading screen just hangs.

    Unable to use free version regardless of browser on any machine. I login with adobe id but then the loading screen just hangs. can't get any further - Tried all suggestions like clearing browser caches but no change.
    Got a couple of projects i wanted to try this on and if the software works I will probably take a subscription but considering this isn't working at all will look elsewhere.
    Also - adobe live chat support is useless.

    Hi,
    please share the Adobe ID that you are using with DL-AdobeStory-support<at>adobe<dot>com and we will investigate the issue.
    Thanks
    Aurobinda

  • Change (or add) a password to Active Directory with Java and JNDI

    I've create a new account in LDAP with attributs, It's ok. But a can't initialize the password, i've tryed some samples without result.
    Maybe it's a SSL problem (i don't know why, i read it somewhere).
    my code :
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import javax.naming.Context;
    import javax.naming.NameAlreadyBoundException;
    import javax.naming.NamingException;
    import javax.naming.directory.DirContext;
    import javax.naming.directory.InitialDirContext;
    import javax.naming.directory.BasicAttributes;
    import javax.naming.directory.BasicAttribute;
    import javax.naming.directory.ModificationItem;
    public class addUser {
         private static final String UNICODE = "Unicode";
         private static final String UNICODE_PASSWORD = "unicodePwd";
         public addUser() {}
         private Hashtable env;
         private DirContext ctx;
         private void _initialize()
         String jndiURL = "ldap://DOMAINSRV:389/";
         String initialContextFactory = "com.sun.jndi.ldap.LdapCtxFactory";
         String authenticationMode = "simple";
         String contextReferral = "ignore";
         String principal = "[email protected]";
         String credentials = "oce";
         env = new Hashtable();
         env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
         env.put(Context.PROVIDER_URL, jndiURL);
         env.put(Context.SECURITY_AUTHENTICATION, authenticationMode);
         env.put(Context.SECURITY_PRINCIPAL, principal);
         env.put(Context.SECURITY_CREDENTIALS, credentials);
         env.put(Context.REFERRAL, contextReferral);
         public boolean createUser()
         try
              ctx = new InitialDirContext(env);
              ctx.destroySubcontext("cn=FBXX,cn=users,DC=gedeon,DC=fr");
              BasicAttributes attrs = new BasicAttributes();
              BasicAttribute ocs = new BasicAttribute("objectclass");
              ocs.add("user");
              attrs.put(ocs);
              BasicAttribute sa = new BasicAttribute("sAMAccountName", "FBXX");
              attrs.put(sa);
              BasicAttribute na = new BasicAttribute("name", "FRANCOIS BERTOUX");
              attrs.put(na);
              BasicAttribute sn = new BasicAttribute("sn", "BERT");
              attrs.put(sn);
              BasicAttribute up = new BasicAttribute("userPrincipalName", "[email protected]");
              attrs.put(up);
              BasicAttribute ua = new BasicAttribute("userAccountControl", "512");
              attrs.put(ua);
              BasicAttribute dn = new BasicAttribute("displayName", "FRA BERT");
              attrs.put(dn);
              BasicAttribute gn = new BasicAttribute("givenName", "FRA");
              attrs.put(gn);
              BasicAttribute des = new BasicAttribute("description", "CECI EST MON TEST");
              attrs.put(des);
              BasicAttribute cp = new BasicAttribute("codePage", "0");
              attrs.put(cp);
              BasicAttribute cc = new BasicAttribute("countryCode", "0");
              attrs.put(cc);
              BasicAttribute it = new BasicAttribute("instanceType", "4");
              attrs.put(it);
              ctx.createSubcontext("cn=FBXX,cn=users,DC=gedeon,DC=fr", attrs);
              changePassword ("cn=FBXX,cn=users,DC=gedeon,DC=fr", "TOTO" , "FBX");
              ctx.close();
         catch (NameAlreadyBoundException nex)
              System.out.println("User ID is already in use, please select a different user ID ...");
         catch (Exception ex)
              System.out.println("Failed to create user account... Please verify the user information...");
              ex.printStackTrace();
         return true;
    public final void changePassword(
    String argRDN,
    String argOldPassword,
    String argNewPassword)
    throws NamingException
         ModificationItem modificationItem[] = new ModificationItem[2];
         try
              modificationItem[0] = new ModificationItem(DirContext.REMOVE_ATTRIBUTE,new BasicAttribute("unicodePwd",(byte[])this.encodePassword(argOldPassword)));
              modificationItem[1] = new ModificationItem(DirContext.ADD_ATTRIBUTE,new BasicAttribute("unicodePwd",(byte[])this.encodePassword(argNewPassword)));
         catch (UnsupportedEncodingException e1)
              System.out.println("changePassword(String argOldPassword, String argNewPassword)" +
              "Passwordchange failed: " + e1.toString());
              throw new RuntimeException(e1.toString());
         try
              ctx.modifyAttributes(argRDN, modificationItem);
         catch (NamingException e1)
              System.out.println(
              "changePassword(String argOldPassword, String argNewPassword)" +
              "Passwordchange failed : " + e1.toString());
              throw e1;
    private byte[] encodePassword(String pass) throws UnsupportedEncodingException
         final String ATT_ENCODING = "Unicode";
         // Agree with MS's ATTRIBUTE_CONSTRAINT
         String pwd = "\"" + pass +"\"";
         byte bytes[] = pwd.getBytes(ATTENCODING);
         // strip unicode marker
         byte bytes[] = new byte [_bytes.length - 2];
         System.arraycopy(_bytes, 2, bytes, 0,_bytes.length - 2);
         return bytes;
         public static void main(String[] args)
              addUser testUser = new addUser();
              testUser._initialize();
              testUser.createUser();
    And the result is :
    changePassword(String argOldPassword, String argNewPassword)Passwordchange failed : javax.naming.OperationNotSupportedException: [LDAP: erro
    r code 53 - 00002077: SvcErr: DSID-03190ADF, problem 5003 (WILL_NOT_PERFORM), data 0
    ]; remaining name 'cn=FBXX,cn=users,DC=gedeon,DC=fr'
    Failed to create user account... Please verify the user information...
    javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 00002077: SvcErr: DSID-03190ADF, problem 5003 (WILL_NOT_PERFORM), data 0
    ]; remaining name 'cn=FBXX,cn=users,DC=gedeon,DC=fr'
    at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:2804)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2677)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2483)
    at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1285)
    at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(ComponentDirContext.java:253)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:170)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:159)
    at javax.naming.directory.InitialDirContext.modifyAttributes(InitialDirContext.java:144)
    at addUser.changePassword(addUser.java:129)
    at addUser.createUser(addUser.java:92)
    at addUser.main(addUser.java:167)
    And with "userPassword" no error but no change.
    Please, help.
    Thanks

    Hello!
    I have a new variant of the set password problem, and as i did not get any longer with a big running application i wrote a small standalone program to connect to an Active Directory server, and, hm, it works! I can login with a account which has administrator priveledges, i can set passwords, works fine, unless, and now it gets a little bit curious, unless i change the VM.
    Everything works fine with a jdk 1.5.0_07, but if i switch over to the fine new 1.6.0_16, the login works still but the change of a password leads to a not so fine javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 0000001F: SvcErr: DSID-031A0FC0, problem 5003 (WILL_NOT_PERFORM), data 0.
    As i use the same cacerts file, i do not really understand what is failing here, anyone who has an idea?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Hey,i forgot my login password,so i changed the password by using terminal command(reset password).now i have new user name with new password,but i can't find  my data which i have saved on mac.please help me out in this matter.

    hey,i forgot my login password,so i changed the password by using terminal command(reset password).now i have new user name with new password,
    but i can't find  my data which i have saved on mac.the storage is showing data used and free space on the disk
    please help me out in this matter.

    How did you change your user name?
    resetpassword wouldn't have done it. If you managed to create a new user, then your data is still in the old account.

  • Autocomplete forms with Java

    I am looking for a way to autocomplete login forms(In a web browser, IE) with a Java program.
    Does anyone know of a method, or if this is possible with Java? What about JNI?

    I think you cannot do that very simple because autocomplete it is made on the client..and you don;t have access there only with (javascript, applets...activex)
    Or you can use cookies to identify the client and ajax to complete login form with the password...
    anyway I don;t think it is a good approach to autocomplete login forms.

Maybe you are looking for

  • PDF file size increases several folds after OCR

    Hello, I've been using Acrobat Pro 9.  Whenever I receive a scanned PDF from someone, I always try to OCR it.  I thought this would reduce the file size because it's saved as text characters instead of images.  However, the file size actually increas

  • Front Row auto launches on login

    Now why would that be? About 4-5 seconds after logging in my user, Leopard auto launches Front Row. Leopard is choosy in this regard, as it does not extend the same 'courtesy' for my wife's account or that of the sysadmin. Anyone else seen this oddit

  • ADF 11g: inputText - mark the hole text when move into text field

    Hallo, is it possible to change the behavior of a inputText component in a way that the hole text is marked when changing the focus to this component? In the standard case the cursor is on the left-aligned position of the inputText. The goal would be

  • Database issue

    Hi All, I have a small problem with the database (mysql) that i have set up. So to start off the website is for a funeral directors, within this site is a page where people can donate (http://www.milesfunerals.com/donations_2.php ), they put the name

  • IO 229 - Batch for serial number 1234 (BBB) differs from document batch AAA

    Hello All, We use batch management for serialized materials only at our central plant. For all other plants, there is no batch control. Sometimes we need to return materials back to the central plant but with a different batch number. When we do two