Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problem using HSBCHashGenerator CFX

Guest
Sep 30, 2014 Sep 30, 2014

Upgrading from MX7 to 10.

Got a .jar file "cpitools.jar" which I've put into /opt/coldfusion10/jre/lib

If I do a jar -tf on it, I get:

com/clearcommerce/CpiTools/security/Encrypter.class

com/clearcommerce/CpiTools/security/HashGenerator.class

com/clearcommerce/CpiTools/security/SecCrypto.class

META-INF/MANIFEST.MF

I've registered it in the CFIDE:

TagName: CFX_HSBCHashGenerator

ClassName: com.clearcommerce.CpiTools.security.HashGenerator

BUT when I try to call it...

<CFX_HSBCHashGenerator SharedSecret="#ss#" HashElement="#datainput#">

I get the error message: The CFX custom tag CFX_com.clearcommerce.CpiTools.security.HashGenerator was not found in the custom tag database. You must add custom tags to the database before using them. If you have added your tag to the database, check the spelling of the tag within your template to ensure that it matches the database entry.

-----

So when it says "you must add custom tags to the database" - it's referring to the registration of the Java CFX, right?

So I've done that. so I check the spelling of the tag - looks OK to me (and it is unchanged since the functional MX7 code).

Obviously the mapping is working to some extent - CF was clever enough to realise that when I say <CFX_HSBCHashGenerator...., I am referring to something with "com.clearcommerce.CpiTools.security.HashGenerator".

So what's my blindingly obvious in retrospect error?!

TOPICS
Advanced techniques
347
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Sep 30, 2014 Sep 30, 2014

Just a little update:

If I put cpitools.jar into /opt/coldfusion10/cfusion/wwwroot/WEB-INF/classes

And then add /opt/coldfusion10/cfusion/wwwroot/WEB-INF/classes into the ColdFusion Class Path, the error changes to this:

A ClassCastingException occured. The CFX custom tag CFX_com.clearcommerce.CpiTools.security.HashGenerator needs to implement com.allaire.cfx.CustomTag interface. Ensure that you add this to your custom class.


If I understand this correctly, I can no longer use a generic Java class i

...
Translate
Guest
Sep 30, 2014 Sep 30, 2014
LATEST

Just a little update:

If I put cpitools.jar into /opt/coldfusion10/cfusion/wwwroot/WEB-INF/classes

And then add /opt/coldfusion10/cfusion/wwwroot/WEB-INF/classes into the ColdFusion Class Path, the error changes to this:

A ClassCastingException occured. The CFX custom tag CFX_com.clearcommerce.CpiTools.security.HashGenerator needs to implement com.allaire.cfx.CustomTag interface. Ensure that you add this to your custom class.


If I understand this correctly, I can no longer use a generic Java class in CF10 - it HAS to be one that has some ColdFusion specific stubs added.

That sounds like a right royal PITA! I don't want to be messing around changing other people's .jar files and getting my hands dirty with Java. There MUST be a way around this, surely?!

OK - the answer is not to use CFX at all!

Just instantiate a JavaObject and call its method:

    <cfset HashGenerator = createObject("java","com.clearcommerce.CpiTools.security.HashGenerator")>

    <cfset OrderHash = HashGenerator.generateHash(v,ss)>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources