一、错误描述
安装nexus的maven中央参考服务后,在路径./nexus-2.4.0-09/conf/nexus.properties进行配置为nexus-work=${bundleBasedir}/../sonatype-work/nexus,启动nexus安装的服务(安装方式参考nexus相关页)报出“org.sonatype.nexus.DefaultNexus - Could not start Nexus, user configuration exception..org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException: Could not start Nexus!..Caused by: org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException: Could not start Nexus!...org.sonatype.configuration.validation.InvalidConfigurationException: Configuration is invalid!.. overrideLocalStorageUrl - Repository has an invalid local storage URL”错误,具体日志如下
jvm 1 | 2017-06-25 23:56:58 ERROR [y-main-thread-1] - org.sonatype.nexus.DefaultNexus - Could not start Nexus, user configuration exception!@b@jvm 1 | org.sonatype.configuration.validation.InvalidConfigurationException: Configuration is invalid!@b@jvm 1 | Validation errors follows:@b@jvm 1 | o overrideLocalStorageUrl - Repository has an invalid local storage URL 'file:/E:/nexus/Repository/Jar@b@jvm 1 | @b@jvm 1 | at org.sonatype.nexus.proxy.repository.AbstractRepositoryConfigurator.doApplyConfiguration(AbstractRepositoryConfigurator.java:147) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.proxy.repository.AbstractProxyRepositoryConfigurator.doApplyConfiguration(AbstractProxyRepositoryConfigurator.java:74) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.proxy.maven.AbstractMavenRepositoryConfigurator.doApplyConfiguration(AbstractMavenRepositoryConfigurator.java:38) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.proxy.repository.AbstractRepositoryConfigurator.applyConfiguration(AbstractRepositoryConfigurator.java:60) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.configuration.AbstractConfigurable.doConfigure(AbstractConfigurable.java:246) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.configuration.AbstractConfigurable.configure(AbstractConfigurable.java:181) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.configuration.application.runtime.DefaultApplicationRuntimeConfigurationBuilder.createRepositoryFromModel(DefaultApplicationRuntimeConfigurationBuilder.java:48) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:766) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createRepositories(DefaultNexusConfiguration.java:732) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createInternals(DefaultNexusConfiguration.java:714) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.DefaultNexus.startService(DefaultNexus.java:451) [nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:413) [nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.start(PlexusLifecycleManager.java:362) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.manageLifecycle(PlexusLifecycleManager.java:306) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:151) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1055) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.Scopes$1$1.get(Scopes.java:59) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1002) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1048) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:998) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:82) [sisu-inject-bean-2.3.2.jar:na]@b@jvm 1 | at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:52) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:249) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:243) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:41) [nexus-web-utils-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:771) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) [jetty-servlet-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:763) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) [jetty-servlet-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) [jetty-webapp-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492) [jetty-webapp-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.Server.doStart(Server.java:277) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.sonatype.sisu.jetty.Jetty8$JettyWrapperThread.run(Jetty8.java:152) [sisu-jetty8-1.4.2.jar:1.4.2]@b@jvm 1 | 2017-06-25 23:56:58 WARN [y-main-thread-1] - org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager - Error starting: org.sonatype.nexus.DefaultNexus@9f5447@b@jvm 1 | org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException: Could not start Nexus!@b@jvm 1 | at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:417) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.start(PlexusLifecycleManager.java:362) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.manageLifecycle(PlexusLifecycleManager.java:306) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:151) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1055) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.Scopes$1$1.get(Scopes.java:59) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1002) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1048) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:998) [sisu-guice-3.1.2.jar:na]@b@jvm 1 | at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:82) [sisu-inject-bean-2.3.2.jar:na]@b@jvm 1 | at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:52) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:249) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:243) [sisu-inject-plexus-2.3.2.jar:na]@b@jvm 1 | at org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:41) [nexus-web-utils-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:771) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) [jetty-servlet-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:763) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) [jetty-servlet-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) [jetty-webapp-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492) [jetty-webapp-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.server.Server.doStart(Server.java:277) [jetty-server-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.8.v20121106.jar:8.1.8.v20121106]@b@jvm 1 | at org.sonatype.sisu.jetty.Jetty8$JettyWrapperThread.run(Jetty8.java:152) [sisu-jetty8-1.4.2.jar:1.4.2]@b@jvm 1 | Caused by: org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException: Could not start Nexus!@b@jvm 1 | at org.sonatype.nexus.DefaultNexus.startService(DefaultNexus.java:527) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:413) ~[nexus-core-2.4.0-09.jar:2.4.0-09]@b@jvm 1 | ... 36 common frames omitted@b@jvm 1 | Caused by: org.sonatype.configuration.validation.InvalidConfigurationException: Configuration is invalid!@b@jvm 1 | Validation errors follows:@b@jvm 1 | o overrideLocalStorageUrl - Repository has an invalid local storage URL '
二、解决方法
1. 首页根据路径./nexus-2.4.0-09/conf/nexus.properties中nexus-work=${bundleBasedir}/../sonatype-work/nexus配置项,如下所示
...@b@# Jetty section@b@application-port=8081@b@application-host=0.0.0.0@b@nexus-webapp=${bundleBasedir}/nexus@b@nexus-webapp-context-path=/nexus@b@@b@# Nexus section@b@nexus-work=${bundleBasedir}/../sonatype-work/nexus@b@runtime=${bundleBasedir}/nexus/WEB-INF
2.对于1中配置路径下./sonatype-work/nexus/conf/nexus.xml,全文搜索“file:/E:/nexus/Repository/Jar”,并替换正确的路径
...@b@ <repository>@b@ <id>Apache</id>@b@ <name>Apache</name>@b@ <providerRole>org.sonatype.nexus.proxy.repository.Repository</providerRole>@b@ <providerHint>maven2</providerHint>@b@ <localStatus>IN_SERVICE</localStatus>@b@ <notFoundCacheTTL>1440</notFoundCacheTTL>@b@ <userManaged>true</userManaged>@b@ <exposed>true</exposed>@b@ <browseable>true</browseable>@b@ <writePolicy>ALLOW_WRITE_ONCE</writePolicy>@b@ <indexable>true</indexable>@b@ <searchable>true</searchable>@b@ <localStorage>@b@ <provider>file</provider>@b@ <url>file:/E:/nexus/Repository/Jar/org/apache</url>@b@ </localStorage>@b@ <externalConfiguration>@b@ <repositoryPolicy>RELEASE</repositoryPolicy>@b@ </externalConfiguration>@b@ </repository>@b@...
3.修改为正确的配置,保存并重复服务,问题解决了