Re: Bcrypt.class error
Do you have all the cf10 updates installed? Always worth ruling that out first. On Fri, Dec 19, 2014 at 19:26 PM, Dean Lawrence dean...@gmail.com wrote: Well, this ended up not working, as it failed again first thing this morning. I tried re-initing my app and it still did threw the error. What also found out though, was that instead of rebooting CF, I could get it to work by renaming the webservice CFC, making a call to the webservice (which generated and error) and then renaming the CFC back to the original name. After I did this, the app was able to authenticate again. So this tells me that the CFC is cached somewhere, but I do not know where. I tried emptying both the template and component caches from the CF admin, but this did not resolve the issue. Does anyone know how/where CF would be caching this and how to programmatically refresh it? On Thu, Dec 18, 2014 at 2:52 PM, Russ Michaels r...@michaels.me.uk javascript:; 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. -- [image: profile picture] *Dean Lawrence* *President* Internet Data Technology *Phone:* 888-438-4381 x701 *Web:* www.idatatech.com *Email:* d...@idatatech.com javascript:; 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:359864 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Bcrypt.class error
Yes Russ, I have update 15 installed. On Fri, Dec 19, 2014 at 3:07 PM, Russ Michaels r...@michaels.me.uk wrote: Do you have all the cf10 updates installed? Always worth ruling that out first. On Fri, Dec 19, 2014 at 19:26 PM, Dean Lawrence dean...@gmail.com wrote: Well, this ended up not working, as it failed again first thing this morning. I tried re-initing my app and it still did threw the error. What also found out though, was that instead of rebooting CF, I could get it to work by renaming the webservice CFC, making a call to the webservice (which generated and error) and then renaming the CFC back to the original name. After I did this, the app was able to authenticate again. So this tells me that the CFC is cached somewhere, but I do not know where. I tried emptying both the template and component caches from the CF admin, but this did not resolve the issue. Does anyone know how/where CF would be caching this and how to programmatically refresh it? On Thu, Dec 18, 2014 at 2:52 PM, Russ Michaels r...@michaels.me.uk javascript:; 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. -- [image: profile picture] *Dean Lawrence* *President* Internet Data Technology *Phone:* 888-438-4381 x701 *Web:* www.idatatech.com *Email:* d...@idatatech.com javascript:; 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:359868 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Bcrypt.class error
Thanks Byron, Yes, the error is being generated by the checkpw method. Since the method is working as written, I don't think that moving the checkpw call to a set statement will alleviate the issue. When it decides to fail, it fails using the exact same credentials call from the client side, so I know that it is not an issue of incorrect values being passed in. Also, even with the more granular error checking, if the checkpw method decided to start failing, I would ultimately receive the ambiguous NullPointerException error. I may add the additional tests once the app goes live, since I won't be dealing with controlled data, but I don't think that it will benefit me with this current issue. I am trying the application scoped suggestion as offered by Russ, since I know that I can refresh that variable even if the webservice is cached somewhere else. So far it has not failed again, so I am hoping that it solved the issue. Thanks again for you input Byron. On Thu, Dec 18, 2014 at 3:21 PM, Byron Mann byronos...@gmail.com wrote: 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. -- [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:359860 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Bcrypt.class error
Well, this ended up not working, as it failed again first thing this morning. I tried re-initing my app and it still did threw the error. What also found out though, was that instead of rebooting CF, I could get it to work by renaming the webservice CFC, making a call to the webservice (which generated and error) and then renaming the CFC back to the original name. After I did this, the app was able to authenticate again. So this tells me that the CFC is cached somewhere, but I do not know where. I tried emptying both the template and component caches from the CF admin, but this did not resolve the issue. Does anyone know how/where CF would be caching this and how to programmatically refresh it? 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. -- [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:359861 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Bcrypt.class error
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:359855 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Bcrypt.class error
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:359856 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Bcrypt.class error
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.;