6 Replies - 5090 Views - Last Post: 15 July 2011 - 07:11 PM Rate Topic: -----

#1 bahareh77  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-July 11

Element 1 is undefined in a Java object of type class coldfusion.runti

Posted 14 July 2011 - 03:27 PM

Hello All,

let me introduce my self:
I am a .net developer and I'm zero in ColdFusion. working in he company tha has a website in coldFusion.
They ask me to change the hosting.

The most difficault part of that is the new hosting is in NetWork Solution and it is cold Fuson 7.
But the surrent hosing is running under 8.

So
I encountered lots of errors regarding the version. I've done most of them but there is one that I don't have any clue.
Here it is:
Element 1 is undefined in a Java object of type class coldfusion.runtime.Array referenced

It happens in most of the program when user click on Add button. for example here in CFLOOP :
<cftry>
<cfparam name="url.startrow" default="1"/>
<cfparam name="url.maxrows" default="10"/>

<cfset startRowParamUrl = ''>
<cfif StructKeyExists(url, "q")>
	<cfset startRowParamUrl =startRowParamUrl & '&q=#url.q#'>
</cfif>
<cfif StructKeyExists(url, "startrow")>
	<cfset startRowParamUrl =startRowParamUrl & '&startrow=#url.startrow#'>
</cfif>
        
<cfif StructKeyExists(url, "todeleteapproval")>
	<cfquery  datasource="ejpadb01">
    	DELETE FROM CouponTempTbl Where Id in (#url.todeleteapproval#)
    </cfquery>
<cflocation url="index.cfm?event=sitemanager&tabmenu=coupons" addtoken="false">
</cfif>

<cfif StructKeyExists(url, "todelete")>
	<cfquery  datasource="ejpadb01">
    	UPDATE Coupon SET Deleted=1, BusinessId=0, CategoryId=0 Where Id in (#url.todelete#)
    </cfquery>
<cflocation url="index.cfm?event=sitemanager&tabmenu=coupons" addtoken="false">
</cfif>


<cfif StructKeyExists(form, "SubmitUpdateCouponInfo")>
	<cfset tag_array = #SplitStr(form.BusinessByCategory,"_")#> 
	<cfparam name="businessId" default="0">
	<cfparam name="categoryId" default="0">

    <cfloop from="1" to="#arrayLen(tagArray)#" index="i">
    	<cfif i EQ 1>
        	<cfset businessId= #tagArray[i]# />
        <cfelseif i EQ 2>
        	<cfset categoryId= #tagArray[i]# />
        </cfif>
    </cfloop>
    
    <cfquery  datasource="ejpadb01">
    	UPDATE Coupon SET 
                	CouponCode='#sqlSafe(form.CouponCode)#'
                   ,Headline='#sqlSafe(form.Headline)#'
                   ,Description='#sqlSafe(form.Description)#'
                   ,CategoryId=#categoryId#
                   ,BusinessId=#businessId#
                   ,OwnerId=#form.OwnerId#
                   ,Approved=#form.Approved#
                   ,StartDate='#form.StartDate#'
                   ,EndDate='#form.EndDate#'
                Where Id=#form.CouponId#
    </cfquery>



this code is countinued...
I don't know how to get ride of it.
I think that it happens only in version 7.

if you need the whole code please let me know
if some one can help me I appreciate.
Thanks
Bahar

This post has been edited by Craig328: 15 July 2011 - 06:31 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Element 1 is undefined in a Java object of type class coldfusion.runti

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1926
  • View blog
  • Posts: 3,471
  • Joined: 13-January 08

Re: Element 1 is undefined in a Java object of type class coldfusion.runti

Posted 15 July 2011 - 06:37 AM

Welcome to DIC, Bahar!

So, to summarize: the existing application is running on CF8 and you're moving it to CF7 and you're encountering an error(s)?

While CF8 is backwards compatible with CF7, there were new features introduced into CF8 that were not present in CF7 that would, naturally, throw errors. Unfortunately, with what you've provided here, it'd be nearly impossible to troubleshoot your error. However, with the right info, it can be done. Here's how:

  • Make the error occur again.
  • Take a screenshot of the error including the entire error dump and post it here.
  • The error code should indicate, somewhere, on which .cfm page and which line of code is throwing the error (not always accurate however but the best place to start)
  • Attach the .cfm page that the error message indicates contains the offending line of code.

Error troubleshooting in CF can be an art. In addition, it's rare to DEvolve to an earlier version of CF so ferreting out those errors can be tricky.

Anyway, come back with that and I'm sure we can give you some assistance.

Good luck!

This post has been edited by Craig328: 15 July 2011 - 06:38 AM

Was This Post Helpful? 0
  • +
  • -

#3 bahareh77  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-July 11

Re: Element 1 is undefined in a Java object of type class coldfusion.runti

Posted 15 July 2011 - 10:08 AM

Thank you so much craig,

The error happen in the Insert form. we have a drop down in the form. when we want to get the data from drop down we have this error.
In the code we have one function named "SplitStr". I beleive that it creates an error.
this function define in "Index.cfm" file line 961
and the code that called the function is in "coupanListing.cfm" line 33

I attached these 2 files along with screenshot of the error.

Thanks u so much

Attached File(s)

  • Attached File  code.zip (82.92K)
    Number of downloads: 78

Was This Post Helpful? 0
  • +
  • -

#4 bahareh77  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-July 11

Re: Element 1 is undefined in a Java object of type class coldfusion.runti

Posted 15 July 2011 - 12:43 PM

Hi crig again

good news

It doesn't need to Download all of my codes. I find out the problem.
I wrote this code in CF7. and this is my problem. when I run this code the output is :

2: World
3: I
4: am
5: here


as you see I don't have the first element "Hello"
and this is my problem.
when I start the Index from 1. I got the error :"Element 1 is undefined in a Java object of type class coldfusion.runtime.Array referenced as"

But when I run the code in CF8, I had it.


<cffunction name="SplitStr" access="public" output="false">
    <cfargument name="sText" required="true">
    <cfargument name="sDelimiter" required="true">
    
	<cfset tag_source =  #sText#>
    <cfset comma_pos = -1>
    <cfset index = 1>
    <cfset tag_array = ArrayNew(1)>
    <cfloop condition= "comma_pos NEQ 0 AND len(tag_source) GT 0">
        <cfset comma_pos = #find("#sDelimiter#", tag_source)#>
        <cfif comma_pos NEQ 0>
            <cfif comma_pos EQ 1>
                <cfset tag_source_n = #left(tag_source, comma_pos)#>
            <cfelse>
                <cfset tag_source_n = #left(tag_source, comma_pos-1)#>
            </cfif>
            <cfset tag_source = #removechars(tag_source, 1, comma_pos)#> 
            <cfset tagArray[index] = trim(tag_source_n)>
        <cfelseif comma_pos EQ 0 AND len(tag_source) GT 0>
            <cfset tagArray[index] = trim(tag_source)>
        </cfif>
        <cfset index = index+1>
    </cfloop>
   <cfreturn tag_array>
</cffunction>


	<cfset tag_array = #SplitStr("Hello_World_I_am_here","_")#> 

<cfloop index="x" from="2" to="#arrayLen(tagArray)#">

   <cfoutput>#x#: #tagArray[x]#<br /></cfoutput>

  </cfloop>


This post has been edited by Craig328: 15 July 2011 - 12:46 PM

Was This Post Helpful? 0
  • +
  • -

#5 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1926
  • View blog
  • Posts: 3,471
  • Joined: 13-January 08

Re: Element 1 is undefined in a Java object of type class coldfusion.runti

Posted 15 July 2011 - 12:47 PM

Ah. Glad to hear it.

Sorry but I wasn't going to be able to have a look at your reply for another couple of hours yet (got bombed with two last minute Friday tasks)...so I'm happy to learn you figured it out. :)
Was This Post Helpful? 0
  • +
  • -

#6 bahareh77  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 14-July 11

Re: Element 1 is undefined in a Java object of type class coldfusion.runti

Posted 15 July 2011 - 04:45 PM

thanks criag

happy to say that my employer accepts to change the hosting to CF8 :bananaman:

so I don' need the solution either.

But I have another question:
would you please give me some suggestion about the hosting?

and I run this code on our current web host and get the version. It was 8
#Server.ColdFusion.ProductVersion#

is it correct?

what is your opinion if we got the hosting support both 8 and 9?

thanks
Was This Post Helpful? 0
  • +
  • -

#7 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1926
  • View blog
  • Posts: 3,471
  • Joined: 13-January 08

Re: Element 1 is undefined in a Java object of type class coldfusion.runti

Posted 15 July 2011 - 07:11 PM

To be perfectly honest, I don't have much bad to say about CF9. I've been using it on a contract job for the past year or so and it works pretty well with few issues.

As for hosting, there are quite a few CF9 hosting solutions so it would depend more on your company's application necessity than anything else (amount of traffic, storage space, etc).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1