如何修复在maven项目中创建名称错误的bean的错误

How to fix error creating bean with name error in maven project

我使用 eclipse 创建了新的 maven 项目 IDE。创建项目后我什么也没做,只是尝试使用 run.bat 命令 运行 项目,如教程中所述。 (https://ecmarchitect.com/alfresco-developer-series-tutorials/maven-sdk/tutorial/tutorial.html) 但现在我收到类似“在 class 路径资源 [alfresco/action-services-context.xml] 中定义名称 'actionService' 创建 bean 时出错”的错误。我不知道如何解决这个问题。请帮我。

我的错误日志如下。

2019-05-05 00:08:54,285  WARN  [context.support.XmlWebApplicationContext] [localhost-startStop-1] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityBridgeTableCache' defined in class path resource [alfresco/cache-context.xml]: Cannot resolve reference to bean 'tenantAdminService' while setting bean property 'tenantAdminService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantAdminService' defined in URL [jar:file:/D:/$PUCSL_SNAIL/workflow-tutorial-test/target/tomcat/webapps/workflow-tutorial-test-platform/WEB-INF/lib/alfresco-repository-5.2.f.jar!/alfresco/mt/mt-admin-context.xml]: Cannot resolve reference to bean 'dbNodeServiceImpl' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbNodeService' defined in class path resource [alfresco/node-services-context.xml]: Cannot resolve reference to bean 'permissionServiceImpl' while setting bean property 'permissionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
 2019-05-05 00:08:54,323  ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityBridgeTableCache' defined in class path resource [alfresco/cache-context.xml]: Cannot resolve reference to bean 'tenantAdminService' while setting bean property 'tenantAdminService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantAdminService' defined in URL [jar:file:/D:/$PUCSL_SNAIL/workflow-tutorial-test/target/tomcat/webapps/workflow-tutorial-test-platform/WEB-INF/lib/alfresco-repository-5.2.f.jar!/alfresco/mt/mt-admin-context.xml]: Cannot resolve reference to bean 'dbNodeServiceImpl' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbNodeService' defined in class path resource [alfresco/node-services-context.xml]: Cannot resolve reference to bean 'permissionServiceImpl' while setting bean property 'permissionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:938)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:70)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantAdminService' defined in URL [jar:file:/D:/$PUCSL_SNAIL/workflow-tutorial-test/target/tomcat/webapps/workflow-tutorial-test-platform/WEB-INF/lib/alfresco-repository-5.2.f.jar!/alfresco/mt/mt-admin-context.xml]: Cannot resolve reference to bean 'dbNodeServiceImpl' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbNodeService' defined in class path resource [alfresco/node-services-context.xml]: Cannot resolve reference to bean 'permissionServiceImpl' while setting bean property 'permissionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
        ... 25 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbNodeService' defined in class path resource [alfresco/node-services-context.xml]: Cannot resolve reference to bean 'permissionServiceImpl' while setting bean property 'permissionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
        ... 35 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'permissionServiceImpl' defined in class path resource [alfresco/public-services-security-context.xml]: Cannot resolve reference to bean 'authorityService' while setting bean property 'authorityService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authorityService' defined in class path resource [alfresco/authority-services-context.xml]: Cannot resolve reference to bean 'personService' while setting bean property 'personService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personService' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'personServicePermissionsManager' while setting bean property 'permissionsManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personServicePermissionsManager' defined in class path resource [alfresco/authentication-services-context.xml]: Cannot resolve reference to bean 'ownableService' while setting bean property 'ownableService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ownableService' defined in class path resource [alfresco/ownable-services-context.xml]: Cannot resolve reference to bean 'renditionService' while setting bean property 'renditionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'renditionService' defined in class path resource [alfresco/rendition-services-context.xml]: Cannot resolve reference to bean 'ActionService' while setting bean property 'actionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ActionService' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'actionService' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'actionService' defined in class path resource [alfresco/action-services-context.xml]: Cannot resolve reference to bean 'NodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'NodeService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditMethodInterceptor' defined in class path resource [alfresco/public-services-context.xml]: Cannot resolve reference to bean 'auditComponent' while setting bean property 'auditComponent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditComponent' defined in class path resource [alfresco/audit-services-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/ValidationEventHandler
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:334)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1419)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
        ... 45 more

在你的 pom.xml 文件中添加 jaxb-api 依赖项

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>

如果添加上述依赖项后仍然遇到相同的错误,请尝试此 答案