Error messages once a NativeScript app loads on Android - nativescript

after updating my app to NativeScript 5.1/tns-core-modules to 5.1.2, I am having this messages once the app starts:
01-30 09:59:57.001 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[]) (Runtime.java:-2)
01-30 09:59:57.001 12223 12223 I art : at java.lang.Object com.tns.Runtime.dispatchCallJSMethodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[]) (Runtime.java:1120)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethodImpl(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:1000)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:987)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[]) (Runtime.java:967)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[]) (Runtime.java:959)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[]) (Runtime.java:-2)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.dispatchCallJSMethodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[]) (Runtime.java:1120)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethodImpl(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:1000)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:987)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[]) (Runtime.java:967)
01-30 09:59:57.002 12223 12223 I art : at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[]) (Runtime.java:959)
I have removed the /core_modules, /hooks, /platforms/android folders and the messages are still showing.
Any clue whats going on?
Thanks!

These are only warnings and you don't have to worry about it. Still, if you are interested in what is causing them and how to (possibly) remove them, see the discussion in the opened issue here:
https://github.com/NativeScript/nativescript-cli/issues/4300#issuecomment-439092313

Related

Visual Studio 2022 Solution Explorer crash

Recently i got this error in Solution Explorer while working.
Looked through it already, disabled some GPU's optimization that was mentioned in some guides, but still no result.
Here's the full error
Failed to create view with exception:
System.TypeLoadException: Method 'GetDefaultEvent' in type 'Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer.LocalizableProperties' from assembly 'Microsoft.VisualStudio.LanguageServices.Implementation, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
at System.ModuleHandle.ResolveMethod(RuntimeModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount)
at System.ModuleHandle.ResolveMethodHandleInternalCore(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount)
at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveMethod(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.Resolve(MethodRef methodRef)
at Microsoft.VisualStudio.Composition.Reflection.MemberRef.get_MemberInfo()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__11_0(RuntimeImport import)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__11_0(RuntimeImport import)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0`1.<As>b__0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.VisualStudio.PlatformUI.AttachedCollectionService.OnCollectionSourceProvidersAdded(Object sender, LazyActivationAddedEventArgs`2 e)
at Microsoft.VisualStudio.PlatformUI.LazyActivationWrapper`2.ScanForNewApplicableComponents(ComponentScanReason scanReason)
at Microsoft.VisualStudio.PlatformUI.LazyActivationWrapper`2.<<EnsureComponents>b__25_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
at Microsoft.VisualStudio.PlatformUI.LazyActivationWrapper`2.EnsureComponents()
at Microsoft.VisualStudio.PlatformUI.LazyActivationWrapper`2.GetOrderedApplicableComponents()
at Microsoft.VisualStudio.PlatformUI.AttachedCollectionService.AggregateItemsSource(Object item, String relationshipName)
at Microsoft.VisualStudio.PlatformUI.AttachedCollectionService.GetOrCreateCollectionSource(Object item, String relationshipName)
at Microsoft.VisualStudio.PlatformUI.SolutionNavigatorPane.HookShowSolutionNodeEvents(IVsHierarchyItem solution)
at Microsoft.VisualStudio.PlatformUI.SolutionNavigatorPane.RefillNavigator(Boolean skipRestorePhase, Boolean isFirstLoad)
Im tried everything that was mentioned in guides related to this problem, but im still struggling with it. Thank's to everyone in advance :)

springboot fails while running bootRun for gradle project

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

get fatal error: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException'

Sometimes we get error System.OutOfMemoryException . complete error is
FATAL 2017-12-24 17:01:45,360 [39 ] Abp.AbpBootstrapper - System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at Abp.Modules.AbpModule.FindDependedModuleTypes(Type moduleType) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModule.cs:line 108
at Abp.Modules.AbpModule.AddModuleAndDependenciesRecursively(List1 modules, Type module) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModule.cs:line 143
at Abp.Modules.AbpModule.FindDependedModuleTypesRecursivelyIncludingGivenModule(Type moduleType) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModule.cs:line 124
at Abp.Modules.AbpModuleManager.FindAllModuleTypes(List1& plugInModuleTypes) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 86
at Abp.Modules.AbpModuleManager.LoadAllModules() in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 67
at Abp.Modules.AbpModuleManager.Initialize(Type startupModule) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 40
at Abp.AbpBootstrapper.Initialize() in D:\Github\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:line 146
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at Abp.Modules.AbpModule.FindDependedModuleTypes(Type moduleType) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModule.cs:line 108
at Abp.Modules.AbpModule.AddModuleAndDependenciesRecursively(List1 modules, Type module) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModule.cs:line 143
at Abp.Modules.AbpModule.FindDependedModuleTypesRecursivelyIncludingGivenModule(Type moduleType) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModule.cs:line 124
at Abp.Modules.AbpModuleManager.FindAllModuleTypes(List1& plugInModuleTypes) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 86
at Abp.Modules.AbpModuleManager.LoadAllModules() in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 67
at Abp.Modules.AbpModuleManager.Initialize(Type startupModule) in D:\Github\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:line 40
at Abp.AbpBootstrapper.Initialize() in D:\Github\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:line 146
we use ASPNetBoilerplate, AngularJs and entity framework
looks like you've misconfigured ABP dependencies. FindDependedModuleTypesRecursivelyIncludingGivenModule() method recursively loads dependent modules and it might go into infinite loop. check all the [DependsOn(typeof(XXXX))] attributes!

using spring data jpa with spring boot issue

my entity Client
#Entity
public class Client implements Serializable {
#Id #GeneratedValue
private long code;
private String nom;
private String email;
#OneToMany(mappedBy = "client",fetch = FetchType.LAZY)
private Collection<Compte> comptes;
public Client(long code, String nom, String email, Collection<Compte> comptes) {
this.code = code;
this.nom = nom;
this.email = email;
this.comptes = comptes;
}
/...
getters and setters
}
entity Compte
#Entity
#Inheritance(strategy = InheritanceType.SINGLE_TABLE)
#DiscriminatorColumn(name = "TYPE_CPTE,",discriminatorType= DiscriminatorType.STRING,length = 2)
public abstract class Compte implements Serializable {
#Id
private String codeCompte;
private Date dataCreation;
private double solde;
#ManyToOne
#JoinColumn(name="CODE_CLI")
private Client client;
#OneToMany(mappedBy="compte")
private Collection<Operation> operations;
public Compte() {
super();
}
public Compte(String codeCompte, Date dataCreation, double solde, Client client, Collection<Operation> operations) {
this.codeCompte = codeCompte;
this.dataCreation = dataCreation;
this.solde = solde;
this.client = client;
this.operations = operations;
}
/...
getters and setters
}
entity Operation
#Entity
#Inheritance(strategy = InheritanceType.SINGLE_TABLE)
#DiscriminatorColumn(name = "TYPE_OP",discriminatorType = DiscriminatorType.STRING,length = 1)
public abstract class Operation implements Serializable{
#Id #GeneratedValue
private long numero;
private Date dateOperation;
private double montant;
#ManyToOne
#JoinColumn(name = "CODE_CPTE")
private Compte compte;
public Operation() {
super();
}
public Operation(Date dateOperation, double montant, Compte compte) {
this.dateOperation = dateOperation;
this.montant = montant;
this.compte = compte;
}
/...getters and setters
}
entity Retirer
#Entity
#DiscriminatorValue("R")
public class Retrait extends Operation {
public Retrait() {
}
public Retrait(Date dateOperation, double montant, Compte compte) {
super(dateOperation, montant, compte);
}
}
entity versement
#Entity
#DiscriminatorValue("V")
public class Versement extends Operation {
public Versement() {
}
public Versement(Date dateOperation, double montant, Compte compte) {
super(dateOperation, montant, compte);
}
}
entity Comptecourant
#Entity
#DiscriminatorValue("CE")
public class CompteEpargne extends Compte {
private double taux;
public CompteEpargne(String s, Date date, int i, Client c2, double taux) {
this.taux = taux;
}
public CompteEpargne(String codeCompte, Date dataCreation, double solde, Client client, Collection<Operation> operations, double taux) {
super(codeCompte, dataCreation, solde, client, operations);
this.taux = taux;
}
public CompteEpargne(){
super();
}
/...getters and setters
}
**entity CompteEpagne**
#Entity
#DiscriminatorValue("CC")
public class CompteCourant extends Compte {
private double decouvert;
public CompteCourant(String s, Date date, int i, Client c1, double decouvert) {
this.decouvert = decouvert;
}
public CompteCourant(String codeCompte, Date dataCreation, double solde, Client client, Collection<Operation> operations, double decouvert) {
super(codeCompte, dataCreation, solde, client, operations);
this.decouvert = decouvert;
}
public CompteCourant(){
super();
}
/...getters and setters
}
Repositorys
1
#Repository
public interface ClientRep extends JpaRepository<Client,Long> {
}
2
#Repository
public interface CompteRep extends JpaRepository<Compte,String> {
}
3
#Repository
public interface OperationRep extends JpaRepository<Operation,Long> {
#Query("select o from Operation o where o.compte.codeCompte=:x order by o.dateOperation desc ")
public Page<Operation> listOperation(String codeCpte, Pageable pageable);
}
service
public interface IBankMetier {
public Compte consulterCompte(String codeCpte);
public void verser(String codeCpte, double montant);
public void retirer(String codeCpte, double montant);
public void virement(String codeCpte1, String codeCpte2, double montant);
public Page<Operation> listOperation(String codeCpte, int page, int size);
}
implimantation
#Service
#Transactional
public class BankMetierImp implements IBankMetier {
#Autowired
private CompteRep compteRep;
#Autowired
private OperationRep operationRep;
#Override
public Compte consulterCompte(String codeCpte) {
Compte cp = compteRep.findOne(codeCpte);
if (cp == null) throw new RuntimeException("Compte introvable");
return cp;
}
#Override
public void verser(String codeCpte, double montant) {
Compte cp = consulterCompte(codeCpte);
Versement v = new Versement(new Date(), montant, cp);
operationRep.save(v);
cp.setSolde((cp.getSolde() + montant));
compteRep.save(cp);
}
#Override
public void retirer(String codeCpte, double montant) {
Compte cp = consulterCompte(codeCpte);
double facili = 0;
if (cp instanceof CompteCourant)
facili = ((CompteCourant) cp).getDecouvert();
if (cp.getSolde() + facili < montant)
throw new RuntimeException("solde insuffisant");
Retrait retrait = new Retrait(new Date(), montant, cp);
operationRep.save(retrait);
cp.setSolde((cp.getSolde() - montant));
compteRep.save(cp);
}
#Override
public void virement(String codeCpte1, String codeCpte2, double montant) {
retirer(codeCpte1, montant);
verser(codeCpte2, montant);
}
#Override
public Page<Operation> listOperation(String codeCpte, int page, int size) {
return operationRep.listOperation(codeCpte,new PageRequest(page,size));
}
}
Spring boot Application
#SpringBootApplication
public class MeinproApplication implements CommandLineRunner {
#Autowired
private ClientRep clientRep;
#Autowired
private CompteRep compteRep;
#Autowired
private OperationRep operationRep;
#Autowired
BankMetierImp bankMetier;
public static void main(String[] args) {
SpringApplication.run(MeinproApplication.class, args);
}
#Override
public void run(String... strings) throws Exception {
Client c1=clientRep.save(new Client("martin","martin#gmail.com"));
Client c2=clientRep.save(new Client("john","john#gmail.com"));
Compte cp1=compteRep.save(new CompteCourant("c1",new Date(),9000,c1,6000));
Compte cp2=compteRep.save(new CompteEpargne("c2",new Date(),63000,c2,12220));
operationRep.save(new Retrait(new Date(),6000,cp1));
operationRep.save(new Retrait(new Date(),10000,cp2));
operationRep.save(new Versement(new Date(),2000,cp1));
operationRep.save(new Versement(new Date(),20,cp2));
bankMetier.verser("c1",1000);
bankMetier.virement("c1","c2",2000);
}
}
application.properties
# DataSource settings:
spring.datasource.url=jdbc:mysql://localhost:3306/monbank
spring.datasource.username=roo
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
when I run it booom !!!!
2017-02-12 16:15:24.858 INFO 6232 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.0.11.Final}
2017-02-12 16:15:24.860 INFO 6232 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2017-02-12 16:15:24.863 INFO 6232 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2017-02-12 16:15:24.947 INFO 6232 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-02-12 16:15:25.113 INFO 6232 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2017-02-12 16:15:25.938 INFO 6232 --- [ restartedMain] org.hibernate.tuple.PojoInstantiator : HHH000182: No default (no-argument) constructor for class: meinpro.entiti.Client (class must be instantiated by Interceptor)
2017-02-12 16:15:26.209 INFO 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
Hibernate: alter table compte drop foreign key FK2hw4shqsxc782lychpkr52lmv
2017-02-12 16:15:26.228 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table compte drop foreign key FK2hw4shqsxc782lychpkr52lmv
2017-02-12 16:15:26.228 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'monbank.compte' doesn't exist
Hibernate: alter table operation drop foreign key FKkr9nfjf0ipqrw5xwcf9jqq6gv
2017-02-12 16:15:26.229 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table operation drop foreign key FKkr9nfjf0ipqrw5xwcf9jqq6gv
2017-02-12 16:15:26.229 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'monbank.operation' doesn't exist
Hibernate: drop table if exists client
Hibernate: drop table if exists compte
Hibernate: drop table if exists operation
Hibernate: create table client (code bigint not null auto_increment, email varchar(255), nom varchar(255), primary key (code))
Hibernate: create table compte (type_cpte, varchar(2) not null, code_compte varchar(255) not null, data_creation datetime, solde double precision not null, decouvert double precision, taux double precision, code_cli bigint, primary key (code_compte))
2017-02-12 16:15:26.712 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table compte (type_cpte, varchar(2) not null, code_compte varchar(255) not null, data_creation datetime, solde double precision not null, decouvert double precision, taux double precision, code_cli bigint, primary key (code_compte))
2017-02-12 16:15:26.713 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' varchar(2) not null, code_compte varchar(255) not null, data_creation datetime,' at line 1
Hibernate: create table operation (type_op varchar(1) not null, numero bigint not null auto_increment, date_operation datetime, montant double precision not null, code_cpte varchar(255), primary key (numero))
Hibernate: alter table compte add constraint FK2hw4shqsxc782lychpkr52lmv foreign key (code_cli) references client (code)
2017-02-12 16:15:27.146 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table compte add constraint FK2hw4shqsxc782lychpkr52lmv foreign key (code_cli) references client (code)
2017-02-12 16:15:27.147 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'monbank.compte' doesn't exist
Hibernate: alter table operation add constraint FKkr9nfjf0ipqrw5xwcf9jqq6gv foreign key (code_cpte) references compte (code_compte)
2017-02-12 16:15:27.330 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table operation add constraint FKkr9nfjf0ipqrw5xwcf9jqq6gv foreign key (code_cpte) references compte (code_compte)
2017-02-12 16:15:27.331 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Can't create table `monbank`.`#sql-23d4_77` (errno: 150 "Foreign key constraint is incorrectly formed")
2017-02-12 16:15:27.332 INFO 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2017-02-12 16:15:27.414 INFO 6232 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-02-12 16:15:27.938 INFO 6232 --- [ restartedMain] o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory
2017-02-12 16:15:28.776 INFO 6232 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2ffb82a2: startup date [Sun Feb 12 16:15:18 PST 2017]; root of context hierarchy
2017-02-12 16:15:28.936 INFO 6232 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-02-12 16:15:28.938 INFO 6232 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-02-12 16:15:29.022 INFO 6232 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-12 16:15:29.022 INFO 6232 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-12 16:15:29.112 INFO 6232 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-12 16:15:29.263 WARN 6232 --- [ restartedMain] .t.AbstractTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2017-02-12 16:15:30.063 INFO 6232 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2017-02-12 16:15:30.159 INFO 6232 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-02-12 16:15:30.246 INFO 6232 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
Hibernate: insert into client (email, nom) values (?, ?)
Hibernate: insert into client (email, nom) values (?, ?)
2017-02-12 16:15:30.461 INFO 6232 --- [ restartedMain] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-02-12 16:15:30.472 ERROR 6232 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:779) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
at meinpro.MeinproApplication.main(MeinproApplication.java:30) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.1.RELEASE.jar:1.5.1.RELEASE]
Caused by: org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save(): meinpro.entiti.Compte; nested exception is org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): meinpro.entiti.Compte
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:333) ~[spring-orm-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:244) ~[spring-orm-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:491) ~[spring-orm-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133) ~[spring-data-jpa-1.11.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at com.sun.proxy.$Proxy86.save(Unknown Source) ~[na:na]
at meinpro.MeinproApplication.run(MeinproApplication.java:38) [classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
... 11 common frames omitted
Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): meinpro.entiti.Compte
at org.hibernate.id.Assigned.generate(Assigned.java:34) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:67) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:775) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:748) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:753) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1146) ~[hibernate-entitymanager-5.0.11.Final.jar:5.0.11.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:298) ~[spring-orm-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at com.sun.proxy.$Proxy82.persist(Unknown Source) ~[na:na]
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:508) ~[spring-data-jpa-1.11.0.RELEASE.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:504) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:489) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.13.0.RELEASE.jar:na]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE]
... 22 common frames omitted
2017-02-12 16:15:30.478 INFO 6232 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2ffb82a2: startup date [Sun Feb 12 16:15:18 PST 2017]; root of context hierarchy
2017-02-12 16:15:30.483 INFO 6232 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-02-12 16:15:30.485 INFO 6232 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-02-12 16:15:30.485 INFO 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
Hibernate: alter table compte drop foreign key FK2hw4shqsxc782lychpkr52lmv
2017-02-12 16:15:30.488 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table compte drop foreign key FK2hw4shqsxc782lychpkr52lmv
2017-02-12 16:15:30.489 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'monbank.compte' doesn't exist
Hibernate: alter table operation drop foreign key FKkr9nfjf0ipqrw5xwcf9jqq6gv
2017-02-12 16:15:30.499 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table operation drop foreign key FKkr9nfjf0ipqrw5xwcf9jqq6gv
2017-02-12 16:15:30.500 ERROR 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Can't DROP 'FKkr9nfjf0ipqrw5xwcf9jqq6gv'; check that column/key exists
Hibernate: drop table if exists client
Hibernate: drop table if exists compte
Hibernate: drop table if exists operation
2017-02-12 16:15:30.879 INFO 6232 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
Process finished with exit code 0
please help me
The error message is telling you exactly what the problem is
Caused by: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): meinpro.entiti.Compte
The id in your Compte class is not a generated value, like the other tables
#Id
private String codeCompte;
So you need to set this value yourself before you save it.
Now look at the CompteEpargne and the CompteCourant (which extend Compte) constructors
public CompteEpargne(String s, Date date, int i, Client c2, double taux) {
this.taux = taux;
}
public CompteEpargne(String codeCompte, Date dataCreation, double solde, Client client, Collection<Operation> operations, double taux) {
super(codeCompte, dataCreation, solde, client, operations);
this.taux = taux;
}
public CompteCourant(String s, Date date, int i, Client c1, double decouvert) {
this.decouvert = decouvert;
}
public CompteCourant(String codeCompte, Date dataCreation, double solde, Client client, Collection<Operation> operations, double decouvert) {
super(codeCompte, dataCreation, solde, client, operations);
this.decouvert = decouvert;
}
The first constructor of each type only sets one value, while the second calls the super constructor, which set all the values (id included). When you are saving, you are using the first constructor
Compte cp1=compteRep.save(new CompteCourant("c1",new Date(),9000,c1,6000));
Compte cp2=compteRep.save(new CompteEpargne("c2",new Date(),63000,c2,12220));
You are calling the constructor that only sets one value. So you probably need to fix how that those constructors are setting properties. Maybe you want to do something like
public CompteEpargne(String s, Date date, int i, Client c2, double taux) {
this(s, date, i, c2, new ArrayList<Operation>(), taux);
}
where you call the other constructor.
Simple Solution
Your id attribute is not set. This may be due to the fact that the DB field is not set to auto increment.
For MySQL (as you have given in Properties file) use this below sample for defining your POJO class.
#Id #GeneratedValue(strategy = GenerationType.IDENTITY) #Column(name="id", unique=true, nullable=false) public Long getId() { return this.id; }
thanks friends the problem is in the class Compte
#DiscriminatorColumn(name = "TYPE_CPTE,",discriminatorType= DiscriminatorType.STRING,length = 2)
with in the name is ="TYPE_CPTE," hhhh I dont see the comma after TYPE_CPTE
#DiscriminatorColumn(name = "TYPE_CPTE",discriminatorType= DiscriminatorType.STRING,length = 2)

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.

Resources