davidfantasy / mybatis-plus-generator-ui

对mybatis-plus-generator进行封装,通过Web UI快速生成兼容Spring boot,mybatis-plus框架的各类业务代码
Apache License 2.0
1.85k stars 473 forks source link

启动报错 #69

Open hoppinging opened 1 year ago

hoppinging commented 1 year ago

当前使用版本(必填,否则不予处理)

2.0.1

该问题是如何引起的?(确定最新版也有问题再提!!!)

找不到javax.servlet.http.HttpServletRequest 因为包名换成了jakarta 我是萌新,不知道怎么解决

重现步骤(如果有就写完整)

正常创建springboot项目,导入,然后就似了😫

报错信息

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2023-03-09T11:20:50.932+08:00 ERROR 6448 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webControllerAdvice': Lookup method resolution failed at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.checkLookupMethods(AutowiredAnnotationBeanPostProcessor.java:470) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:340) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1283) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1185) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961) ~[spring-beans-6.0.6.jar:6.0.6] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:917) ~[spring-context-6.0.6.jar:6.0.6] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[spring-context-6.0.6.jar:6.0.6] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.0.4.jar:3.0.4] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[spring-boot-3.0.4.jar:3.0.4] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-3.0.4.jar:3.0.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[spring-boot-3.0.4.jar:3.0.4] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:150) ~[spring-boot-3.0.4.jar:3.0.4] at com.github.davidfantasy.mybatisplus.generatorui.MybatisPlusToolsApplication.run(MybatisPlusToolsApplication.java:48) ~[mybatis-plus-generator-ui-2.0.1.jar:na] at com.example.GeberatorUIServer.main(GeberatorUIServer.java:44) ~[test-classes/:na] Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.github.davidfantasy.mybatisplus.generatorui.configurer.WebControllerAdvice] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@78308db1] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483) ~[spring-core-6.0.6.jar:6.0.6] at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:320) ~[spring-core-6.0.6.jar:6.0.6] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.checkLookupMethods(AutowiredAnnotationBeanPostProcessor.java:448) ~[spring-beans-6.0.6.jar:6.0.6] ... 19 common frames omitted Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na] at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3434) ~[na:na] at java.base/java.lang.Class.getDeclaredMethods(Class.java:2536) ~[na:na] at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465) ~[spring-core-6.0.6.jar:6.0.6] ... 21 common frames omitted Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na] ... 25 common frames omitted

jiangjihui commented 1 year ago

再添加一个maven配置就行了:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>test</scope>
</dependency>
wangtao94 commented 1 year ago

再添加一个maven配置就行了:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>test</scope>
</dependency>

能启动,但是代码跑到使用javax.servlet.* 比如下载文件,报错。 相关pr https://github.com/davidfantasy/mybatis-plus-generator-ui/pull/81