Skip to main content
Participant
December 19, 2010
Question

<cfselect with bind to cfc works but is followed by 500 Jrun javax.servlet.ServletException

  • December 19, 2010
  • 2 replies
  • 938 views

All;

This is driving me crazy. 

I have a CFC with a function that returns countries via remote as JSON with the // prefix as Cold Fusion is configured.

I call it with the following url

www.mydomain.com/getCountriesAndStates.cfc?method=getCountries&returnFormat=json&argumentCollection={}&_cf_nodebug=true&_cf_nocache=true

It returns countries according to the Cold Fusion specs (just imagine it returning all countries, didn't want to paste it all the countries here).

//[[0.0,"Please select a country..."],["US","UNITED STATES"],["CA","CANADA"]] 

I bind a <cfselect for countrycode to this CFC and it works about 30% of the time.

Here is the <cfselect

<cfselect name="CountryCode" id="spanCountryCode" bind="cfc:getCountriesAndStates.getCountries()" bindonload="true"  onChange="DEdetermineTohide(this.id, '1')" onKeyUp="DEdetermineTohide(this.id, '1')">   

        </cfselect>

It has a second function that returns the States with a CountryCode as the argument. 

I call it with the follow url

/getCountriesAndStates.cfc?method=getStateProvince&returnFormat=json&argumentCollection={"countrycode":"US"}&_cf_nodebug=true&_cf_nocache=true

It returns states according to the old Fusion specs (just imagine it returning all the states, didn't want to paste all the states here.)

//[[0.0,"Please select a state..."],["AL","ALABAMA"],["AK","ALASKA"]]

I bind a <cfselect to this CFC with the countrycode as an argument and it populates the states for the countrycoe about 30% of the time.  It fails when the getCountries call fails.

Here is the State <cfselect

<cfselect name="StateCode" bind="cfc:getCountriesAndStates.getStateProvince({CountryCode})">

        </cfselect>

I have a third funtion that returns whether or not the country selected has States and Zip Codes.  I call this function from a seperate javascript script included in the header and fired from the <cfselect name="CountryCode for onChange or onKeyUp.  It basically determines whether or not to show or hide both the State or Zip span but calls the CFC so that I can encapsulate everything in one place.  So the state and zip span with <cfselect and <cfinput appear and disappear based on the information about the country and state and the labels can change too from State to Province and from Zip to Postal Code etc...

/getCountriesAndStates.cfc?method=getStateZipMetaData&returnFormat=json&argumentCollection={"countrycode":"US"}&_cf_nodebug=true&_cf_nocache=true

Ok, so I hope I have described enough about what I am doing.  This works about 30% of the time and fails about 70% of the time.  Flawlessly.  Sometimes it works for hours.  But eventually for some reason AFTER a perfectly good JSON response is returned from Cold Fusion, the Cold Fusion server starts following the JSON response with a 500 Serverlet Exception error.  This happesn on all function calls until I reboot my machine.

It is driving me mad and making me start to reconsider whether or not I want to use CFForm binding.  It seems like a nice elegant solution that really simplifies and reduces the amount of javascript I have to write, but I can't go to production with forms that produce 500 server errors.

Anyone have any ideas on what is going on?  If this is a bug?

Should I just stay away from <cfform binding?

Please help because it is driving me really crazy.

My platform information is below.

About 70% of the time it returns all the countries followed by a 500 Servlet Exception error.

500


javax.servlet.ServletException
     at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:154)
     at coldfusion.xml.rpc.CFCServlet.doGet(CFCServlet.java:264)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
     at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
     at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
     at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
     at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
     at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
     at jrun.servlet.FilterChain.service(FilterChain.java:101)
     at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
     at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
     at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
     at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
     at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
     at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
     at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
     at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
     at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

Platform details

Server ProductColdFusion
Version9,0,0,251028 
EditionDeveloper 
Operating SystemWindows XP 
OS Version5.1 
Adobe Driver Version4.0 (Build 0005) 

JVM Details
Java Version1.6.0_14 
Java VendorSun Microsystems Inc. 
Java Vendor URLhttp://java.sun.com/ 
Java HomeC:\ColdFusion9\runtime\jre 

CF9 Update 1

Apache 2.2

Database MS-SQL Express

This topic has been closed for replies.

2 replies

Participant
December 21, 2010

Ok, so I think I answered this for myself.  This may be ignorant.  Whatever.  I haven't programmed CF in over 10 years and just started again a month ago, so I think advanced CFC and javascript is a lot.

I seperated my CFC into a directory with a Alias mapping under Apache and a CF Mapping from CFIDE

I trimmed down the application.cfc

It was

<cfset This.clientstorage="Cookie">

That was causing the remoting CFC's to return a 500 Jrun Servlet Error

I am just going to keep my remote CFC's seperate from the rest of my application anyway because they need a different type of security schema.

So, if anyone struggles with this.  I recommend just put your remotely accessd CFC's in a seperate virtual directory mapped from your webserver and CF and lock them down both with a trimmed down application.cfc and some kind of security.

They also seem to run much faster now combined with my other Ajax and Javascript.

Participant
December 19, 2010

I forgot to add

The page throws this error as a pop up

Error invoking CFC /getCountriesAndStates.cfc : Server Error [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]

If I enable debuggins, I see the same thing as if I go to the URLs directly.

The CFC returns all the JSON data followed by a 500 server error