The stack trace is a NullPointerException, right? Look at the above two lines: you're passing "null" as the argument to the FactoryClass constructor. The FactoryClass constructor calls a method on the passed-in argument, which gives the NullPointerException. You can't call a method on the null reference. OK?