vscode使用Community Server Connector运行JDK1.8项目报错 日期:2025-07-04 分类:1 人气:0 有一个JAVA项目比较老,使用jdk1.8,为了方便调试使用vscode的tomcat插件Community Server Connector来运行,安装插件,设置了tomcat使用jdk1.8。maven也设置了使用1.8。一切配置妥当,启动成功。但是当运行war包时,报错了。 根据错误信息查了一下,感觉像是依赖冲突,于是我把hibernate-validator依赖删了,重新打包还是不行。 然后又分析问题,可能是并未使用jdk1.8,于是我把环境变量改成了jdk1.8,悲剧的是Community Server Connector运行不起来了。 后来根据如下错误信息更新了一批依赖,但是还是不行: ``` Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException ``` 无耐手动安装了一个tomcat8.5,把war拷贝到webapps中,启动tomcat,秒开!大汗看来远古的项目还是要用远古的办法,想省点部署的力气都不行。 下面贴一下报错信息: ``` ERROR (org.springframework.web.context.ContextLoader:331) - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext-security.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext-security.xml]: Cannot resolve reference to bean 'shiroDbRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroDbRealm' defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext-security.xml]: Cannot resolve reference to bean 'authorizeService' while setting bean property 'authorizeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorizeService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ld.basic.dao.UserInfoDao com.ld.basic.service.AuthorizeService.userInfoDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoDao': Cannot create inner bean '(inner bean)#329f7271' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#329f7271': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ldDefinitionSectionMetaSource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ld.basic.dao.ModuleFeatureDao com.ld.basic.security.LDDefinitionSectionMetaSource.moduleFeatureDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'moduleFeatureDao': Cannot create inner bean '(inner bean)#6bee6de3' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6bee6de3': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:336) ... Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext-security.xml]: Cannot resolve reference to bean 'shiroDbRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroDbRealm' defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext-security.xml]: Cannot resolve reference to bean 'authorizeService' while setting bean property 'authorizeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorizeService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ld.basic.dao.UserInfoDao com.ld.basic.service.AuthorizeService.userInfoDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoDao': Cannot create inner bean '(inner bean)#329f7271' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#329f7271': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/classes/spring/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:336) ... Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:924) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:336) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) ... 104 more Caused by: org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:156) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:304) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1794) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) ... 110 more Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:467) ``` 标签: java 下一篇:vscode中为maven项目指定java版本 随便看看 2024-02-19 PHP7 运算符“??” 和“?:”的区别 2022-11-30 Linux 后台运行命令 2022-11-25 关于我们 2022-11-30 centos一键系统安装lnmp集成环境 2022-11-30 linux 生成 ssh 公钥 留言