Tuesday, October 9, 2007

ColdFusion 8 flex2gateway Error 500 java.lang.NullPointerException

I recently upgraded to CF8 and experienced a small problem when i went to configure my AMF end points and channels. First I must say that I like the new method of keeping the channel definitions in the services-config while breaking out the destination settings into separate files like remoting-config. Now all that being said I encountered the following error when going to http://localhost/flex2gateway/ after copying over my old settings into these files.
java.lang.NullPointerException at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:283) 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)
The problem occurs because apparently while it was ok to have two channels share the same endpoint uri URL in CF7...

in CF8 it doesn't work. The solution is to simply change the endpoint uri for the new channel. (You should leave the class definition the same for the uri.)
I doubt a lot of people are going to have this problem as it seems that most people are not using custom channels or destinations.
At any rate.... once you make this change, stop and restart the cf server you should be able to hit the uri in a browser window and get .... nothing (a blank page) which is good, it means it is working.

1 comment:

Anonymous said...

Hey There, I'm stuck as well on a 500 error viewing http://localhost/flex2gateway when I found your potential solution. You said to "The solution is to simply change the endpoint uri for the new channel. (You should leave the class definition the same for the uri.)". I don't exactly understand what you mean, could you help clarify? Here's what's currently in my services-config.xml. <channel-definition id="cf-polling-amf" class="mx.messaging.channels.AMFChannel"> <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/cfamfpolling/" class="flex.messaging.endpoints.AMFEndpoint"/> <properties> <polling-enabled>true</polling-enabled> <polling-interval-seconds>8</polling-interval-seconds> <serialization> <instantiate-types>false</instantiate-types> </serialization> </properties> </channel-definition> <channel-definition id="my-cfamf-secure" class="mx.messaging.channels.SecureAMFChannel"> <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/cfamfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/> <properties> <polling-enabled>false</polling-enabled> <serialization> <instantiate-types>false</instantiate-types> </serialization> </properties> </channel-definition> Thanks, Noah