• Post Reply Bookmark Topic Watch Topic
  • New Topic

No output  RSS feed

 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am developing a web application using hibernate and AWS SDK (though I haven't been working on java for long). I have the following servlet and JSP code:

JSP


SERVLET

and my authentication method is:




When I run the project, The customer name is displayed, i click the link and next webpage with the url : http://localhost:8080/CustomerRecords/ServiceApp?accountID=12345678 is opened but i do not see anything in either the console or the webpage. I have a table in my database that has columns accesskey, secretkey, accountID, companyName etc. I want to authenticate the user using the secret and access keys from the database of the particular customer I click on my webpage. What am i possibly doing wrong?

NOTE: When I had given the parameters in the authentication method as hard-coded values, and was simply calling my other methods from GET method, I was getting the outputs.

Plus, is there any way that I can use the POST method instead of GET.

Please let me know if I should add more code in my question but I guess that would be enough.
Any help would be much appreciated. Thanks
 
Dave Tolls
Rancher
Posts: 2914
36
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


You have an empty catch block in your doGet.
You could well be getting an exception and not know anything about it.
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There was an empty catch clause so i was unable to see the exceptions, problem is with MD5 decoding. I removed the catch clause and commented the lines from my decode method:

// String decrypted = decrypt(encrypt(str));
// System.out.println("Decrypted: " + decrypted);
although the encoder method works fine.


Now i see the following exception :
java.lang.NullPointerException
at com.md5.example.JavaMD5Hash.decrypt(JavaMD5Hash.java:57)
at com.aws.customers.ServiceApp.doGet(ServiceApp.java:18)
java.lang.NullPointerException
at com.md5.example.JavaMD5Hash.decrypt(JavaMD5Hash.java:57)
at com.aws.customers.ServiceApp.doGet(ServiceApp.java:19)
 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll get a NullPointerException, so that should be fairly easy to debug.

I would guess str is null for some reason...

And another remark about your code: is there any reason why your static (class) members are not initialized in a static initializer block, but are each time assigned in the encrypt/decrypt methods? If you need another instance with each invocation of the encrypt/decrypt methods, it should not be static (class) members, but local variables! Otherwise you should initialize them in a static initializer block (and marked as final).
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!