Based on your description, I think this is the line causing an error.

bcrypt.checkpw(lcase(password),Member.getMemberPassword())

I might just add some more granular logging before the statement that would
maybe nail down what is amiss.

try {  writeoutput(lcase(password)); } catch (any e) {  write error 1 }
try {  writeoutput(Member.getMemberPassword()); } catch (any e) {  write
error 2 }
try {  writeoutput(bcrypt.checkpw('test','test')); } catch (any e) {  write
error 3 }
try {  writeoutput(bcrypt.checkpw(lcase(password),Member.
getMemberPassword())); } catch (any e) {  write error 4 }
bcrypt.checkpw(lcase(password),Member.getMemberPassword())

Could maybe also pull out the checkpw function from inside the if an set to
a variable.

var chkResult = bcrypt.checkpw(lcase(password),Member.getMemberPassword())
if(isDefined("chkResult") and !isNull(chkResult) and isBoolean(chkResult)
and chkResult){.....

if statement might be a bit overkill, but may handle the error more
gracefully.



On Thu, Dec 18, 2014 at 3:03 PM, Dean Lawrence <dean...@gmail.com> wrote:
>
>
> Yea, it is the generic nature of the error that is so frustrating. Like I
> said, I can still call the same class file and make the identical method
> call from another cf file even after the webservice starts throwing the
> error, so my assumption is that it is being cached somewhere. I tried
> clearing the template and cfc caches which had no affect on it though. If I
> knew that I could reset it without having to reboot CF, I could then build
> a test to do so on error. I'll try your suggestion of caching it in the
> application scope and see if that fixes the issue. Thanks Russ.
>
> On Thu, Dec 18, 2014 at 2:52 PM, Russ Michaels <r...@michaels.me.uk>
> wrote:
> >
> >
> > that is a pretty generic error, but as it only happens after a while you
> > might solve the problem by caching your object in application scope so it
> > doesn;t have to be instan tiated every time.
> >
> > application.bcrypt = CreateObject("java", "BCrypt");
> >
> > obviously check that it exists before creating it , or you are just doing
> > the same thing.
> >
> > On Thu, Dec 18, 2014 at 7:36 PM, Dean Lawrence <dean...@gmail.com>
> wrote:
> > >
> > >
> > > I am using the java bcrypt class library to encrypt passwords on one of
> > my
> > > sites and it is working fine. However, I am extending the app with a
> > > webservice and using the same bcrypt library to authenticate logins.
> This
> > > works fine for a period of time and then stops working.
> > >
> > > The error that I receive is "An exception occurred when executing
> method
> > > checkpw.". The error detail is "The cause of this exception was that:
> > > java.lang.NullPointerException.". Even when I start to receive this
> > error,
> > > I am still able to make the exact same call from within a CF template
> > > without a problem. But being called from the webservice, I get the
> > error. I
> > > have tried reinitializing the app to no avail. The only way that I have
> > > been able to fix the issue is by rebooting CF. I am using ACF 10 and
> here
> > > is the code that I am using to call bcrypt.
> > >
> > > component  displayname="Consumer API" output="false" wsversion="2"
> > > namespace="http://mydomain/";
> > > {
> > >     variables.bcrypt = CreateObject("java", "BCrypt");
> > >
> > >     remote struct function authenticate() returnformat="JSON" {
> > >         var results = {};
> > >         var memberEmail = "";
> > >         var password = "";
> > >         var token = "";
> > >
> > >         results.status = 0;
> > >         results.message = "Invalid email or password";
> > >
> > >         if (isSOAPRequest()){
> > >             try
> > >             {
> > >                 memberEmail = getSOAPRequestHeader("http://mydomain/";,
> > > "memberEmail");
> > >                 password = getSOAPRequestHeader("http://mydomain/";,
> > > "password");
> > >
> > >                 if (isValid("email",memberEmail)){
> > >                     Member =
> > entityLoad("Member",{email=memberEmail},true);
> > >
> > >                     if (NOT isNull(Member)){
> > >                         if
> > > (bcrypt.checkpw(lcase(password),Member.getMemberPassword())){
> > >                             results.message = "Successfully
> > Authenticated";
> > >                             token =
> > > variables.utility.formStringEncrypt(Member.getMemberID());
> > >                             addSOAPResponseHeader("http://mydomain/";,
> > > "token", token, false);
> > >                             results.status = 1;
> > >                             results.message = "Member authenticated";
> > >                         } else {
> > >                             addSOAPResponseHeader("http://mydomain/";,
> > > "token", token, false);
> > >                         }
> > >                     } else {
> > >                         addSOAPResponseHeader("http://mydomain/";,
> > "token",
> > > token, false);
> > >                     }
> > >                 } else {
> > >                         addSOAPResponseHeader("http://mydomain/";,
> > "token",
> > > token, false);
> > >                 }
> > >             }
> > >             catch(Any e)
> > >             {
> > >                 results.message = "Error processing request.";
> > >                 sendError(e);
> > >             }
> > >         } else {
> > >             results.message = "Not invoked as a web service";
> > >         }
> > >
> > >         return results;
> > >     }
> > > }
> > >
> > > Any help would be greatly appreciated.
> > >
> > > --
> > >
> > >   [image: profile picture]  *Dean Lawrence*
> > > *President*
> > > Internet Data Technology
> > > *Phone:* 888-438-4381 x701
> > > *Web:* www.idatatech.com
> > > *Email:* d...@idatatech.com
> > >   Programming | Database | Consulting | Training
> > >
> > >
> > >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:359857
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to