Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Spring Roo: How to Solve "Integer cannot be cast to Long"

DZone's Guide to

Spring Roo: How to Solve "Integer cannot be cast to Long"

I'm a newbie to Spring Roo and while trying to create an application using Spring Roo and Vaadin.

Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.


I'm a newbie to Spring Roo and while trying to create an application using Spring  Roo and Vaadin, I suddenly started getting the following message from Spring Roo Shell:

java.lang.Integer cannot be cast to java.lang.Long

And all my Spring Roo environment stopped working.


After "googling" a lot, I've finally found one possible reason to this problem, at least it was my case. So I'd like to share.


In my case I have annotated some fields with @Min(1) or @Max(9) for example, and what I didn't know is that those annotations takes a long parameter, not a integer parameter.


Then after changing @Min(1) to @Min(1L), the same to @Max annotations, the problem has gone and my Spring Roo environment is working again.


Thanx to this post http://www.manning-sandbox.com/thread.jspa?threadID=39831&tstart=0

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:
java ,frameworks ,java spring roo

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}