springboot fails while running bootRun for gradle project - spring-boot
Getting below error after upgrading springboot multi module project to springboot 2 with gradle 5.x. I do not see any project specific exception in stack trace. Basically, the project structure is like below:
application:
module1
build.gradle
module2
build.gradle
When I put a break point at SpringApplication.java of spring-boot class, it's breaking on below piece of code
protected void bindToSpringApplication(ConfigurableEnvironment environment) {
try {
Binder.get(environment).bind("spring.main", Bindable.ofInstance(this));
}
catch (Exception ex) {
throw new IllegalStateException("Cannot bind to SpringApplication", ex);
}
}
And the exception is:
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [org.springframework.boot.SpringApplication]
ConversionService converters =
#org.springframework.format.annotation.DateTimeFormat java.lang.Long -> java.lang.String: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,#org.springframework.format.annotation.NumberFormat java.lang.Long -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
#org.springframework.format.annotation.DateTimeFormat java.time.LocalDate -> java.lang.String: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.time.LocalDate -> java.lang.String : org.springframework.format.datetime.standard.TemporalAccessorPrinter#36ddaebf
#org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime -> java.lang.String: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.time.LocalDateTime -> java.lang.String : org.springframework.format.datetime.standard.TemporalAccessorPrinter#3cff0139
#org.springframework.format.annotation.DateTimeFormat java.time.LocalTime -> java.lang.String: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.time.LocalTime -> java.lang.String : org.springframework.format.datetime.standard.TemporalAccessorPrinter#9d7ccfe
#org.springframework.format.annotation.DateTimeFormat java.time.OffsetTime -> java.lang.String: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.time.OffsetTime -> java.lang.String : org.springframework.format.datetime.standard.TemporalAccessorPrinter#15f8701f
#org.springframework.format.annotation.DateTimeFormat java.time.ZonedDateTime -> java.lang.String: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.time.ZonedDateTime -> java.lang.String : org.springframework.format.datetime.standard.TemporalAccessorPrinter#4b2e3e8f
#org.springframework.format.annotation.DateTimeFormat java.util.Calendar -> java.lang.String: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411
#org.springframework.format.annotation.DateTimeFormat java.util.Date -> java.lang.String: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411
#org.springframework.format.annotation.DateTimeFormat org.joda.time.LocalDate -> java.lang.String: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,org.joda.time.LocalDate -> java.lang.String : org.springframework.format.datetime.joda.ReadablePartialPrinter#2cec704c
#org.springframework.format.annotation.DateTimeFormat org.joda.time.LocalDateTime -> java.lang.String: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,org.joda.time.LocalDateTime -> java.lang.String : org.springframework.format.datetime.joda.ReadablePartialPrinter#240f6c41
#org.springframework.format.annotation.DateTimeFormat org.joda.time.LocalTime -> java.lang.String: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,org.joda.time.LocalTime -> java.lang.String : org.springframework.format.datetime.joda.ReadablePartialPrinter#2416498e
#org.springframework.format.annotation.DateTimeFormat org.joda.time.ReadableInstant -> java.lang.String: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,org.joda.time.ReadableInstant -> java.lang.String : org.springframework.format.datetime.joda.ReadableInstantPrinter#2015b2cd
#org.springframework.format.annotation.NumberFormat java.lang.Byte -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
#org.springframework.format.annotation.NumberFormat java.lang.Double -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
#org.springframework.format.annotation.NumberFormat java.lang.Float -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
#org.springframework.format.annotation.NumberFormat java.lang.Integer -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
#org.springframework.format.annotation.NumberFormat java.lang.Short -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
#org.springframework.format.annotation.NumberFormat java.math.BigDecimal -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
#org.springframework.format.annotation.NumberFormat java.math.BigInteger -> java.lang.String: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
[C -> java.lang.String : org.springframework.boot.convert.CharArrayFormatter#5e746d37
java.lang.Boolean -> java.lang.String : org.springframework.core.convert.support.ObjectToStringConverter#2e23c180
java.lang.Character -> java.lang.Number : org.springframework.core.convert.support.CharacterToNumberFactory#173f73e7
java.lang.Character -> java.lang.String : org.springframework.core.convert.support.ObjectToStringConverter#46d567cb
java.lang.Enum -> java.lang.Integer : org.springframework.core.convert.support.EnumToIntegerConverter#396e6d9
java.lang.Enum -> java.lang.String : org.springframework.core.convert.support.EnumToStringConverter#4efc25fc
java.lang.Integer -> java.lang.Enum : org.springframework.core.convert.support.IntegerToEnumConverterFactory#7ee3d262
java.lang.Long -> java.time.Instant : org.springframework.format.datetime.standard.DateTimeConverters$LongToInstantConverter#732c9b5c
java.lang.Long -> java.util.Calendar : org.springframework.format.datetime.DateFormatterRegistrar$LongToCalendarConverter#2d23faef,java.lang.Long -> java.util.Calendar : org.springframework.format.datetime.DateFormatterRegistrar$LongToCalendarConverter#7cb8437d
java.lang.Long -> java.util.Date : org.springframework.format.datetime.DateFormatterRegistrar$LongToDateConverter#1aac188d,java.lang.Long -> java.util.Date : org.springframework.format.datetime.DateFormatterRegistrar$LongToDateConverter#7026b7ee
java.lang.Long -> org.joda.time.ReadableInstant : org.springframework.format.datetime.joda.JodaTimeConverters$LongToReadableInstantConverter#6b0615ae
java.lang.Number -> java.lang.Character : org.springframework.core.convert.support.NumberToCharacterConverter#363a3d15
java.lang.Number -> java.lang.Number : org.springframework.core.convert.support.NumberToNumberConverterFactory#162b3d47
java.lang.Number -> java.lang.String : org.springframework.core.convert.support.ObjectToStringConverter#3402b4c9
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.lang.Long: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Long: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.time.LocalDate: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.lang.String -> java.time.LocalDate: org.springframework.format.datetime.standard.TemporalAccessorParser#213c3543
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.lang.String -> java.time.LocalDateTime: org.springframework.format.datetime.standard.TemporalAccessorParser#7c29adc8
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.time.LocalTime: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.lang.String -> java.time.LocalTime: org.springframework.format.datetime.standard.TemporalAccessorParser#670ce331
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.time.OffsetTime: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.lang.String -> java.time.OffsetTime: org.springframework.format.datetime.standard.TemporalAccessorParser#514cd540
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.time.ZonedDateTime: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.lang.String -> java.time.ZonedDateTime: org.springframework.format.datetime.standard.TemporalAccessorParser#4bbb49b0
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.util.Calendar: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.util.Date: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat org.joda.time.LocalDate: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,java.lang.String -> org.joda.time.LocalDate: org.springframework.format.datetime.joda.LocalDateParser#771cbb1a
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat org.joda.time.LocalDateTime: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,java.lang.String -> org.joda.time.LocalDateTime: org.springframework.format.datetime.joda.LocalDateTimeParser#3659d7b1
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat org.joda.time.LocalTime: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,java.lang.String -> org.joda.time.LocalTime: org.springframework.format.datetime.joda.LocalTimeParser#6b2e0f78
java.lang.String -> #org.springframework.format.annotation.DateTimeFormat org.joda.time.ReadableInstant: org.springframework.format.datetime.joda.JodaDateTimeFormatAnnotationFormatterFactory#cb03411,java.lang.String -> org.joda.time.ReadableInstant: org.springframework.format.datetime.joda.DateTimeParser#3bdb2c78
java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Byte: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Double: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Float: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Short: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
java.lang.String -> #org.springframework.format.annotation.NumberFormat java.math.BigDecimal: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
java.lang.String -> #org.springframework.format.annotation.NumberFormat java.math.BigInteger: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#431f1eaf
java.lang.String -> [C: org.springframework.boot.convert.CharArrayFormatter#5e746d37
java.lang.String -> java.lang.Boolean : org.springframework.core.convert.support.StringToBooleanConverter#43a51d00
java.lang.String -> java.lang.Character : org.springframework.core.convert.support.StringToCharacterConverter#95bb2a2
java.lang.String -> java.lang.Enum : org.springframework.boot.convert.StringToEnumIgnoringCaseConverterFactory#499683c4,java.lang.String -> java.lang.Enum : org.springframework.core.convert.support.StringToEnumConverterFactory#25da615a
java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#783115d9
java.lang.String -> java.net.InetAddress: org.springframework.boot.convert.InetAddressFormatter#6e1b9411
java.lang.String -> java.nio.charset.Charset : org.springframework.core.convert.support.StringToCharsetConverter#3a5c2626
java.lang.String -> java.time.Instant: org.springframework.format.datetime.standard.InstantFormatter#11d4dbd6
java.lang.String -> java.time.Month: org.springframework.format.datetime.standard.MonthFormatter#186cb891
java.lang.String -> java.time.MonthDay: org.springframework.format.datetime.standard.MonthDayFormatter#440eaa07
java.lang.String -> java.time.OffsetDateTime: org.springframework.boot.convert.IsoOffsetFormatter#f096f37,java.lang.String -> #org.springframework.format.annotation.DateTimeFormat java.time.OffsetDateTime: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.lang.String -> java.time.OffsetDateTime: org.springframework.format.datetime.standard.TemporalAccessorParser#41f4fe5
java.lang.String -> java.time.Period: org.springframework.format.datetime.standard.PeriodFormatter#6f4ade6e
java.lang.String -> java.time.Year: org.springframework.format.datetime.standard.YearFormatter#86733
java.lang.String -> java.time.YearMonth: org.springframework.format.datetime.standard.YearMonthFormatter#3ec2ecea
java.lang.String -> java.util.Currency : org.springframework.core.convert.support.StringToCurrencyConverter#7fb33394
java.lang.String -> java.util.Locale : org.springframework.core.convert.support.StringToLocaleConverter#75308740
java.lang.String -> java.util.Properties : org.springframework.core.convert.support.StringToPropertiesConverter#1a891add
java.lang.String -> java.util.TimeZone : org.springframework.core.convert.support.StringToTimeZoneConverter#6009bea
java.lang.String -> java.util.UUID : org.springframework.core.convert.support.StringToUUIDConverter#373f7450
java.lang.String -> org.joda.time.Duration: org.springframework.format.datetime.joda.DurationFormatter#1c758545
java.lang.String -> org.joda.time.MonthDay: org.springframework.format.datetime.joda.MonthDayFormatter#73a19967
java.lang.String -> org.joda.time.Period: org.springframework.format.datetime.joda.PeriodFormatter#64693226
java.lang.String -> org.joda.time.YearMonth: org.springframework.format.datetime.joda.YearMonthFormatter#117bcfdc
java.net.InetAddress -> java.lang.String : org.springframework.boot.convert.InetAddressFormatter#6e1b9411
java.nio.charset.Charset -> java.lang.String : org.springframework.core.convert.support.ObjectToStringConverter#e48bf9a
java.time.Instant -> java.lang.Long : org.springframework.format.datetime.standard.DateTimeConverters$InstantToLongConverter#38320e34
java.time.Instant -> java.lang.String : org.springframework.format.datetime.standard.InstantFormatter#11d4dbd6
java.time.LocalDateTime -> java.time.LocalDate : org.springframework.format.datetime.standard.DateTimeConverters$LocalDateTimeToLocalDateConverter#62a4417
java.time.LocalDateTime -> java.time.LocalTime : org.springframework.format.datetime.standard.DateTimeConverters$LocalDateTimeToLocalTimeConverter#43f61afb
java.time.Month -> java.lang.String : org.springframework.format.datetime.standard.MonthFormatter#186cb891
java.time.MonthDay -> java.lang.String : org.springframework.format.datetime.standard.MonthDayFormatter#440eaa07
java.time.OffsetDateTime -> java.lang.String : org.springframework.boot.convert.IsoOffsetFormatter#f096f37,#org.springframework.format.annotation.DateTimeFormat java.time.OffsetDateTime -> java.lang.String: org.springframework.format.datetime.standard.Jsr310DateTimeFormatAnnotationFormatterFactory#3d6a6bee,java.time.OffsetDateTime -> java.lang.String : org.springframework.format.datetime.standard.TemporalAccessorPrinter#3effd4f3
java.time.OffsetDateTime -> java.time.Instant : org.springframework.format.datetime.standard.DateTimeConverters$OffsetDateTimeToInstantConverter#367b22e5
java.time.OffsetDateTime -> java.time.LocalDate : org.springframework.format.datetime.standard.DateTimeConverters$OffsetDateTimeToLocalDateConverter#3e5d4f6b
java.time.OffsetDateTime -> java.time.LocalDateTime : org.springframework.format.datetime.standard.DateTimeConverters$OffsetDateTimeToLocalDateTimeConverter#5ae95707
java.time.OffsetDateTime -> java.time.LocalTime : org.springframework.format.datetime.standard.DateTimeConverters$OffsetDateTimeToLocalTimeConverter#39c1fe0b
java.time.OffsetDateTime -> java.time.ZonedDateTime : org.springframework.format.datetime.standard.DateTimeConverters$OffsetDateTimeToZonedDateTimeConverter#62891fc8
java.time.Period -> java.lang.String : org.springframework.format.datetime.standard.PeriodFormatter#6f4ade6e
java.time.Year -> java.lang.String : org.springframework.format.datetime.standard.YearFormatter#86733
java.time.YearMonth -> java.lang.String : org.springframework.format.datetime.standard.YearMonthFormatter#3ec2ecea
java.time.ZoneId -> java.util.TimeZone : org.springframework.core.convert.support.ZoneIdToTimeZoneConverter#7bc6d27a
java.time.ZonedDateTime -> java.time.Instant : org.springframework.format.datetime.standard.DateTimeConverters$ZonedDateTimeToInstantConverter#1ac45389
java.time.ZonedDateTime -> java.time.LocalDate : org.springframework.format.datetime.standard.DateTimeConverters$ZonedDateTimeToLocalDateConverter#713064e8
java.time.ZonedDateTime -> java.time.LocalDateTime : org.springframework.format.datetime.standard.DateTimeConverters$ZonedDateTimeToLocalDateTimeConverter#1bf39d06
java.time.ZonedDateTime -> java.time.LocalTime : org.springframework.format.datetime.standard.DateTimeConverters$ZonedDateTimeToLocalTimeConverter#4fad6218
java.time.ZonedDateTime -> java.time.OffsetDateTime : org.springframework.format.datetime.standard.DateTimeConverters$ZonedDateTimeToOffsetDateTimeConverter#68217d41
java.time.ZonedDateTime -> java.util.Calendar : org.springframework.core.convert.support.ZonedDateTimeToCalendarConverter#75769ab0
java.util.Calendar -> java.lang.Long : org.springframework.format.datetime.DateFormatterRegistrar$CalendarToLongConverter#5a00eb1e,java.util.Calendar -> java.lang.Long : org.springframework.format.datetime.DateFormatterRegistrar$CalendarToLongConverter#36fcf6c0
java.util.Calendar -> java.time.Instant : org.springframework.format.datetime.standard.DateTimeConverters$CalendarToInstantConverter#4c48fe92
java.util.Calendar -> java.time.LocalDate : org.springframework.format.datetime.standard.DateTimeConverters$CalendarToLocalDateConverter#3ae0b770
java.util.Calendar -> java.time.LocalDateTime : org.springframework.format.datetime.standard.DateTimeConverters$CalendarToLocalDateTimeConverter#30e6a763
java.util.Calendar -> java.time.LocalTime : org.springframework.format.datetime.standard.DateTimeConverters$CalendarToLocalTimeConverter#55e3d6c3
java.util.Calendar -> java.time.OffsetDateTime : org.springframework.format.datetime.standard.DateTimeConverters$CalendarToOffsetDateTimeConverter#10bd9df0
java.util.Calendar -> java.time.ZonedDateTime : org.springframework.format.datetime.standard.DateTimeConverters$CalendarToZonedDateTimeConverter#fca387
java.util.Calendar -> java.util.Date : org.springframework.format.datetime.DateFormatterRegistrar$CalendarToDateConverter#6dd82486,java.util.Calendar -> java.util.Date : org.springframework.format.datetime.DateFormatterRegistrar$CalendarToDateConverter#56078cea
java.util.Calendar -> org.joda.time.ReadableInstant : org.springframework.format.datetime.joda.JodaTimeConverters$CalendarToReadableInstantConverter#49c8f6e8
java.util.Currency -> java.lang.String : org.springframework.core.convert.support.ObjectToStringConverter#41bf79da
java.util.Date -> java.lang.Long : org.springframework.format.datetime.DateFormatterRegistrar$DateToLongConverter#4c59e45e,java.util.Date -> java.lang.Long : org.springframework.format.datetime.DateFormatterRegistrar$DateToLongConverter#58ec7116
java.util.Date -> java.util.Calendar : org.springframework.format.datetime.DateFormatterRegistrar$DateToCalendarConverter#63bde6c2,java.util.Date -> java.util.Calendar : org.springframework.format.datetime.DateFormatterRegistrar$DateToCalendarConverter#6ea04618
java.util.Date -> org.joda.time.ReadableInstant : org.springframework.format.datetime.joda.JodaTimeConverters$DateToReadableInstantConverter#2f98635e
java.util.Locale -> java.lang.String : org.springframework.core.convert.support.ObjectToStringConverter#5acc9fdf
java.util.Properties -> java.lang.String : org.springframework.core.convert.support.PropertiesToStringConverter#5176d279
java.util.UUID -> java.lang.String : org.springframework.core.convert.support.ObjectToStringConverter#d74bac4
org.joda.time.DateTime -> java.lang.Long : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToLongConverter#7afbf561
org.joda.time.DateTime -> java.util.Calendar : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToCalendarConverter#7c9bdee9
org.joda.time.DateTime -> java.util.Date : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToDateConverter#4f453e63
org.joda.time.DateTime -> org.joda.time.DateMidnight : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToDateMidnightConverter#624a24f6
org.joda.time.DateTime -> org.joda.time.Instant : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToInstantConverter#338cc75f
org.joda.time.DateTime -> org.joda.time.LocalDate : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToLocalDateConverter#7fc7c4a
org.joda.time.DateTime -> org.joda.time.LocalDateTime : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToLocalDateTimeConverter#53a5e217
org.joda.time.DateTime -> org.joda.time.LocalTime : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToLocalTimeConverter#7aa9e414
org.joda.time.DateTime -> org.joda.time.MutableDateTime : org.springframework.format.datetime.joda.JodaTimeConverters$DateTimeToMutableDateTimeConverter#6b00ad9
org.joda.time.Duration -> java.lang.String : org.springframework.format.datetime.joda.DurationFormatter#1c758545
org.joda.time.LocalDateTime -> org.joda.time.LocalDate : org.springframework.format.datetime.joda.JodaTimeConverters$LocalDateTimeToLocalDateConverter#4e73b552
org.joda.time.LocalDateTime -> org.joda.time.LocalTime : org.springframework.format.datetime.joda.JodaTimeConverters$LocalDateTimeToLocalTimeConverter#221dad51
org.joda.time.MonthDay -> java.lang.String : org.springframework.format.datetime.joda.MonthDayFormatter#73a19967
org.joda.time.Period -> java.lang.String : org.springframework.format.datetime.joda.PeriodFormatter#64693226
org.joda.time.YearMonth -> java.lang.String : org.springframework.format.datetime.joda.YearMonthFormatter#117bcfdc
org.springframework.boot.convert.ArrayToDelimitedStringConverter#2c768ada,org.springframework.core.convert.support.ArrayToStringConverter#c1fca2a
org.springframework.boot.convert.CollectionToDelimitedStringConverter#5d5b5fa7,org.springframework.core.convert.support.CollectionToStringConverter#2a32fb6
org.springframework.boot.convert.DelimitedStringToArrayConverter#5533dc72,org.springframework.core.convert.support.StringToArrayConverter#7c447c76
org.springframework.boot.convert.DelimitedStringToCollectionConverter#6107165,org.springframework.core.convert.support.StringToCollectionConverter#164a62bf
org.springframework.boot.convert.DurationToNumberConverter#5ec46cdd
org.springframework.boot.convert.DurationToStringConverter#39e43310,java.time.Duration -> java.lang.String : org.springframework.format.datetime.standard.DurationFormatter#eb507b9
org.springframework.boot.convert.NumberToDataSizeConverter#112d1c8e
org.springframework.boot.convert.NumberToDurationConverter#21d1b321
org.springframework.boot.convert.StringToDataSizeConverter#2324bfe7
org.springframework.boot.convert.StringToDurationConverter#390877d2,java.lang.String -> java.time.Duration: org.springframework.format.datetime.standard.DurationFormatter#eb507b9
org.springframework.core.convert.support.ArrayToArrayConverter#74aa9c72
org.springframework.core.convert.support.ArrayToCollectionConverter#5ff90645
org.springframework.core.convert.support.ArrayToObjectConverter#64fc097e
org.springframework.core.convert.support.ByteBufferConverter#4aaae508
org.springframework.core.convert.support.ByteBufferConverter#4aaae508
org.springframework.core.convert.support.ByteBufferConverter#4aaae508
org.springframework.core.convert.support.ByteBufferConverter#4aaae508
org.springframework.core.convert.support.CollectionToArrayConverter#387bf2d9
org.springframework.core.convert.support.CollectionToCollectionConverter#5c20aab9
org.springframework.core.convert.support.CollectionToObjectConverter#11ebb1b6
org.springframework.core.convert.support.FallbackObjectToStringConverter#27ace0b1
org.springframework.core.convert.support.IdToEntityConverter#6869a3b3,org.springframework.core.convert.support.ObjectToObjectConverter#6ab4ba9f
org.springframework.core.convert.support.MapToMapConverter#4b7c4456
org.springframework.core.convert.support.ObjectToArrayConverter#1640c151
org.springframework.core.convert.support.ObjectToCollectionConverter#aaee2a2
org.springframework.core.convert.support.ObjectToOptionalConverter#664e5dee
org.springframework.core.convert.support.ObjectToOptionalConverter#664e5dee
org.springframework.core.convert.support.ObjectToOptionalConverter#664e5dee
org.springframework.core.convert.support.StreamConverter#f3021cb
org.springframework.core.convert.support.StreamConverter#f3021cb
org.springframework.core.convert.support.StreamConverter#f3021cb
org.springframework.core.convert.support.StreamConverter#f3021cb
Related
Axon query response not convertible using Jackson and Kotlin
I am writing a POC about Axon, SpringBoot and MongoDB using Kotlin, I have configured my serializers to use Jackson in general, events and messages and everything works as expected (Command, Event and Aggregate). The problem begins when I am trying to perform a Query by QueryGateway I have got this error: java.lang.IllegalArgumentException: Retrieved response [class java.util.ArrayList] is not convertible to a List of the expected response type [class com.mohammali.poc.eventsourcing.models.cardboards.CardBoardDomain] at org.axonframework.messaging.responsetypes.MultipleInstancesResponseType.convert(MultipleInstancesResponseType.java:113) ~[axon-messaging-4.5.15.jar:4.5.15] at org.axonframework.messaging.responsetypes.MultipleInstancesResponseType.convert(MultipleInstancesResponseType.java:44) ~[axon-messaging-4.5.15.jar:4.5.15] at org.axonframework.messaging.responsetypes.ConvertingResponseMessage.getPayload(ConvertingResponseMessage.java:85) ~[axon-messaging-4.5.15.jar:4.5.15] at org.axonframework.queryhandling.DefaultQueryGateway.lambda$query$1(DefaultQueryGateway.java:87) ~[axon-messaging-4.5.15.jar:4.5.15] at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[na:na] at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[na:na] at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[na:na] at org.axonframework.axonserver.connector.query.AxonServerQueryBus$ResponseProcessingTask.run(AxonServerQueryBus.java:761) ~[axon-server-connector-4.5.15.jar:4.5.15] I have tracked the issue and I believe the problem is the response type comes always as java.util.ArrayList without the generic type here is the implementation: Query Handler package com.mohammali.poc.eventsourcing.queryhandler.query import com.mohammali.poc.eventsourcing.models.cardboards.CardBoardDomain import com.mohammali.poc.eventsourcing.models.cardboards.QueryFindAllCardBoard import com.mohammali.poc.eventsourcing.queryhandler.data.MongoCardBoardRepository import org.axonframework.config.ProcessingGroup import org.axonframework.queryhandling.QueryHandler import org.springframework.stereotype.Component #Component #ProcessingGroup("cardboard-query") class CardBoardQueryHandler( private val repository: MongoCardBoardRepository ) { #QueryHandler fun on(query: QueryFindAllCardBoard): List<CardBoardDomain> = repository.findAll().map { CardBoardDomain(it.id!!, it.name!!, it.width!!, it.height!!) } } Query Caller or QueryGateway package com.mohammali.poc.eventsourcing.gateway.usecases import com.mohammali.poc.eventsourcing.models.cardboards.CardBoardDomain import com.mohammali.poc.eventsourcing.models.cardboards.QueryFindAllCardBoard import org.axonframework.extensions.kotlin.queryMany import org.axonframework.queryhandling.QueryGateway import org.springframework.stereotype.Service #Service class CardBoardUseCase( private val queryGateway: QueryGateway ) { fun findAll(): List<CardBoardDomain> = queryGateway.queryMany<CardBoardDomain, QueryFindAllCardBoard>(QueryFindAllCardBoard()).get() } Domain I am using package com.mohammali.poc.eventsourcing.models.cardboards import com.mohammali.poc.eventsourcing.models.Id data class CardBoardDomain( val id: Id, val name: String, val width: Double, val height: Double ) Custom Serializer #Bean #Qualifier("mainObjectMapper") #Primary fun createMapper(): ObjectMapper { val builder = Jackson2ObjectMapperBuilder() builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) val o = builder.build<ObjectMapper>() .registerKotlinModule() .registerModule( SimpleModule() .addSerializer(Id::class.javaObjectType, IdJsonSerializer()) .addSerializer(Id::class.javaPrimitiveType, IdJsonSerializer()) .addDeserializer(Id::class.javaObjectType, IdJsonDeserializer()) .addDeserializer(Id::class.javaPrimitiveType, IdJsonDeserializer()) ) return o } #Bean #Primary fun axonJacksonSerializer(objectMapper: ObjectMapper): Serializer = JacksonSerializer.builder() .objectMapper(objectMapper) .build() Update I have tried adding defaultTyping to JacksonSerializer suggested by Mitchell Herrijgers in this answer but I get a new error: com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected token (START_OBJECT), expected START_ARRAY: need JSON Array to contain As.WRAPPER_ARRAY type information for class java.lang.Object at [Source: (byte[])"[{"id":"1015764681047937024","name":"test","width":10.0,"height":10.0}]"; line: 1, column: 2] (through reference chain: java.util.ArrayList[0]) at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.DeserializationContext.wrongTokenException(DeserializationContext.java:1939) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.DeserializationContext.reportWrongTokenException(DeserializationContext.java:1673) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._locateTypeId(AsArrayTypeDeserializer.java:141) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer._deserialize(AsArrayTypeDeserializer.java:96) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.jsontype.impl.AsArrayTypeDeserializer.deserializeTypedFromAny(AsArrayTypeDeserializer.java:71) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer$Vanilla.deserializeWithType(UntypedObjectDeserializer.java:781) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:357) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:2051) ~[jackson-databind-2.13.3.jar:2.13.3] at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1529) ~[jackson-databind-2.13.3.jar:2.13.3] at org.axonframework.serialization.json.JacksonSerializer.deserialize(JacksonSerializer.java:201) ~[axon-messaging-4.5.15.jar:4.5.15] at org.axonframework.serialization.LazyDeserializingObject.getObject(LazyDeserializingObject.java:102) ~[axon-messaging-4.5.15.jar:4.5.15] at org.axonframework.axonserver.connector.query.GrpcBackedResponseMessage.getPayload(GrpcBackedResponseMessage.java:99) ~[axon-server-connector-4.5.15.jar:4.5.15] at org.axonframework.messaging.responsetypes.ConvertingResponseMessage.getPayload(ConvertingResponseMessage.java:85) ~[axon-messaging-4.5.15.jar:4.5.15] at org.axonframework.queryhandling.DefaultQueryGateway.lambda$query$1(DefaultQueryGateway.java:87) ~[axon-messaging-4.5.15.jar:4.5.15] at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[na:na] at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[na:na] at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[na:na] at org.axonframework.axonserver.connector.query.AxonServerQueryBus$ResponseProcessingTask.run(AxonServerQueryBus.java:761) ~[axon-server-connector-4.5.15.jar:4.5.15] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na] The new config #Bean #Qualifier("mainObjectMapper") #Primary fun createMapper(): ObjectMapper { val builder = Jackson2ObjectMapperBuilder() builder.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) return builder.build<ObjectMapper>() .registerKotlinModule() .registerModule( SimpleModule() .addSerializer(Id::class.javaObjectType, IdJsonSerializer()) .addSerializer(Id::class.javaPrimitiveType, IdJsonSerializer()) .addDeserializer(Id::class.javaObjectType, IdJsonDeserializer()) .addDeserializer(Id::class.javaPrimitiveType, IdJsonDeserializer()) ) .activateDefaultTyping(LaissezFaireSubTypeValidator.instance,ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.WRAPPER_ARRAY) } #Bean #Primary fun axonJacksonSerializer(objectMapper: ObjectMapper): Serializer = JacksonSerializer.builder() .objectMapper(objectMapper) .defaultTyping() .build() Also I am using this config: axon: serializer: general: jackson events: jackson messages: jackson
Jackson loses its type information when using the default ObjectMapper settings. Axon has a method to easily configure including list information into the JSON. You can adjust your bean definition to this: #Bean #Primary fun axonJacksonSerializer(objectMapper: ObjectMapper): Serializer = JacksonSerializer.builder() .objectMapper(objectMapper) .defaultTyping() .build() Calling the defaultTyping() on the builder will set the appropriate setting on the ObjectMapper. You can find more information on the topic here
Pagination and criteria for spring feign client
I'm stuck on setting up a feignclient of one of my microservices. I use criteria (for filtering) and pagination. On one of my microservices I have a service rest and the other use a feignclient to request it. AccountCriteria (criteria interface from jhipster) public class AccountCriteria implements Serializable, Criteria { private LongFilter id; private StringFilter user; private LongFilter bankWebId; private LongFilter bankApiId; private LongFilter deactivationReasonId; public AccountCriteria() { } public AccountCriteria(AccountCriteria other) { this.id = other.id == null ? null : other.id.copy(); this.user = other.user == null ? null : other.user.copy(); this.bankWebId = other.bankWebId == null ? null : other.bankWebId.copy(); this.bankApiId = other.bankApiId == null ? null : other.bankApiId.copy(); this.deactivationReasonId = other.deactivationReasonId == null ? null : other.deactivationReasonId.copy(); } #Override public Criteria copy() { return new AccountCriteria(this); } } AccountIdentifierResource (Rest resource) #RestController #RequestMapping(value = "/api", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public class AccountIdentifierResource { log.debug("REST request to get AccountIdentifiers by criteria: {}", criteria); Page<AccountIdentifier> page = accountIdentifierQueryService.findByCriteria(criteria, pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(uriBuilder.queryParams(queryParams), page); return ResponseEntity.ok().headers(headers).body(page.getContent()); } IdentityProviderFeignClient (feign client) #AuthorizedFeignClient(name = "identityprovider") public interface IdentityProviderFeignClient { #GetMapping("/api/account-identifiers") List<AccountIdentifier> getAllAccountIdentifiers(AccountCriteria criteria, Pageable pageable, #RequestParam("queryParams") MultiValueMap<String, String> queryParams, UriComponentsBuilder uriBuilder); } IdentityProviderService (the service interface) public interface IdentityProviderService { List<AccountIdentifier> getAllAccountIdentifiers(AccountCriteria criteria, Pageable pageable, MultiValueMap<String, String> queryParams, UriComponentsBuilder uriBuilder); } IdentityProviderServiceImpl (the service implementation) #Service public class IdentityProviderServiceImpl implements IdentityProviderService { private final Logger log = LoggerFactory.getLogger(IdentityProviderServiceImpl.class); private final IdentityProviderFeignClient identityProviderFeignClient; public IdentityProviderServiceImpl(IdentityProviderFeignClient identityProviderFeignClient) { this.identityProviderFeignClient = identityProviderFeignClient; } #Override public List<AccountIdentifier> getAllAccountIdentifiers(AccountCriteria criteria, Pageable pageable, MultiValueMap<String, String> queryParams, UriComponentsBuilder uriBuilder) { log.debug("Request to get all AccountIdentifier from IdentityProvider with criteria : {}", criteria); return this.identityProviderFeignClient.getAllAccountIdentifiers(criteria, pageable, queryParams, uriBuilder); } } FeignConfiguration #Configuration #EnableFeignClients(basePackages = "com.soft.jobstrategy") #Import(FeignClientsConfiguration.class) public class FeignConfiguration { /** * Set the Feign specific log level to log client REST requests. */ #Bean feign.Logger.Level feignLoggerLevel() { return feign.Logger.Level.BASIC; } } For now it's impossible to run the application. I get the following traceback: [INFO] Running com.soft.jobstrategy.config.timezone.HibernateTimeZoneIT :: JHipster ? :: Running Spring Boot 2.1.6.RELEASE :: :: https://www.jhipster.tech :: 2019-10-04 16:07:44.465 WARN 2736 --- [ main] kafka.server.BrokerMetadataCheckpoint : No meta.properties file under dir C:\Users\maktouf\AppData\Local\Temp\kafka-6358187594718130765\meta.properties 2019-10-04 16:07:45.097 WARN 2736 --- [ main] kafka.server.BrokerMetadataCheckpoint : No meta.properties file under dir C:\Users\maktouf\AppData\Local\Temp\kafka-6358187594718130765\meta.properties 2019-10-04 16:07:45.343 INFO 2736 --- [ main] c.b.j.c.timezone.HibernateTimeZoneIT : No active profile set, falling back to default profiles: default 2019-10-04 16:07:49.628 WARN 2736 --- [ main] c.b.j.config.CacheConfiguration : No discovery service is set up, Hazelcast cannot create a cluster. 2019-10-04 16:07:51.266 WARN 2736 --- [ main] com.hazelcast.instance.Node : [192.168.1.21]:5701 [dev] [3.11.4] No join method is enabled! Starting standalone. 2019-10-04 16:07:57.509 WARN 2736 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 2019-10-04 16:07:57.918 WARN 2736 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creatin g bean with name 'identityProviderServiceImpl' defined in file [C:\developpement\javaenv\workspace\job_strategy\target\classes\com\soft\jobstrategy\service\impl\IdentityProviderServiceImpl.class]: Unsatisfied dependency expressed through constructor par ameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.soft.jobstrategy.client.IdentityProviderFeignClient': FactoryBean threw exception on object creation; nested exception is java.lang .IllegalStateException: Method has too many Body parameters: public abstract java.util.List com.soft.jobstrategy.client.IdentityProviderFeignClient.getAllAccountIdentifiers(com.soft.jobstrategy.service.dto.AccountCriteria,org.springframework.dat a.domain.Pageable,org.springframework.util.MultiValueMap,org.springframework.web.util.UriComponentsBuilder) 2019-10-04 16:07:57.965 INFO 2736 --- [ main] c.b.j.config.CacheConfiguration : Closing Cache Manager 2019-10-04 16:08:01.744 ERROR 2736 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'identityProviderServiceImpl' defined in file [C:\developpement\javaenv\workspace\job_strategy\target\classes\com\soft\jobstrategy\service\impl\IdentityProvi derServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.soft.jobstrategy.client.IdentityProviderFeignClient' : FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Method has too many Body parameters: public abstract java.util.List com.soft.jobstrategy.client.IdentityProviderFeignClient.getAllAccountIdentifiers(c om.soft.jobstrategy.service.dto.AccountCriteria,org.springframework.data.domain.Pageable,org.springframework.util.MultiValueMap,org.springframework.web.util.UriComponentsBuilder) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1341) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1187) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389) at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:119) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:97) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeTestInstancePostProcessors$5(ClassTestDescriptor.java:349) at org.junit.jupiter.engine.descriptor.JupiterTestDescriptor.executeAndMaskThrowable(JupiterTestDescriptor.java:215) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeTestInstancePostProcessors$6(ClassTestDescriptor.java:349) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312) at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743) at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:742) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeTestInstancePostProcessors(ClassTestDescriptor.java:348) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateAndPostProcessTestInstance(ClassTestDescriptor.java:270) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstanceProvider$2(ClassTestDescriptor.java:259) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstanceProvider$3(ClassTestDescriptor.java:263) at java.util.Optional.orElseGet(Optional.java:267) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$testInstanceProvider$4(ClassTestDescriptor.java:262) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:82) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:59) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$0(NodeTestTask.java:83) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72) at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:83) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:69) at java.util.ArrayList.forEach(ArrayList.java:1257) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74) at java.util.ArrayList.forEach(ArrayList.java:1257) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220) at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188) at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:150) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.soft.jobstrategy.client.IdentityProviderFeignClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateExcept ion: Method has too many Body parameters: public abstract java.util.List com.soft.jobstrategy.client.IdentityProviderFeignClient.getAllAccountIdentifiers(com.soft.jobstrategy.service.dto.AccountCriteria,org.springframework.data.domain.Pageable,o rg.springframework.util.MultiValueMap,org.springframework.web.util.UriComponentsBuilder) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1674) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1249) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:257) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1474) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1431) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1214) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760) ... 73 common frames omitted Thanks everyone for your help. Edit : Finally the answer of Murilo Prado resolved the issue. I also edited the code of the feign client : IdentityProviderFeignClient (feign client) #AuthorizedFeignClient(name = "identityprovider") public interface IdentityProviderFeignClient { #GetMapping("/api/account-identifiers") List<AccountIdentifier> getAllAccountIdentifiers(#QueryParam("search") String criteria, Pageable pageable, #RequestParam("queryParams") MultiValueMap<String, String> queryParams); }
Try this public class FeignConfig { #Autowired private ObjectFactory<HttpMessageConverters> messageConverters; #Bean #ConditionalOnMissingBean public Decoder feignDecoder() { return new OptionalDecoder(new ResponseEntityDecoder(new SpringDecoder(this.messageConverters))); } #Bean #ConditionalOnMissingBean public Encoder feignEncoder() { return new SpringFormEncoder(new SpringEncoder(messageConverters)); } }
Get name of gradle module, and the name of any other modules it depends on
Let's say I have a multi-module gradle project with two gradle modules, :A and :B. . ├── :A │ └── build.gradle ├── :B │ └── build.gradle ├── build.gradle (plugin applied here) └── settings.gradle :A has no dependencies :B has a dependency on :A I want to get the following information. a list of the names of each module in project: :A, :B list of module names that each module is dependant on. For :A, this would be an empty list, and for :B it would be listOf(":A") (single element list) How can I get this information in the context of a custom gradle plugin that's applied to the root gradle module? The use case for this is to generate a visual representation of how each module is connected in a multi-module project
Here is a snippet for going through each Configuration and getting the ProjectDependency types from them. It uses Gradle.projectsEvaluated(org.gradle.api.Action) which executes after all the projects are evaluated. It doesn't do anything to figure out transitives or keep a notion of who depends on who, but this can hopefully give you a starting point for how you might achieve what you are looking for. gradle.projectsEvaluated { println('Projects loaded') println('*' * 15) allprojects.forEach { proj -> final List<ProjectDependency> projectDependencies = proj.configurations.collectMany { Configuration configuration -> configuration.allDependencies }.findAll { Dependency dependency -> dependency instanceof ProjectDependency }.collect { it as ProjectDependency }.unique().collect() println("Project ${proj.name}") println(projectDependencies.collect { " ${it.name} -> ${it.dependencyProject.path}" }.join(System.lineSeparator())) println() } } I tried it out on the junit-team/junit5 repository and got the following output: Projects loaded *************** Project junit5 Project documentation junit-jupiter-api -> :junit-jupiter-api junit-jupiter-params -> :junit-jupiter-params junit-platform-runner -> :junit-platform-runner junit-platform-launcher -> :junit-platform-launcher junit-platform-console -> :junit-platform-console junit-vintage-engine -> :junit-vintage-engine junit-jupiter-engine -> :junit-jupiter-engine Project junit-jupiter-api junit-platform-commons -> :junit-platform-commons Project junit-jupiter-engine junit-platform-engine -> :junit-platform-engine junit-jupiter-api -> :junit-jupiter-api junit-platform-launcher -> :junit-platform-launcher junit-platform-runner -> :junit-platform-runner junit-platform-engine -> :junit-platform-engine junit-platform-console -> :junit-platform-console Project junit-jupiter-migrationsupport junit-jupiter-api -> :junit-jupiter-api junit-jupiter-engine -> :junit-jupiter-engine junit-platform-launcher -> :junit-platform-launcher junit-platform-runner -> :junit-platform-runner junit-platform-engine -> :junit-platform-engine junit-platform-console -> :junit-platform-console Project junit-jupiter-params junit-jupiter-api -> :junit-jupiter-api junit-platform-engine -> :junit-platform-engine junit-jupiter-engine -> :junit-jupiter-engine junit-platform-launcher -> :junit-platform-launcher junit-platform-runner -> :junit-platform-runner junit-platform-console -> :junit-platform-console Project junit-platform-commons Project junit-platform-console junit-platform-launcher -> :junit-platform-launcher Project junit-platform-console-standalone junit-platform-console -> :junit-platform-console junit-jupiter-engine -> :junit-jupiter-engine junit-jupiter-params -> :junit-jupiter-params junit-vintage-engine -> :junit-vintage-engine junit-jupiter-api -> :junit-jupiter-api junit-jupiter-params -> :junit-jupiter-params Project junit-platform-engine junit-platform-commons -> :junit-platform-commons Project junit-platform-gradle-plugin junit-platform-console -> :junit-platform-console junit-platform-launcher -> :junit-platform-launcher junit-jupiter-api -> :junit-jupiter-api junit-platform-console -> :junit-platform-console junit-jupiter-engine -> :junit-jupiter-engine Project junit-platform-launcher junit-platform-engine -> :junit-platform-engine Project junit-platform-runner junit-platform-launcher -> :junit-platform-launcher junit-platform-suite-api -> :junit-platform-suite-api Project junit-platform-suite-api junit-platform-commons -> :junit-platform-commons Project junit-platform-surefire-provider junit-platform-launcher -> :junit-platform-launcher junit-jupiter-api -> :junit-jupiter-api junit-platform-runner -> :junit-platform-runner junit-jupiter-engine -> :junit-jupiter-engine junit-platform-console -> :junit-platform-console Project junit-vintage-engine junit-platform-engine -> :junit-platform-engine junit-platform-launcher -> :junit-platform-launcher junit-jupiter-api -> :junit-jupiter-api junit-platform-runner -> :junit-platform-runner junit-platform-engine -> :junit-platform-engine junit-platform-console -> :junit-platform-console junit-jupiter-engine -> :junit-jupiter-engine Project platform-tests junit-platform-commons -> :junit-platform-commons junit-platform-console -> :junit-platform-console junit-platform-engine -> :junit-platform-engine junit-platform-launcher -> :junit-platform-launcher junit-jupiter-api -> :junit-jupiter-api junit-jupiter-params -> :junit-jupiter-params junit-platform-runner -> :junit-platform-runner junit-platform-engine -> :junit-platform-engine junit-jupiter-engine -> :junit-jupiter-engine junit-vintage-engine -> :junit-vintage-engine junit-jupiter-migrationsupport -> :junit-jupiter-migrationsupport junit-platform-gradle-plugin -> :junit-platform-gradle-plugin junit-platform-surefire-provider -> :junit-platform-surefire-provider
java8 spring 4.2.5 can't convert to java.util.Optional
I have a problem with spring 4.2.5 and java8. Trying to write simple rest: #RequestMapping(value = "raw2", method = RequestMethod.GET) ResponseEntity<String> getTest(#RequestParam Optional<String> p) { return new ResponseEntity<>(HttpStatus.OK); } But keep getting errors: 2016-04-05 20:51:41,436 DEBUG [o.s.web.servlet.DispatcherServlet] DispatcherServlet with name 'dispatcher' processing GET request for [/internal/raw2] 2016-04-05 20:51:41,438 DEBUG [o.s.w.s.m.a.DefaultAnnotationHandlerMapping] Mapping [/internal/raw2] to HandlerExecutionChain with handler [com.test.con] and 1 interceptor 2016-04-05 20:51:41,440 DEBUG [o.s.web.servlet.DispatcherServlet] Last-Modified value for [/internal/raw2] is: -1 2016-04-05 20:51:41,453 DEBUG [org.springframework.beans.BeanUtils] No property editor [java.util.OptionalEditor] found for type java.util.Optional according to 'Editor' suffix convention 2016-04-05 20:51:41,453 DEBUG [o.s.w.s.m.a.AnnotationMethodHandlerExceptionResolver] Resolving exception from handler [com.test.con]: org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type [java.lang.String] to required type [java.util.Optional]; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Optional]: no matching editors or conversion strategy found 2016-04-05 20:51:41,454 DEBUG [o.s.w.s.m.a.ResponseStatusExceptionResolver] Resolving exception from handler [com.test.con]: org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type [java.lang.String] to required type [java.util.Optional]; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Optional]: no matching editors or conversion strategy found 2016-04-05 20:51:41,454 DEBUG [o.s.w.s.m.s.DefaultHandlerExceptionResolver] Resolving exception from handler [com.test.con]: org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type [java.lang.String] to required type [java.util.Optional]; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Optional]: no matching editors or conversion strategy found 2016-04-05 20:51:41,454 WARN [o.s.w.s.m.s.DefaultHandlerExceptionResolver] Failed to convert request element: org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type [java.lang.String] to required type [java.util.Optional]; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Optional]: no matching editors or conversion strategy found
Ensure you have added the <mvc:annotation-driven> tag in XML. This will make sure that convertors are available
IllegalArgumentException by Spring controller
I have a view(jsp) which use jquery to show/hide some field. I am using jquery to post data using ajax to the controller(spring mvc). Works good when I simply entered values in the page but if I click on a link to unhide 2 text boxes, input value into them and then send to the controller I got this exception. I have checked spring logs and I can see all properties were converted to bind with spring but soon after that exception was raised. Below is what I can see in the logs. I have checked all parameters multiple times and nothing is missing/misspelled in jsp/js/java. Any help would be much appreciated 19:40:16,875 DEBUG GenericConversionService:254 - Caching under ConverterCacheKey [sourceType = java.lang.String, targetType = #org.springframework.web.bind.annotation.RequestParam java.lang.String] java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,640 DEBUG GenericConversionService:186 - Converted to 540 19:40:17,644 DEBUG GenericConversionService:139 - Checking if I can convert java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,646 DEBUG GenericConversionService:358 - Searching for converters indexed by sourceType [java.lang.String] 19:40:17,647 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Integer] 19:40:17,649 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,651 DEBUG GenericConversionService:560 - Matching java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,653 DEBUG GenericConversionService:570 - Did not match converter java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,654 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Comparable] 19:40:17,656 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Number] 19:40:17,658 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,660 DEBUG GenericConversionService:576 - Matched converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,661 DEBUG GenericConversionService:254 - Caching under ConverterCacheKey [sourceType = java.lang.String, targetType = #org.springframework.web.bind.annotation.RequestParam int] 19:40:17,663 DEBUG GenericConversionService:147 - Yes, I can convert 19:40:17,665 DEBUG GenericConversionService:159 - Converting value '1380' of java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,667 DEBUG GenericConversionService:246 - Matched cached converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,668 DEBUG GenericConversionService:186 - Converted to 1380 19:40:17,672 DEBUG GenericConversionService:139 - Checking if I can convert java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,673 DEBUG GenericConversionService:358 - Searching for converters indexed by sourceType [java.lang.String] 19:40:17,675 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Integer] 19:40:17,677 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,679 DEBUG GenericConversionService:560 - Matching java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,680 DEBUG GenericConversionService:570 - Did not match converter java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,682 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Comparable] 19:40:17,684 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Number] 19:40:17,685 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,687 DEBUG GenericConversionService:576 - Matched converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,689 DEBUG GenericConversionService:254 - Caching under ConverterCacheKey [sourceType = java.lang.String, targetType = #org.springframework.web.bind.annotation.RequestParam int] 19:40:17,691 DEBUG GenericConversionService:147 - Yes, I can convert 19:40:17,693 DEBUG GenericConversionService:159 - Converting value '540' of java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,694 DEBUG GenericConversionService:246 - Matched cached converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,696 DEBUG GenericConversionService:186 - Converted to 540 19:40:17,699 DEBUG GenericConversionService:139 - Checking if I can convert java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,701 DEBUG GenericConversionService:358 - Searching for converters indexed by sourceType [java.lang.String] 19:40:17,703 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Integer] 19:40:17,705 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,707 DEBUG GenericConversionService:560 - Matching java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,708 DEBUG GenericConversionService:570 - Did not match converter java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,710 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Comparable] 19:40:17,712 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Number] 19:40:17,713 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,715 DEBUG GenericConversionService:576 - Matched converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,717 DEBUG GenericConversionService:254 - Caching under ConverterCacheKey [sourceType = java.lang.String, targetType = #org.springframework.web.bind.annotation.RequestParam int] 19:40:17,719 DEBUG GenericConversionService:147 - Yes, I can convert 19:40:17,720 DEBUG GenericConversionService:159 - Converting value '1380' of java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,722 DEBUG GenericConversionService:246 - Matched cached converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,724 DEBUG GenericConversionService:186 - Converted to 1380 19:40:17,727 DEBUG GenericConversionService:139 - Checking if I can convert java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,729 DEBUG GenericConversionService:358 - Searching for converters indexed by sourceType [java.lang.String] 19:40:17,731 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Integer] 19:40:17,732 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,734 DEBUG GenericConversionService:560 - Matching java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,736 DEBUG GenericConversionService:570 - Did not match converter java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,737 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Comparable] 19:40:17,739 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Number] 19:40:17,741 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,743 DEBUG GenericConversionService:576 - Matched converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,744 DEBUG GenericConversionService:254 - Caching under ConverterCacheKey [sourceType = java.lang.String, targetType = #org.springframework.web.bind.annotation.RequestParam int] 19:40:17,746 DEBUG GenericConversionService:147 - Yes, I can convert 19:40:17,748 DEBUG GenericConversionService:159 - Converting value '540' of java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,750 DEBUG GenericConversionService:246 - Matched cached converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,780 DEBUG GenericConversionService:186 - Converted to 540 19:40:17,784 DEBUG GenericConversionService:139 - Checking if I can convert java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,786 DEBUG GenericConversionService:358 - Searching for converters indexed by sourceType [java.lang.String] 19:40:17,788 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Integer] 19:40:17,790 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,792 DEBUG GenericConversionService:560 - Matching java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,794 DEBUG GenericConversionService:570 - Did not match converter java.lang.String -> #org.springframework.format.annotation.NumberFormat java.lang.Integer: org.springframework.format.number.NumberFormatAnnotationFormatterFactory#4a6ca1a6 19:40:17,795 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Comparable] 19:40:17,797 DEBUG GenericConversionService:429 - and indexed by targetType [java.lang.Number] 19:40:17,799 DEBUG GenericConversionService:473 - Found matchable converters java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,800 DEBUG GenericConversionService:576 - Matched converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,802 DEBUG GenericConversionService:254 - Caching under ConverterCacheKey [sourceType = java.lang.String, targetType = #org.springframework.web.bind.annotation.RequestParam int] 19:40:17,804 DEBUG GenericConversionService:147 - Yes, I can convert 19:40:17,806 DEBUG GenericConversionService:159 - Converting value '1380' of java.lang.String to #org.springframework.web.bind.annotation.RequestParam int 19:40:17,807 DEBUG GenericConversionService:246 - Matched cached converter java.lang.String -> java.lang.Number : org.springframework.core.convert.support.StringToNumberConverterFactory#21e8bf76 19:40:17,809 DEBUG GenericConversionService:186 - Converted to 1380 19:40:17,812 DEBUG HandlerMethodInvoker:173 - Invoking request handler method: public com.zeater.guru.admin.command.ResultVO com.zeater.guru.admin.controller.RestaurantController.addRestaurant(java.lang.String,java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,int,int,float,float,int,float,boolean,boolean,int,java.lang.String,java.lang.String,java.lang.String,int,int,int,int,int,int,int,int,int,int,int,int,int,int,org.springframework.ui.Model) 19:40:17,815 DEBUG AnnotationMethodHandlerExceptionResolver:132 - Resolving exception from handler [com.zeater.guru.admin.controller.RestaurantController#144683c2]: java.lang.IllegalArgumentException 19:40:17,818 DEBUG ResponseStatusExceptionResolver:132 - Resolving exception from handler [com.zeater.guru.admin.controller.RestaurantController#144683c2]: java.lang.IllegalArgumentException 19:40:17,820 DEBUG DefaultHandlerExceptionResolver:132 - Resolving exception from handler [com.zeater.guru.admin.controller.RestaurantController#144683c2]: java.lang.IllegalArgumentException 19:40:17,822 DEBUG DispatcherServlet:667 - Cleared thread-bound request context: org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper#188edd79 19:40:17,824 DEBUG DispatcherServlet:671 - Could not complete request java.lang.IllegalArgumentException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
A complete stack trace will be much appreciated. The problem could be, spring could not convert one of your method parameter. You should refactor that method, it has too many parameters. You could create a dto that wraps all of the parameters(except for those provided by Spring). EDIT: Instead of using a lot of #RequestParam annotations. You could wrap all your method parameters in one wrapper object (DTO). Example: public class MyWrapperDTO { private String someStrValue; private String anotherStrValue; private int someIntValue; // getters/setters omitted } From here you could choose 2 options: using #ModelAttribute or #RequestBody For the first one: #Controller public class Controller { #RequestMapping(value = "/mypage/view") public ModelAndView viewPage() { MyWrapperDTO dto = new MyWrapperDTO(); // you could provide default values for your form here return new ModelAndView("/mypage"). .addObject("form", dto); } #RequestMapping(value = "/mypage/save", method = RequestMethod.POST) #ResponseBody public void doSomething(#ModelAttribute("form") MyWrapperDTO dto) { // process your ajax call here // do something } } Your jsp should look like this: <spring:url var="myAjaxCall" value="/mypage/save" /> <!-- you should use spring form tag --> <form:form commandName="form" action="${myAjaxCall}"> <form:input path="someStrValue"></form:input> <form:input path="anotherStrValue"></form:input> <form:input path="someIntValue"></form:input> <input type="submit" value="Submit"></input> </form:form> Second option (#RequestBody), assuming you are sending a JSON object (this involves some jquery): #Controller public class Controller { #RequestMapping(value = "/mypage/view") public ModelAndView viewPage() { MyWrapperDTO dto = new MyWrapperDTO(); // you could provide default values for your form here return new ModelAndView("/mypage"). .addObject("form", dto); } #RequestMapping(value = "/mypage/save", method = RequestMethod.POST) #ResponseBody public void doSomething(#RequestBody MyWrapperDTO dto) { // process your ajax call here // do something } } for your jsp: <spring:url var="myAjaxCall" value="/mypage/save" /> <script type="text/javascript"> $(document).ready(function() { $(document).on('click', '#submit', function() { // not the best way to do it var data = { 'someStrValue': $('#someStrValue').val(), 'anotherStrValue': $('#anotherStrValue').val(), 'someIntValue': $('#someIntValue').val() }; // use jQuery.ajax jQuery.ajax({ 'data': JSON.stringify(data), 'type': 'POST', 'ur': '${myAjaxCall}', 'success': function(data) { // yehey! } }); }); }); </script> <!-- you should use spring form tag --> <form:form commandName="form"> <form:input id="someStrValue" path="someStrValue"></form:input> <form:input id="anotherStrValue" path="anotherStrValue"></form:input> <form:input id="someIntValue" path="someIntValue"></form:input> <button id="submit" type="button">Submit</button> </form:form> Spring will handle conversion/binding to your wrapper object. The second option requires you to have jackson in your classpath.