Note that there are some explanatory texts on larger screens.

plurals
  1. POColdFusion/Java - "The build method was not found"
    text
    copied!<p>We are using some org.apache classes as part of implementing WS Security for a webservice.</p> <pre><code>variables.paths = arrayNew(1); variables.paths[1] = getDirectoryFromPath(getCurrentTemplatePath()) &amp; "lib\wss4j-1.5.8.jar"; variables.paths[2] = getDirectoryFromPath(getCurrentTemplatePath()) &amp; "lib\xmlsec-1.4.2.jar"; variables.loader = createObject("component","lib.javaloader.JavaLoader").init(loadPaths=variables.paths,loadColdFusionClassPath=true); variables.WSConstantsObj = loader.create("org.apache.ws.security.WSConstants"); variables.messageClass = loader.create("org.apache.ws.security.message.WSSecUsernameToken"); variables.secHeaderClass = loader.create("org.apache.ws.security.message.WSSecHeader"); </code></pre> <p>The following code:</p> <pre><code>&lt;cfset var msg = getMessage()&gt; </code></pre> <p>produces:</p> <p><img src="https://i.stack.imgur.com/88F80.gif" alt="enter image description here"></p> <p>The following code:</p> <pre><code>&lt;cfset var secHeader = getSecHeader()&gt; </code></pre> <p>produces:</p> <p><img src="https://i.stack.imgur.com/AN3zS.gif" alt="enter image description here"></p> <p>The following code:</p> <pre><code>&lt;cfset var env = soapEnv.getDocumentElement()&gt; </code></pre> <p>produces:</p> <p><img src="https://i.stack.imgur.com/cDgL1.gif" alt="enter image description here"></p> <pre><code>env.getOwnerDocument() </code></pre> <p>produces a huge structure (too big to include here), which you can <a href="http://www.china-buy.com/tga/index.cfm?viewDump" rel="nofollow noreferrer">view here</a>.</p> <p>However, the following code:</p> <pre><code>&lt;cfset e = msg.build(env.GetOwnerDocument(),secHeader)&gt; </code></pre> <p>throws the error:</p> <pre><code> The build method was not found. Either there are no methods with the specified method name and argument types or the build method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that match the provided arguments. If this is a Java object and you verified that the method exists, use the javacast function to reduce ambiguity. </code></pre> <p>However the Build() method certainly exists, as per the yellow highlight in the first screenshot.</p> <p>The error message talks about "...use the javacast function to reduce ambiguity". If this were the problem, how would I apply this solution?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload