Scala + JSF 2.0 on Jboss 6 deployment error
glenn1 Mar 29, 2010 10:00 PMI've been trying to mix some scala code in with my Weld jsf-jee-minimal archetype project. My test case was to see if the JavaQuiz example in "Core Java ServerFaces, Third Edition" would work after rewriting the code as described in http://vikasrao.wordpress.com/2009/01/28/jsf-with-scala-managed-beans/, but making it work for JSF 2.0. I refactored QuizBean to conform to a more functional approach, but on deployment to JBoss 6, I get the following error:
DEPLOYMENTS IN ERROR:
".../_WeldBootstrapBean" is in error due to the following reason(s): org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001400 Normal scoped bean org.jboss.weld.bean-flat-ManagedBean-class JavaQuizBean is not proxyable
And here is my scala code:
class Problem(@BeanProperty val question:String, @BeanProperty val answer:String) {
def isCorrect(response:String):Boolean =
response.trim.equalsIgnoreCase(answer)
}
@Named
@SessionScoped
class JavaQuizBean extends Serializable{
var currentProblem:Int = 0
var tries:Int = 0
@BeanProperty var score:Int = 0
@BeanProperty var response:String = ""
@BeanProperty var problem:Problem = _
val p1 = new Problem("What trademarked slogan describes Java Development? Write once,...","run anywhere")
val p2 = new Problem("What are the first 4 bytes of every class file(in hexadecimal)?", "CAFEBABE")
val p3 = new Problem("What does this statement print? System.out.println(1+\"2\");", "12")
val problems:Array[Problem] = Array(p1,p2,p3)
problem = problems(currentProblem)
def QuizBean(){ startOver()}
def startOver(){
currentProblem = 0
problem = problems(currentProblem)
score = 0
tries = 0
response = ""
}
def nextProblem(){
currentProblem = currentProblem + 1
problem = problems(currentProblem)
tries = 0
response = ""
}
def answerAction():String = {
tries = tries + 1
def anotherTry:Boolean = if(tries < 2) true else false
def isDone:Boolean = currentProblem == problems.length-1
//case class Answer(correct:Boolean, goOn:Boolean, done:Boolean)
def myAnswer:String = (problem.isCorrect(response), anotherTry, isDone) match{
case (true,_,true) => {
score = score + 1
return "done"
}
case (false,_,true) => return "done"
case (false,true,_) => {
response = ""
return "again"
}
case (false,false,_) => {
nextProblem
return "failure"
}
case (true,true,false) =>{
score = score + 1
nextProblem
return "success"
}
}
myAnswer
}
def startOverAction():String = {
startOver()
"startOver"
}
}
What makes this code not "proxyable"?
DEPLOYMENTS IN ERROR:
".../_WeldBootstrapBean" is in error due to the following reason(s): org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001400 Normal scoped bean org.jboss.weld.bean-flat-ManagedBean-class JavaQuizBean is not proxyable
And here is my scala code:
class Problem(@BeanProperty val question:String, @BeanProperty val answer:String) {
def isCorrect(response:String):Boolean =
response.trim.equalsIgnoreCase(answer)
}
@Named
@SessionScoped
class JavaQuizBean extends Serializable{
var currentProblem:Int = 0
var tries:Int = 0
@BeanProperty var score:Int = 0
@BeanProperty var response:String = ""
@BeanProperty var problem:Problem = _
val p1 = new Problem("What trademarked slogan describes Java Development? Write once,...","run anywhere")
val p2 = new Problem("What are the first 4 bytes of every class file(in hexadecimal)?", "CAFEBABE")
val p3 = new Problem("What does this statement print? System.out.println(1+\"2\");", "12")
val problems:Array[Problem] = Array(p1,p2,p3)
problem = problems(currentProblem)
def QuizBean(){ startOver()}
def startOver(){
currentProblem = 0
problem = problems(currentProblem)
score = 0
tries = 0
response = ""
}
def nextProblem(){
currentProblem = currentProblem + 1
problem = problems(currentProblem)
tries = 0
response = ""
}
def answerAction():String = {
tries = tries + 1
def anotherTry:Boolean = if(tries < 2) true else false
def isDone:Boolean = currentProblem == problems.length-1
//case class Answer(correct:Boolean, goOn:Boolean, done:Boolean)
def myAnswer:String = (problem.isCorrect(response), anotherTry, isDone) match{
case (true,_,true) => {
score = score + 1
return "done"
}
case (false,_,true) => return "done"
case (false,true,_) => {
response = ""
return "again"
}
case (false,false,_) => {
nextProblem
return "failure"
}
case (true,true,false) =>{
score = score + 1
nextProblem
return "success"
}
}
myAnswer
}
def startOverAction():String = {
startOver()
"startOver"
}
}
What makes this code not "proxyable"?