Tuesday, July 1, 2014

GlassFish 4.0 ClassCastException on Class with the Same Type

Repeated deploy and undeploy of applications in GlassFish you may encounter the following class loader issue.

java.lang.ClassCastException: my.com.Test cannot be cast to my.com.Test

Within the GlassFish administration console:

Disable and Undeploy the application.
Restart the server.
Deploy the application.

Using Reload or Redeploy will not resolve the issue.

Thursday, June 19, 2014

Mac OSX Tips


Setting JAVA_HOME

OSX: 10.9.3

Open a Terminal

Type: nano .bash_profile

Add: export JAVA_HOME=$(/usr/libexec/java_home)

Exit nano: ctrl+o and hit return

Type: source .bash_profile

Type:  echo $JAVA_HOME

You should see something like: Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home

Tuesday, January 14, 2014

Ripple Emulator: 500 Internal Server Error on localhost connections



I'm trying to develop a mobile app using Cordova (PhoneGap). To test this app I have been using Ripple this is a great tool and much more convenient than the slow Android emulator. One problem I did came across was a 500 Internal Server Error while trying to connect to another server running locally on my computer. This is the http headers and response.

Headers:
Request URL:
https://rippleapi.herokuapp.com/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=http%3A//localhost%3A8080/xxxxxxxx/login/authenticateMobileUser

Request Method:
POST

Status Code:
500 Internal Server Error


Response:
{
  "code": "ECONNREFUSED",
  "errno": "ECONNREFUSED",
  "syscall": "connect"
}

To fix this problem - Ripple emulator by default has "Cross Domain Proxy" set to "Remote". For localhost connections change it to "Local".