Background error reporting problem log
2021-12-30 15:41:24.675 WARN [nio-9008-exec-1] [] i.s.m.p.AbstractSerializableParameter [421] : Illegal DefaultValue 1024 for parameter type integer
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:601)
at java.lang.Long.valueOf(Long.java:803)
at io.swagger.models.parameters.AbstractSerializableParameter.getExample(AbstractSerializableParameter.java:412)
at sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:689)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:755)
Troubleshooting
In abstractserializableparameter.getexample (abstractserializableparameter.java:412) break point debugging. You can find that the value of example is an empty string and execute long Valueof (this.example) will throw ‘Java.lang.numberformatexception’ exception
Solution:
1. modify source code
2. Download the source code and change the if (this.example = = null) judgment to if (this.example = = null | example.isempty())
3. adjust dependency (recommended)
4. Exclude swagger models of swagger2 and add swagger models with version 1.5.21
<!-- Illegal DefaultValue null for parameter type integer -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.10.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
After adjustment, you can see that the new version has modified the decision logic
after the above operations, no error will be reported when accessing the swagger document address.
Read More:
- [Solved] Swagger Startup Error: java.lang.NumberFormatException: For input string: ““
- [Solved] Hibernate Error: java.lang.StackOverflowError at java.lang.Integer.toString(Integer.java:402)
- [Solved] Java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘__frch_it
- [Solved] swagger Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is java.lang.NullP
- [Solved] Failed to convert value of type ‘java.lang.String‘ to required type ‘java.util.Date‘;
- JAVA Error Illegal access: this web application instance has been stopped already. Could not load net.sf
- [Solved] fasterxml ToStringSerializerBase Error: Caused by: java.lang.NoClassDefFoundError…
- [Solved] defineClass Error: java.lang.NoClassDefFoundError: Illegal:
- [Solved] JPA sett in parameter error: Java.lang.illegalargumentexception
- Java back end receives localdatetime type parameter
- [Solved] Java.lang.ClassCastException: [Ljava.lang.Long; cannot be cast to java.util.List
- How to Solve Swagger error: IllegalStateException
- [Solved] Java 9 reflection error: java.lang.reflect.InaccessibleObjectException
- [Solved] No validator could be found for constraint ‘javax.validation.constraints.NotBlank’ validating type ‘java.lang.String’
- Caused by: java.lang.IllegalStateException (How to Fix)
- [Solved] nacos Startup Error: nested exception is java.lang.RuntimeException: java.lang.RuntimeException: [db-load-error
- [Solved] Error updating database. Cause: java.sql.SQLException: Incorrect integer value: ‘**‘ for column
- [Solved] Invocation of init method failed; nested exception is java.lang.NoSuchMethodError:
- [Solved] Springboot Error: swagger-UI/index.html Access Error 404
- java: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x590