I am upgrading my application from Grail 2.x
to Grails 4.x
. As part of the process, I am converting my date/time references from joda-time
to java.time
. In doing so and when running my application, I get the following error:
Could not find matching constructor for: java.time.LocalDate()
I have no clue how to solve this. I have read various posts that say I have to create a converter
and other posts that say I need to add Jackson jsr310
as a dependency in by build.gradle
. However, a lot of what I have read were either for older versions of Grails or relate to some other programming language. Any insight/direction on how to solve this would be appreciated. Below is a snippet of the code that is causing the error.
import org.apache.jasper.compiler.Node.ParamsAction
import java.time.LocalTime
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import com.app.torque.User
class DashboardController {
def evaluationService
def authService
def index() {
// Get User and Information
User currentUser = User.read(session?.user?.id)
Client userClient = Client.read(currentUser?.client?.id)
Retailer userRetailer = Retailer.read(currentUser?.buyer?.id)
... //some additional code here deleted for conciseness
dateList?.add(new LocalDate().getYear())
}
}
LocalDate
doesnt have a public constructor
dateList?.add(LocalDate.now().getYear())