• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

No output

 
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 4801
50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic