I began to copy and paste the code from the tutorial to make sure it all worked before I started tweaking and playing but once I finished I got some long winded error in a Flex alert and immediately looked at Charles to see what was going on. It was trying to access http://localhost:2037 for the "my-rtmp" channel but was failing. So I changed the port to 2038 in my 'services-config.xml'. Then I rebuilt the flex app and ran it again to get a new smaller error that said:
At that point I really didn't know what to do. I noticed a lot of other people had that same error and no one posted a solution. Joel told me to check my Tomcat terminal and see what was happening so I restarted and took a look and saw:
.....
(Command method=_error (0) trxId=3.0)
(Typed Object #0 'flex.messaging.messages.ErrorMessage')
rootCause = null
destination = "employee.hibernate"
headers = (Object #1)
correlationId = "1EA4B470-3C6E-0E12-EED6-90E1F1EE767E"
faultString = "No destination with id 'employee.hibernate' is registered w
ith any service."
messageId = "4CB7A011-7A09-3764-31CF-BE54802842D7"
faultCode = "Server.Processing"
timeToLive = 0.0
extendedData = null
faultDetail = null
clientId = "CDDF2F69-8C30-1329-9C04-90E1F1781933"
timestamp = 1.21790647145E12
body = null
.....
....So I tookout the tag that had the 'REPLACE' throttle policy in it in 'data-management-config.xml' and I began google-ing the second error about the bad version number. It turns out that I built the Employee.class file for JRE 1.6 while Tomcat was running on 1.4. So I rebuilt Employee.class to 1.4. Those two errors were now gone.
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
[LCDS] [WARN] Throttle outbound policy 'REPLACE' found on message destination 'hibernate-employee'. The 'REPLACE' throttle outbound policy has been deprecated. Please remove it from your configuration file.
[LCDS] [ERROR] Error instantiating application scoped instance of type 'flex.data.assemblers.HibernateAssembler' for destination 'hibernate-employee'.
java.lang.UnsupportedClassVersionError: Bad version number in .class file
....
FINALLY, I restart Tomcat again and I get the following in the terminal:
...
[LCDS] SocketServer 'my-rtmp-SocketServer' is starting.
[LCDS] SocketServer 'my-rtmp-SocketServer' failed to pre-validate desired socket settings for BindSocketAddress: 0.0.0.0:2038
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
....
Hmm... so port 2038 is in use by JVM_Bind and trying to be used again by our 'my-rtmp' channel. I remembered changing that somewhere earlier....ah yes! services-config.xml! I opened that bad boy up and changed the 'my-rtmp' channel to use http://localhost:2039, restarted Tomcat, rebuilt my Flex app and BOOM - The employee table populated. I am not sure where the discrepancies lie between the different ports and what causes them but everything is working now as planned.
So... I am not sure if the previous errors were causing the same thing since the error stayed consistent after I fixed each problem but the final solution was changing the port to 2039. If you are having problems with this, check your Tomcat terminal and get some debugging info.
No comments:
Post a Comment