error

Scala REPL - java.lang.OutOfMemoryError: Java heap space error

I just got a “java.lang.OutOfMemoryError: Java heap space error” when trying to use the Scala REPL to analyze a large XML dataset:

Solution to the Scala jar class file is broken error

I just ran into the following Scala jar (class) is broken error:

Scala 'unreachable code due to variable pattern' warning message

Scala match FAQ: Why am I getting an "unreachable code due to variable pattern" warning on my match/case statement when compiling my Scala code?

The usual reason for getting this error message is that you try to use an existing variable name inside a Scala match expression. For instance, if you try to create a match expression like this:

Scala java.lang.NoSuchMethodError: scala.Predef$.augmentString error

It's been a while since I've seen a problem related to using different versions of Scala, but I just ran into it now.

How to handle Scala Play Framework 2 404 and 500 errors

To handle 404 and 500 errors in the Scala Play Framework 2, you need to create a Global.scala object in your main app directory. The object should extend GlobalSettings, and override the necessary methods.

The following example Play Framework Global object, saved as app/Global.scala, demonstrates this:

Scala REPL "She's gone rogue" error message

In a little bit of accidental Scala REPL fun this afternoon, I was testing a recursive algorithm like the following simple factorial algorithm, and forgot a return statement:

def factorial(n: Int):Int = {
  if (n == 1) n    // forgot 'return' here
  factorial(n - 1)
}

When I pasted that code into the Scala REPL and then tried to test it as shown below, it didn't come back for a while, until it failed with this error message:

Managing MongoDB connections with the Scala Casbah database driver

UPDATE: November 14, 2012. This article describes problems I had when attempting to use the Scala Casbah driver for the MongoDB database. In the end, it turned out I was doing something wrong. However, because this article shows how to troubleshoot MongoDB and Casbah database connection problems, it seems like a good idea to leave it here. If you want to see the correct way to use Casbah with MongoDB, I created this Github project, which shows the correct approach.

Android internet access error - java.net.UnknownHostException: Unable to resolve host

Android internet FAQ: I'm getting an internet access error with my Android application that says, "java.net.UnknownHostException: Unable to resolve host (hostname): No address associated with hostname". I think my HTTP/REST code is correct, what's wrong?

If you get an error message like this:

Android error logging examples and Log class documentation

Android error logging FAQ: How do I log error messages in Android?

To log Android errors, just use the Log class, as shown in this example:

The 'Unfortunately your Android app has stopped' error message

Android error FAQ: Help, I'm developing an Android app, and I'm getting a "Unfortunately your Android app has stopped error message"; how do I fix it?

If you're getting an Android error message that looks like this:

"Unfortunately your Android app has stopped error message"

It's probably because you forgot to put a new Activity in the AndroidManifest.xml file. That's been the #1 cause of this error message in my experience.

Syndicate content