Tag Archives: problems

Ouch!

I had a minor bicycle malfunction that turned into an accident on the Cross Seminole Trail.

To pun it shortly: I fought the ground, and the ground won!

Ouch!

Think I look bad? You should have seen the other guy!

When is a Struct not a Struct?

I’ve run into an annoying problem trying to get some older java code working under ColdFusion 8. The problem method accepts two arguments, java.util.Hashmap and java.util.Vector, but the signature isn’t matching.

Here’s the set up:

<cfset classpath = [
  CreateObject( "java","java.net.URL" ).init( "file:#cfusion#" ),
  CreateObject( "java","java.net.URL" ).init( "file:#testfile#" )
] />

<cfset loader  = CreateObject( "java","java.net.URLClassLoader" ).Init(
  classpath
) />
<cfset example = loader.LoadClass( "ProblemExample" ).NewInstance() />

<cfset cfarray  = ArrayNew(1) />
<cfset cfstruct = StructNew() />

<cfdump var="#example#" />

My sample method looks good…

public void originalMethod(java.util.Hashtable h,java.util.Vector v){}

The dump looks greatdump

But I’m getting a “method was not found” error

I did a bit of googling, and found a great post about the differences between CF7 and CF8 structs and arrays. Perfect…right?

I wrote a little test method to accept a coldfusion.util.FastHashtable:

public void takeFastHashtable(coldfusion.util.FastHashtable fh){}
method was not found"

I wrote a little script, to see what I was dealing with:

<cfoutput>
  #cfstruct.getClass().getName()# == #example.inspect(cfstruct)#
  => #cfstruct.getClass().getName() EQ example.inspect(cfstruct)#
</cfoutput>

using

public String inspect( Object o ) {
  return o.getClass().getName();
}

And my output was as expected:
coldfusion.runtime.Struct == coldfusion.runtime.Struct => YES

So I wrote a up a simple test method for coldfusion.runtime.Struct:

public void testStruct(coldfusion.runtime.Struct s){}
<cfset example.testStruct(s) />

You guessed it:

"method was not found"

Okay….let’s try casting….

public coldfusion.runtime.Struct castAsStruct(Object o) {
  return (coldfusion.runtime.Struct) o;
}

This time the error’s a little different…

coldfusion.runtime.Struct cannot be cast to coldfusion.runtime.Struct
W T F

Granted, I’m trying to use underlying undocumented code, and I’m no Java expert, but there’s something here that’s not adding up. Is this a bug? Am I missing something stupid? At this point I’ll be moving on to alternative solutions, but any help would be still greatly appreciated.

You can download some sample code I’ve been using, just make sure to compile with the appropriate classpath for your environment.

Here’s my command

javac ProblemExample.java -classpath /opt/coldfusion8/lib/cfusion.jar

Chase Paymentech / CFHTTP Problem

I was working on implementing a ColdFusion payment processor for Chase Paymentech, but I kept running into the same error (which I’ve formatted so nicely using my ruby clipboard format utility!)

<?xml version='1.0' encoding='UTF-8'?>
<Response>
    <QuickResp>
        <ProcStatus>05</ProcStatus>
        <StatusMsg>PTI43,TEXT/XML; CHARSET=UTF-8 is not supported</StatusMsg>
    </QuickResp>
</Response>

I knew that PTI43 was part of the MIME Header Content-Type I was passing, so I did a little bit of poking around in the docs and came upon this. Apparently setting a cfhttpparam type of “xml” “identifies the request as having a content-type of text/xml.”.

In order to send a valid message to chase you have to specify a particular MIME header setting “Content-Type”, which ColdFusion was garbling. Thankfully all I had to do to fix it was switch the cfhttpparam type attribute to “body” in order to fix it.

<cffunction name="Authorize" output="no">
    <cfargument name="vars" required="yes"/>

    <cfset var cfhttp = ""/>
    <cfset var i = ""/>

    <cfheader name="POST /AUTHORIZE HTTP/1.1">
    <cfhttp url="#GetURL()#" port="#GetPort()#" method="POST">
        <cfloop collection="#arguments.vars#" item="i">
            <!--- header variables --->
            <cfif i NEQ "XML">
                <cfhttpparam
                    type="header"
                    name="#i#"
                    value="#arguments.vars[i]#"
                />
            </cfif>
        </cfloop>

        <!--- set the type to "body" NOT "xml"!!! --->
        <cfhttpparam
            type="body"
            value="#arguments.vars["XML"]#"
        />
    </cfhttp>

    <cfreturn cfhttp/>
</cffunction>

I hadn’t run into this problem before, so I thought I’d share!

Ps3 Bad Company Update Problem

I’d tried a few times over the last week to update Battlefield: Bad Company on the PlayStation 3. Every time I tried I would get hung up on the “Downloading update data…” screen. It would stay at 0% for a few minutes and then briefly flash me an error code in the top right corner (8002AD23) and a few minutes after that it’d bounce me to another screen: “An error occurred during the download operation (80710723)”

I googled around for a while. Opened some ports on the router, plugged directly into the wall, restarted. I finally found somewhere that recommended I disable my media server via the network settings and BAM! “fixed”

My “source” for the “fix”: http://www.fixya.com/support/t291065-ps3_system_update_error

Ubuntu Hardy Heron ColdFusion 8 Oopsie

Somehow I managed to bugger up the ColdFusion installation on my beloved laptop. Whenever I would try to start the cf server I would get the following not-very-helpful message.

Running the ColdFusion 8 connector wizard
======================================================================
Configuring the web server connector
(Launched on the first run of the ColdFusion 8 start script)
Running apache connector wizard...
=======================================
There was an error while running the connector wizard
Connector installation was not successful

I googled around enough to realize that since it didn’t appear to be a common problem, that it was probably something I did. And it was.

As you may have figured out by now, I’m not a server-config kind of guy. I poked around a little bit and found an interesting looking shell script at /opt/coldfusion8/bin/connectors/apache_connector.sh. Running that gave me a much better error message:

Could not find directory /etc/apache2/apache2.conf

I opened the file and realized that the paths were all boogered up, meaning the paths I entered when installing ColdFusion where all buggered up. In any case, I fixed the incorrect paths and here’s what the file looks like now:

#!/bin/sh

#
# Configure the Apache connector.
#	-dir should be the *directory* which contains httpd.conf
#	-bin should be the path to the apache *executable*
#	-script should be the path to the script which is used to 
#		start/stop apache
#
../../runtime/bin/wsconfig 
	-server coldfusion 
    -ws apache 
	-dir /etc/apache2 
	-bin /usr/sbin/apache2 
	-script /etc/init.d/apache2 
 	-coldfusion

exit $#

And Voila!