Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 155 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I've tried submitting the following question a couple of times, and each time I get the message: An error occurred submitting the question. I don't know what the problem is. Why am I getting this error?

The question I'm attempting to post is this:

I have been asked to add Spring Security in a project. Previously, hashing was done manually like this:

public final class PasswordEncryption
{
  private static PasswordEncryption instance;
  private PasswordEncryption() 
  {
  }
  public synchronized String encrypt(String plaintext) throws UnavailableException
  {
    MessageDigest md = null;
    try
    {
      md = MessageDigest.getInstance("SHA-256"); //step 2
    }
    catch(NoSuchAlgorithmException e)
    {
      System.out.println("NoSuchAlgorithmException");

    }
    try
    {
      md.update(plaintext.getBytes("UTF-8")); //step 3
    }
    catch(UnsupportedEncodingException e)
    {
      throw new UnavailableException(e.getMessage());
    }
    byte raw[] = md.digest(); //step 4
    String hash = (new BASE64Encoder()).encode(raw); //step 5
    return hash; //step 6
  }
  public static synchronized PasswordEncryption getInstance() //step 1
  {
    if(instance == null)
    {
      return new PasswordEncryption();
    }
    else    
    {
      return instance;
    }
  }
}

Now I have changed it to this:

<authentication-manager>      <authentication-provider>           <password-encoder hash="sha-256" base64="true" />
      <jdbc-user-service data-source-ref="dataSource"
          users-by-username-query="
        select username, password, status 
        from user where email = ?" />         </authentication-provider>  </authentication-manager>

When i try to login, I get the error Bad credentials. I have checked the query it is correct and returns the correct value. So I figure the problem must be in hashing.

Error

share|improve this question

closed as off-topic by nicael, Shadow Wizard, Lance Roberts, Martijn Pieters, CRABOLO Oct 2 '14 at 19:43

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "The problem described here can no longer be reproduced. Changes to the system or to the circumstances affecting the asker have rendered it obsolete. If you encounter a similar problem, please post a new question." – Lance Roberts, Martijn Pieters, CRABOLO
  • "This question pertains only to a specific site in the Stack Exchange Network. Questions on Meta Stack Exchange should pertain to our network or software that drives it as a whole, within the guidelines defined in the help center. You should ask this question on the meta site where your concern originated." – nicael, Shadow Wizard
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Did you try again? – doppelgreener Feb 10 '14 at 6:03
1  
I'm guessing it's because the entire post is within a blockquote. – Jamal Feb 10 '14 at 6:03
2  
@JonathanHobbs Yes I have tried again. I have closed the tab and did it again in a new tab and still the same error. – khateeb Feb 10 '14 at 6:09
2  
@Jamal I did that just for this question. My original question has no blockquotes. – khateeb Feb 10 '14 at 6:10
    
Oh, okay. Sorry about that. – Jamal Feb 10 '14 at 6:10
4  
Why the downvote? – khateeb Feb 10 '14 at 6:12
20  
Why is this question being voted to be closed as a programming question? This is an on-topic meta question, people! It just has a programming question quoted in it, because it is about that programming question. – doppelgreener Feb 10 '14 at 6:24
1  
Could you post a screenshot? Maybe there is a message you simply are seeing but not noticing? – Mołot Feb 10 '14 at 7:48
    
When I was adding this screenshot, I got another error: Error in posting edit. So I had to upload it from my colleague's PC. But when I tried posting my original question from his computer it still showed the same error. – khateeb Feb 10 '14 at 8:38
    
What title have you used for the question? And what IP address are you posting from when showing this error? – Oded Feb 10 '14 at 11:12
    
@Oded The title is 'Spring Security hash not working properly' and I am using my company proxy server whose IP is 223.30.78.110. – khateeb Feb 10 '14 at 11:44
3  
OK. Wanted to rule out a few options. Are you still unable to post the question? Can you log out, clear all your cookies, log back in and try again if so? – Oded Feb 10 '14 at 11:47
2  
@Oded That did it. Thanks. – khateeb Feb 10 '14 at 11:59
1  
@Oded think this better be posted as answer so it can be used as reference. – Shadow Wizard Feb 19 '14 at 13:03
    
FWIW, I frequently get this error when answering questions, and it's because my internet has dropped. – OGHaza Feb 19 '14 at 13:29