Play Framework: Bad type on operand stack
Code's written in scala but Exception is from java.lang. I am trying to connect my basic scala + play app to database. I am using a tutorial https://www.youtube.com/watch?v=Zdt_utUOd5s&list=PLYPFxrXyK0Bx9SBkNhJr1e2-NlIq4E7ED&index=21
Everything worked just like in the video until 7:40 rolled around. Instead of getting the option to run an sql script i get this bizarre error:
VerifyError: Bad type on operand stack
Exception Details:
Location:
models/Book.(ILjava/lang/String;ILjava/lang/String;)V @2: invokevirtual
Reason:
Type uninitializedThis (current frame, stack[0]) is not assignable to 'models/Book'
Current Frame:
bci: @2
flags: flagThisUninit
locals: uninitializedThis, integer, 'java/lang/String', integer, 'java/lang/String'stack: uninitializedThis, integer
Bytecode:
0000000: 2a1b b600 d52a 2cb6 00d8 2a1d b600 db2a
0000010: 1904 b600 de2a b700 e12a bb00 e359 2ab7
0000020: 00e6 b500 e82a b800 ec2a 1bb6 005a 2a2c
0000030: b600 622a 1db6 0069 2a19 04b6 0070 b1
And a bit of Stack Trace:
Here is my models.Book class:
package models
import io.ebean.Model
import javax.persistence.Entity, Id
@Entity
case class Book(identifier: Int, title1: String, price1: Int, author1: String) extends Model {
@Id
var id: Int = identifier
var title: String = title1
var price: Int = price1
var author: String = author1
override def toString: String = s"id = $id $title written by $author"
And Bookset object
import scala.collection.mutable.HashSet
object BookSet {
val set: HashSet[Book] = HashSet[Book]()
add(Book(1,"C++",20,"This one Danish Guy"))
add(Book(2,"Java",30,"Sun Mirco"))
add(Book(3,"Gone with the wind",60,"Some dude"))
add(Book(4,"Catcher in the Rye",20,"Some other dude"))
def findById(id: Int): Book =
var mybook: Book = null
set foreach book =>
if(book.id == id) mybook = book
mybook
def add(book: Book) =
set.add(book)
//bookIndex+=1
def remove(book: Book) =
set.remove(book)
I've done all the required prep work (build.sbt, plugins.sbt, app.conf) the guy in the video did. I have the line : db.default.enabled = true
in my app.conf file and I've added
libraryDependencies ++= Seq(evolutions, jdbc)
to build.sbt
I've noticed that after I remove the @Entity annotation i don't get the exception nor the option to run sql script =. What is causing the problem and how do fix it? Is is because I am using Scala classes instead of plain POJO's ?
java scala playframework jvm ebean
add a comment |
Code's written in scala but Exception is from java.lang. I am trying to connect my basic scala + play app to database. I am using a tutorial https://www.youtube.com/watch?v=Zdt_utUOd5s&list=PLYPFxrXyK0Bx9SBkNhJr1e2-NlIq4E7ED&index=21
Everything worked just like in the video until 7:40 rolled around. Instead of getting the option to run an sql script i get this bizarre error:
VerifyError: Bad type on operand stack
Exception Details:
Location:
models/Book.(ILjava/lang/String;ILjava/lang/String;)V @2: invokevirtual
Reason:
Type uninitializedThis (current frame, stack[0]) is not assignable to 'models/Book'
Current Frame:
bci: @2
flags: flagThisUninit
locals: uninitializedThis, integer, 'java/lang/String', integer, 'java/lang/String'stack: uninitializedThis, integer
Bytecode:
0000000: 2a1b b600 d52a 2cb6 00d8 2a1d b600 db2a
0000010: 1904 b600 de2a b700 e12a bb00 e359 2ab7
0000020: 00e6 b500 e82a b800 ec2a 1bb6 005a 2a2c
0000030: b600 622a 1db6 0069 2a19 04b6 0070 b1
And a bit of Stack Trace:
Here is my models.Book class:
package models
import io.ebean.Model
import javax.persistence.Entity, Id
@Entity
case class Book(identifier: Int, title1: String, price1: Int, author1: String) extends Model {
@Id
var id: Int = identifier
var title: String = title1
var price: Int = price1
var author: String = author1
override def toString: String = s"id = $id $title written by $author"
And Bookset object
import scala.collection.mutable.HashSet
object BookSet {
val set: HashSet[Book] = HashSet[Book]()
add(Book(1,"C++",20,"This one Danish Guy"))
add(Book(2,"Java",30,"Sun Mirco"))
add(Book(3,"Gone with the wind",60,"Some dude"))
add(Book(4,"Catcher in the Rye",20,"Some other dude"))
def findById(id: Int): Book =
var mybook: Book = null
set foreach book =>
if(book.id == id) mybook = book
mybook
def add(book: Book) =
set.add(book)
//bookIndex+=1
def remove(book: Book) =
set.remove(book)
I've done all the required prep work (build.sbt, plugins.sbt, app.conf) the guy in the video did. I have the line : db.default.enabled = true
in my app.conf file and I've added
libraryDependencies ++= Seq(evolutions, jdbc)
to build.sbt
I've noticed that after I remove the @Entity annotation i don't get the exception nor the option to run sql script =. What is causing the problem and how do fix it? Is is because I am using Scala classes instead of plain POJO's ?
java scala playframework jvm ebean
1
Perhaps, it has to do with the fact that you are using acase class
as@Entity
. The way you’re adding a body to it, duplicating all fields, looks odd. But I’m not a Scala programmer. As a Java programmer, I can tell you that theVerifyError
says that the generated (or instrumented) byte code tries to invoke instance methods onthis
in the constructor, before the super constructor has been called.
– Holger
Nov 13 '18 at 10:09
I agree with @Holger. I will add that this might also be another case of using the Java technology with Scala when it comes to PlayFramework. EBean is only meant for Java: playframework.com/documentation/2.6.x/…. For Scala, you will need to go to Anorm, Slick, or Raw JDBC calls.
– Daniel Hinojosa
Nov 13 '18 at 14:25
Thanks for help guys :) I guess ORM was never meant for me
– Jan Chabik
Nov 13 '18 at 18:29
add a comment |
Code's written in scala but Exception is from java.lang. I am trying to connect my basic scala + play app to database. I am using a tutorial https://www.youtube.com/watch?v=Zdt_utUOd5s&list=PLYPFxrXyK0Bx9SBkNhJr1e2-NlIq4E7ED&index=21
Everything worked just like in the video until 7:40 rolled around. Instead of getting the option to run an sql script i get this bizarre error:
VerifyError: Bad type on operand stack
Exception Details:
Location:
models/Book.(ILjava/lang/String;ILjava/lang/String;)V @2: invokevirtual
Reason:
Type uninitializedThis (current frame, stack[0]) is not assignable to 'models/Book'
Current Frame:
bci: @2
flags: flagThisUninit
locals: uninitializedThis, integer, 'java/lang/String', integer, 'java/lang/String'stack: uninitializedThis, integer
Bytecode:
0000000: 2a1b b600 d52a 2cb6 00d8 2a1d b600 db2a
0000010: 1904 b600 de2a b700 e12a bb00 e359 2ab7
0000020: 00e6 b500 e82a b800 ec2a 1bb6 005a 2a2c
0000030: b600 622a 1db6 0069 2a19 04b6 0070 b1
And a bit of Stack Trace:
Here is my models.Book class:
package models
import io.ebean.Model
import javax.persistence.Entity, Id
@Entity
case class Book(identifier: Int, title1: String, price1: Int, author1: String) extends Model {
@Id
var id: Int = identifier
var title: String = title1
var price: Int = price1
var author: String = author1
override def toString: String = s"id = $id $title written by $author"
And Bookset object
import scala.collection.mutable.HashSet
object BookSet {
val set: HashSet[Book] = HashSet[Book]()
add(Book(1,"C++",20,"This one Danish Guy"))
add(Book(2,"Java",30,"Sun Mirco"))
add(Book(3,"Gone with the wind",60,"Some dude"))
add(Book(4,"Catcher in the Rye",20,"Some other dude"))
def findById(id: Int): Book =
var mybook: Book = null
set foreach book =>
if(book.id == id) mybook = book
mybook
def add(book: Book) =
set.add(book)
//bookIndex+=1
def remove(book: Book) =
set.remove(book)
I've done all the required prep work (build.sbt, plugins.sbt, app.conf) the guy in the video did. I have the line : db.default.enabled = true
in my app.conf file and I've added
libraryDependencies ++= Seq(evolutions, jdbc)
to build.sbt
I've noticed that after I remove the @Entity annotation i don't get the exception nor the option to run sql script =. What is causing the problem and how do fix it? Is is because I am using Scala classes instead of plain POJO's ?
java scala playframework jvm ebean
Code's written in scala but Exception is from java.lang. I am trying to connect my basic scala + play app to database. I am using a tutorial https://www.youtube.com/watch?v=Zdt_utUOd5s&list=PLYPFxrXyK0Bx9SBkNhJr1e2-NlIq4E7ED&index=21
Everything worked just like in the video until 7:40 rolled around. Instead of getting the option to run an sql script i get this bizarre error:
VerifyError: Bad type on operand stack
Exception Details:
Location:
models/Book.(ILjava/lang/String;ILjava/lang/String;)V @2: invokevirtual
Reason:
Type uninitializedThis (current frame, stack[0]) is not assignable to 'models/Book'
Current Frame:
bci: @2
flags: flagThisUninit
locals: uninitializedThis, integer, 'java/lang/String', integer, 'java/lang/String'stack: uninitializedThis, integer
Bytecode:
0000000: 2a1b b600 d52a 2cb6 00d8 2a1d b600 db2a
0000010: 1904 b600 de2a b700 e12a bb00 e359 2ab7
0000020: 00e6 b500 e82a b800 ec2a 1bb6 005a 2a2c
0000030: b600 622a 1db6 0069 2a19 04b6 0070 b1
And a bit of Stack Trace:
Here is my models.Book class:
package models
import io.ebean.Model
import javax.persistence.Entity, Id
@Entity
case class Book(identifier: Int, title1: String, price1: Int, author1: String) extends Model {
@Id
var id: Int = identifier
var title: String = title1
var price: Int = price1
var author: String = author1
override def toString: String = s"id = $id $title written by $author"
And Bookset object
import scala.collection.mutable.HashSet
object BookSet {
val set: HashSet[Book] = HashSet[Book]()
add(Book(1,"C++",20,"This one Danish Guy"))
add(Book(2,"Java",30,"Sun Mirco"))
add(Book(3,"Gone with the wind",60,"Some dude"))
add(Book(4,"Catcher in the Rye",20,"Some other dude"))
def findById(id: Int): Book =
var mybook: Book = null
set foreach book =>
if(book.id == id) mybook = book
mybook
def add(book: Book) =
set.add(book)
//bookIndex+=1
def remove(book: Book) =
set.remove(book)
I've done all the required prep work (build.sbt, plugins.sbt, app.conf) the guy in the video did. I have the line : db.default.enabled = true
in my app.conf file and I've added
libraryDependencies ++= Seq(evolutions, jdbc)
to build.sbt
I've noticed that after I remove the @Entity annotation i don't get the exception nor the option to run sql script =. What is causing the problem and how do fix it? Is is because I am using Scala classes instead of plain POJO's ?
java scala playframework jvm ebean
java scala playframework jvm ebean
asked Nov 12 '18 at 23:30
Jan Chabik
173
173
1
Perhaps, it has to do with the fact that you are using acase class
as@Entity
. The way you’re adding a body to it, duplicating all fields, looks odd. But I’m not a Scala programmer. As a Java programmer, I can tell you that theVerifyError
says that the generated (or instrumented) byte code tries to invoke instance methods onthis
in the constructor, before the super constructor has been called.
– Holger
Nov 13 '18 at 10:09
I agree with @Holger. I will add that this might also be another case of using the Java technology with Scala when it comes to PlayFramework. EBean is only meant for Java: playframework.com/documentation/2.6.x/…. For Scala, you will need to go to Anorm, Slick, or Raw JDBC calls.
– Daniel Hinojosa
Nov 13 '18 at 14:25
Thanks for help guys :) I guess ORM was never meant for me
– Jan Chabik
Nov 13 '18 at 18:29
add a comment |
1
Perhaps, it has to do with the fact that you are using acase class
as@Entity
. The way you’re adding a body to it, duplicating all fields, looks odd. But I’m not a Scala programmer. As a Java programmer, I can tell you that theVerifyError
says that the generated (or instrumented) byte code tries to invoke instance methods onthis
in the constructor, before the super constructor has been called.
– Holger
Nov 13 '18 at 10:09
I agree with @Holger. I will add that this might also be another case of using the Java technology with Scala when it comes to PlayFramework. EBean is only meant for Java: playframework.com/documentation/2.6.x/…. For Scala, you will need to go to Anorm, Slick, or Raw JDBC calls.
– Daniel Hinojosa
Nov 13 '18 at 14:25
Thanks for help guys :) I guess ORM was never meant for me
– Jan Chabik
Nov 13 '18 at 18:29
1
1
Perhaps, it has to do with the fact that you are using a
case class
as @Entity
. The way you’re adding a body to it, duplicating all fields, looks odd. But I’m not a Scala programmer. As a Java programmer, I can tell you that the VerifyError
says that the generated (or instrumented) byte code tries to invoke instance methods on this
in the constructor, before the super constructor has been called.– Holger
Nov 13 '18 at 10:09
Perhaps, it has to do with the fact that you are using a
case class
as @Entity
. The way you’re adding a body to it, duplicating all fields, looks odd. But I’m not a Scala programmer. As a Java programmer, I can tell you that the VerifyError
says that the generated (or instrumented) byte code tries to invoke instance methods on this
in the constructor, before the super constructor has been called.– Holger
Nov 13 '18 at 10:09
I agree with @Holger. I will add that this might also be another case of using the Java technology with Scala when it comes to PlayFramework. EBean is only meant for Java: playframework.com/documentation/2.6.x/…. For Scala, you will need to go to Anorm, Slick, or Raw JDBC calls.
– Daniel Hinojosa
Nov 13 '18 at 14:25
I agree with @Holger. I will add that this might also be another case of using the Java technology with Scala when it comes to PlayFramework. EBean is only meant for Java: playframework.com/documentation/2.6.x/…. For Scala, you will need to go to Anorm, Slick, or Raw JDBC calls.
– Daniel Hinojosa
Nov 13 '18 at 14:25
Thanks for help guys :) I guess ORM was never meant for me
– Jan Chabik
Nov 13 '18 at 18:29
Thanks for help guys :) I guess ORM was never meant for me
– Jan Chabik
Nov 13 '18 at 18:29
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271614%2fplay-framework-bad-type-on-operand-stack%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271614%2fplay-framework-bad-type-on-operand-stack%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Perhaps, it has to do with the fact that you are using a
case class
as@Entity
. The way you’re adding a body to it, duplicating all fields, looks odd. But I’m not a Scala programmer. As a Java programmer, I can tell you that theVerifyError
says that the generated (or instrumented) byte code tries to invoke instance methods onthis
in the constructor, before the super constructor has been called.– Holger
Nov 13 '18 at 10:09
I agree with @Holger. I will add that this might also be another case of using the Java technology with Scala when it comes to PlayFramework. EBean is only meant for Java: playframework.com/documentation/2.6.x/…. For Scala, you will need to go to Anorm, Slick, or Raw JDBC calls.
– Daniel Hinojosa
Nov 13 '18 at 14:25
Thanks for help guys :) I guess ORM was never meant for me
– Jan Chabik
Nov 13 '18 at 18:29