在 FreeBSD 上安装 Nexus

安装 JDK

cd /usr/ports/java/diablo-jdk16/ && make install clean

不能用 openjdk 呀,我测试了 openjdk-7.0.122_1,启动 nexus 会失败的:

log4j:WARN No appenders could be found for logger (org.sonatype.appcontext.AppContext).
log4j:WARN Please initialize the log4j system properly.
2011-04-13 06:48:49 INFO  [Thread-1       ] - org.sonatype.security.configuration.source.FileSecurityConfigurationSource - Loading Security configuration from /var/nexus/conf/security-configuration.xml
2011-04-13 06:48:49 INFO  [Thread-1       ] - org.sonatype.nexus.timeline.DefaultNexusTimeline - Initializing Nexus Timeline...
2011-04-13 06:48:50 INFO  [Thread-1       ] - org.sonatype.nexus.DefaultNexus - 
-------------------------------------------------

Initializing Nexus (OSS), Version 1.9.0.2

-------------------------------------------------
2011-04-13 06:48:50 INFO  [Thread-1       ] - org.sonatype.nexus.DefaultNexus - Activating locally installed plugins...
2011-04-13 06:48:51 INFO  [Thread-1       ] - org.sonatype.nexus.DefaultNexus - Plugin manager request "ACTIVATE" on plugin "org.sonatype.nexus.plugins:nexus-plugin-console-plugin:1.9.0.2" was successful.
2011-04-13 06:48:51 INFO  [Thread-1       ] - org.sonatype.nexus.DefaultNexus - Plugin manager request "ACTIVATE" on plugin "org.sonatype.nexus.plugins:nexus-indexer-lucene-plugin:1.9.0.2" was successful.
2011-04-13 06:48:51 INFO  [Thread-1       ] - org.sonatype.nexus.DefaultNexus - Plugin manager request "ACTIVATE" on plugin "org.sonatype.nexus.plugins:nexus-rrb-plugin:1.9.0.2" was successful.
2011-04-13 06:48:51 INFO  [Thread-1       ] - org.sonatype.nexus.DefaultNexus - Plugin manager request "ACTIVATE" on plugin "org.sonatype.nexus.plugins:nexus-core-documentation-plugin:1.9.0.2" was successful.
2011-04-13 06:48:51 INFO  [Thread-1       ] - org.sonatype.nexus.DefaultNexus - Plugin manager request "ACTIVATE" on plugin "org.sonatype.nexus.plugins.ldap:nexus-ldap-realm-plugin:1.9.0.2" was successful.
2011-04-13 06:48:51 INFO  [Thread-1       ] - org.sonatype.plexus.components.ehcache.DefaultEhCacheWrapper - Creating and configuring EHCache manager with classpath:/ehcache.xml, using disk store 'none'
2011-04-13 06:48:51 INFO  [Thread-1       ] - org.sonatype.nexus.configuration.application.DefaultNexusConfiguration - Loading Nexus Configuration...
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.sonatype.nexus.configuration.source.StaticConfigurationSource - Configuration loaded succesfully.
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.sonatype.nexus.configuration.source.FileConfigurationSource - Loading Nexus configuration from /var/nexus/conf/nexus.xml
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.sonatype.nexus.configuration.source.FileConfigurationSource - Configuration loaded succesfully.
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.sonatype.nexus.configuration.validator.DefaultApplicationConfigurationValidator - Nexus configuration validated succesfully.
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.sonatype.nexus.configuration.application.DefaultNexusConfiguration - Applying Nexus Configuration...
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.sonatype.security.configuration.source.FileSecurityConfigurationSource - Loading Security configuration from /var/nexus/conf/security-configuration.xml
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.apache.shiro.cache.ehcache.EhCacheManager - Cache with name 'org.sonatype.security.realms.XmlAuthenticatingRealm.authorizationCache' does not yet exist.  Creating now.
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.apache.shiro.cache.ehcache.EhCacheManager - Added EhCache named [org.sonatype.security.realms.XmlAuthenticatingRealm.authorizationCache]
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.apache.shiro.cache.ehcache.EhCacheManager - Cache with name 'org.sonatype.security.realms.XmlAuthorizingRealm.authorizationCache.1' does not yet exist.  Creating now.
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.apache.shiro.cache.ehcache.EhCacheManager - Added EhCache named [org.sonatype.security.realms.XmlAuthorizingRealm.authorizationCache.1]
2011-04-13 06:48:52 INFO  [Thread-1       ] - org.sonatype.nexus.proxy.registry.DefaultRepositoryTypeRegistry - Registered default repository types.
2011-04-13 06:48:52 WARN  [Thread-1       ] - org.codehaus.plexus.PlexusContainer - Error starting: class org.sonatype.nexus.DefaultNexus
org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException: Could not start Nexus!
	at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:652)
	at org.codehaus.plexus.PlexusLifecycleManager.start(PlexusLifecycleManager.java:283)
	at org.codehaus.plexus.PlexusLifecycleManager.manageLifecycle(PlexusLifecycleManager.java:234)
	at org.codehaus.plexus.PlexusLifecycleManager.manage(PlexusLifecycleManager.java:134)
	at org.sonatype.guice.plexus.binders.PlexusBeanBinder.afterInjection(PlexusBeanBinder.java:79)
	at com.google.inject.internal.MembersInjectorImpl.notifyListeners(MembersInjectorImpl.java:97)
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:95)
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:253)
	at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
	at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:984)
	at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
	at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
	at com.google.inject.Scopes$1$1.get(Scopes.java:59)
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
	at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:995)
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
	at org.sonatype.guice.bean.locators.LazyQualifiedBean.getValue(LazyQualifiedBean.java:66)
	at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:54)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:247)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:233)
	at org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:48)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4521)
	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5004)
	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:4999)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:732)
Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
---- Debugging information ----
message             : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
class               : org.sonatype.nexus.configuration.model.CRepository
required-type       : org.codehaus.plexus.util.xml.Xpp3Dom
path                : /org.sonatype.nexus.configuration.model.CRepository/externalConfiguration
line number         : 23
-------------------------------
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:89)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:246)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:218)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:162)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:137)
	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:923)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:909)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:845)
	at org.sonatype.nexus.configuration.model.AbstractRevertableConfiguration.copyObject(AbstractRevertableConfiguration.java:103)
	at org.sonatype.nexus.configuration.model.AbstractRevertableConfiguration.getConfiguration(AbstractRevertableConfiguration.java:46)
	at org.sonatype.nexus.configuration.model.CRepositoryCoreConfiguration.getConfiguration(CRepositoryCoreConfiguration.java:57)
	at org.sonatype.nexus.proxy.repository.ConfigurableRepository.getCurrentConfiguration(ConfigurableRepository.java:42)
	at org.sonatype.nexus.proxy.repository.ConfigurableRepository.getCurrentConfiguration(ConfigurableRepository.java:34)
	at org.sonatype.nexus.configuration.AbstractConfigurable.configure(AbstractConfigurable.java:171)
	at org.sonatype.nexus.configuration.application.runtime.DefaultApplicationRuntimeConfigurationBuilder.createRepositoryFromModel(DefaultApplicationRuntimeConfigurationBuilder.java:51)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:515)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createRepositories(DefaultNexusConfiguration.java:481)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createInternals(DefaultNexusConfiguration.java:463)
	at org.sonatype.nexus.DefaultNexus.startService(DefaultNexus.java:686)
	at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:648)
	... 35 more
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:71)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:308)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:161)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
	... 62 more
2011-04-13 06:48:52 ERROR [Thread-1       ] - org.sonatype.guice.bean.reflect.NamedClass - Error injecting: org.sonatype.nexus.DefaultNexus
com.google.inject.ProvisionException: Guice provision errors:

1) Error starting: class org.sonatype.nexus.DefaultNexus
  while locating org.sonatype.nexus.DefaultNexus

1 error
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:958)
	at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:984)
	at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
	at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
	at com.google.inject.Scopes$1$1.get(Scopes.java:59)
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
	at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:995)
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
	at org.sonatype.guice.bean.locators.LazyQualifiedBean.getValue(LazyQualifiedBean.java:66)
	at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:54)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:247)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:233)
	at org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:48)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4521)
	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5004)
	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:4999)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:732)
Caused by: org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException: Could not start Nexus!
	at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:652)
	at org.codehaus.plexus.PlexusLifecycleManager.start(PlexusLifecycleManager.java:283)
	at org.codehaus.plexus.PlexusLifecycleManager.manageLifecycle(PlexusLifecycleManager.java:234)
	at org.codehaus.plexus.PlexusLifecycleManager.manage(PlexusLifecycleManager.java:134)
	at org.sonatype.guice.plexus.binders.PlexusBeanBinder.afterInjection(PlexusBeanBinder.java:79)
	at com.google.inject.internal.MembersInjectorImpl.notifyListeners(MembersInjectorImpl.java:97)
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:95)
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:253)
	at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
	... 25 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
---- Debugging information ----
message             : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
class               : org.sonatype.nexus.configuration.model.CRepository
required-type       : org.codehaus.plexus.util.xml.Xpp3Dom
path                : /org.sonatype.nexus.configuration.model.CRepository/externalConfiguration
line number         : 23
-------------------------------
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:89)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:246)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:218)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:162)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:137)
	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:923)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:909)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:845)
	at org.sonatype.nexus.configuration.model.AbstractRevertableConfiguration.copyObject(AbstractRevertableConfiguration.java:103)
	at org.sonatype.nexus.configuration.model.AbstractRevertableConfiguration.getConfiguration(AbstractRevertableConfiguration.java:46)
	at org.sonatype.nexus.configuration.model.CRepositoryCoreConfiguration.getConfiguration(CRepositoryCoreConfiguration.java:57)
	at org.sonatype.nexus.proxy.repository.ConfigurableRepository.getCurrentConfiguration(ConfigurableRepository.java:42)
	at org.sonatype.nexus.proxy.repository.ConfigurableRepository.getCurrentConfiguration(ConfigurableRepository.java:34)
	at org.sonatype.nexus.configuration.AbstractConfigurable.configure(AbstractConfigurable.java:171)
	at org.sonatype.nexus.configuration.application.runtime.DefaultApplicationRuntimeConfigurationBuilder.createRepositoryFromModel(DefaultApplicationRuntimeConfigurationBuilder.java:51)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:515)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createRepositories(DefaultNexusConfiguration.java:481)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createInternals(DefaultNexusConfiguration.java:463)
	at org.sonatype.nexus.DefaultNexus.startService(DefaultNexus.java:686)
	at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:648)
	... 35 more
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:71)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:308)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:161)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
	... 62 more
2011-04-13 06:48:52 ERROR [Thread-1       ] - org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/nexus] - Exception sending context initialized event to listener instance of class org.sonatype.nexus.web.NexusBooterListener
java.lang.IllegalStateException: Could not initialize Nexus.
	at org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:58)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4521)
	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5004)
	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:4999)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:732)
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting: org.sonatype.nexus.DefaultNexus
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.sonatype.nexus.Nexus

1 error
      role: org.sonatype.nexus.Nexus
  roleHint: 
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:251)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:239)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:233)
	at org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:48)
	... 8 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:

1) Error injecting: org.sonatype.nexus.DefaultNexus
  at ClassRealm[plexus.core, parent: null]
  at ClassRealm[plexus.core, parent: null]
  while locating org.sonatype.nexus.Nexus

1 error
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:958)
	at org.sonatype.guice.bean.locators.LazyQualifiedBean.getValue(LazyQualifiedBean.java:66)
	at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:54)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:247)
	... 11 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:

1) Error starting: class org.sonatype.nexus.DefaultNexus
  while locating org.sonatype.nexus.DefaultNexus

1 error
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:958)
	at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:984)
	at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
	at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
	at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
	at com.google.inject.Scopes$1$1.get(Scopes.java:59)
	at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
	at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:995)
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
	... 14 more
Caused by: org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException: Could not start Nexus!
	at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:652)
	at org.codehaus.plexus.PlexusLifecycleManager.start(PlexusLifecycleManager.java:283)
	at org.codehaus.plexus.PlexusLifecycleManager.manageLifecycle(PlexusLifecycleManager.java:234)
	at org.codehaus.plexus.PlexusLifecycleManager.manage(PlexusLifecycleManager.java:134)
	at org.sonatype.guice.plexus.binders.PlexusBeanBinder.afterInjection(PlexusBeanBinder.java:79)
	at com.google.inject.internal.MembersInjectorImpl.notifyListeners(MembersInjectorImpl.java:97)
	at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:95)
	at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:253)
	at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:949)
	at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1002)
	at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:945)
	... 25 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
---- Debugging information ----
message             : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
class               : org.sonatype.nexus.configuration.model.CRepository
required-type       : org.codehaus.plexus.util.xml.Xpp3Dom
path                : /org.sonatype.nexus.configuration.model.CRepository/externalConfiguration
line number         : 23
-------------------------------
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:89)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:246)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:218)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:162)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:63)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:76)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:60)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:137)
	at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:923)
	at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:909)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
	at com.thoughtworks.xstream.XStream.fromXML(XStream.java:845)
	at org.sonatype.nexus.configuration.model.AbstractRevertableConfiguration.copyObject(AbstractRevertableConfiguration.java:103)
	at org.sonatype.nexus.configuration.model.AbstractRevertableConfiguration.getConfiguration(AbstractRevertableConfiguration.java:46)
	at org.sonatype.nexus.configuration.model.CRepositoryCoreConfiguration.getConfiguration(CRepositoryCoreConfiguration.java:57)
	at org.sonatype.nexus.proxy.repository.ConfigurableRepository.getCurrentConfiguration(ConfigurableRepository.java:42)
	at org.sonatype.nexus.proxy.repository.ConfigurableRepository.getCurrentConfiguration(ConfigurableRepository.java:34)
	at org.sonatype.nexus.configuration.AbstractConfigurable.configure(AbstractConfigurable.java:171)
	at org.sonatype.nexus.configuration.application.runtime.DefaultApplicationRuntimeConfigurationBuilder.createRepositoryFromModel(DefaultApplicationRuntimeConfigurationBuilder.java:51)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:515)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createRepositories(DefaultNexusConfiguration.java:481)
	at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createInternals(DefaultNexusConfiguration.java:463)
	at org.sonatype.nexus.DefaultNexus.startService(DefaultNexus.java:686)
	at org.sonatype.nexus.DefaultNexus.start(DefaultNexus.java:648)
	... 35 more
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct org.codehaus.plexus.util.xml.Xpp3Dom as it does not have a no-args constructor
	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:71)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:308)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:161)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:82)
	... 62 more
2011-04-13 06:48:52 ERROR [main           ] - org.apache.catalina.core.StandardContext - Error listenerStart
2011-04-13 06:48:52 ERROR [main           ] - org.apache.catalina.core.StandardContext - Context [/nexus] startup failed due to previous errors
2011-04-13 06:48:53 INFO  [Thread-2       ] - org.sonatype.nexus.index.DefaultIndexerManager - Shutting down Nexus IndexerManager
2011-04-13 06:48:53 INFO  [Thread-2       ] - org.sonatype.plexus.components.ehcache.DefaultEhCacheWrapper - Shutting down EHCache manager.
2011-04-13 06:48:53 INFO  [Thread-2       ] - org.sonatype.nexus.DefaultNexus - Stopped Nexus (version 1.9.0.2 OSS)
2011-04-13 06:48:56,061 INFO  NutchBean - creating new bean
2011-04-13 06:48:56,733 INFO  SearchBean - opening merged index in /usr/home/sutra/search/nutch-1.0/crawl/index
2011-04-13 06:48:57,256 INFO  PluginRepository - Plugins: looking in: /usr/local/apache-tomcat-7.0/webapps/nutch/WEB-INF/classes/plugins
2011-04-13 06:48:57,670 INFO  PluginRepository - Plugin Auto-activation mode: [true]
2011-04-13 06:48:57,670 INFO  PluginRepository - Registered Plugins:
2011-04-13 06:48:57,670 INFO  PluginRepository - 	Pdf Parse Plug-in (parse-pdf)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	Http / Https Protocol Plug-in (protocol-httpclient)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	Jakarta POI - Java API To Access Microsoft Format Files (lib-jakarta-poi)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	HTTP Framework (lib-http)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	MSWord Parse Plug-in (parse-msword)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	Regex URL Filter (urlfilter-regex)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	XML Libraries (lib-xml)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	MSExcel Parse Plug-in (parse-msexcel)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	OPIC Scoring Plug-in (scoring-opic)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	Zip Parse Plug-in (parse-zip)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	URL Query Filter (query-url)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	Parse MS Documents Framework (lib-parsems)
2011-04-13 06:48:57,670 INFO  PluginRepository - 	Regex URL Filter Framework (lib-regex-filter)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	the nutch core extension points (nutch-extensionpoints)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	MSPowerPoint Parse Plug-in (parse-mspowerpoint)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Basic Query Filter (query-basic)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Basic URL Normalizer (urlnormalizer-basic)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	RSS Parse Plug-in (parse-rss)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Html Parse Plug-in (parse-html)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Basic Indexing Filter (index-basic)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Basic Summarizer Plug-in (summary-basic)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Site Query Filter (query-site)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Text Parse Plug-in (parse-text)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Pass-through URL Normalizer (urlnormalizer-pass)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Regex URL Normalizer (urlnormalizer-regex)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	CyberNeko HTML Parser (lib-nekohtml)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	OpenOffice/OpenDocument Parse Plug-in (parse-oo)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	JavaScript Parser (parse-js)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	SWF Parse Plug-in (parse-swf)
2011-04-13 06:48:57,671 INFO  PluginRepository - Registered Extension-Points:
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Nutch Summarizer (org.apache.nutch.searcher.Summarizer)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Nutch Protocol (org.apache.nutch.protocol.Protocol)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Nutch Analysis (org.apache.nutch.analysis.NutchAnalyzer)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Nutch Field Filter (org.apache.nutch.indexer.field.FieldFilter)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	HTML Parse Filter (org.apache.nutch.parse.HtmlParseFilter)
2011-04-13 06:48:57,671 INFO  PluginRepository - 	Nutch Query Filter (org.apache.nutch.searcher.QueryFilter)
2011-04-13 06:48:57,672 INFO  PluginRepository - 	Nutch Search Results Response Writer (org.apache.nutch.searcher.response.ResponseWriter)
2011-04-13 06:48:57,672 INFO  PluginRepository - 	Nutch URL Normalizer (org.apache.nutch.net.URLNormalizer)
2011-04-13 06:48:57,672 INFO  PluginRepository - 	Nutch URL Filter (org.apache.nutch.net.URLFilter)
2011-04-13 06:48:57,672 INFO  PluginRepository - 	Nutch Online Search Results Clustering Plugin (org.apache.nutch.clustering.OnlineClusterer)
2011-04-13 06:48:57,672 INFO  PluginRepository - 	Nutch Indexing Filter (org.apache.nutch.indexer.IndexingFilter)
2011-04-13 06:48:57,672 INFO  PluginRepository - 	Nutch Content Parser (org.apache.nutch.parse.Parser)
2011-04-13 06:48:57,672 INFO  PluginRepository - 	Nutch Scoring (org.apache.nutch.scoring.ScoringFilter)
2011-04-13 06:48:57,672 INFO  PluginRepository - 	Ontology Model Loader (org.apache.nutch.ontology.Ontology)
2011-04-13 06:48:57,697 INFO  Configuration - found resource common-terms.utf8 at file:/usr/local/apache-tomcat-7.0/webapps/nutch/WEB-INF/classes/common-terms.utf8
2011-04-13 06:48:57,758 INFO  SummarizerFactory - Using the first summarizer extension found: Basic Summarizer

安装 Tomcat

cd /usr/ports/www/tomcat7/ && make install clean

下载 Nexus

fetch http://nexus.sonatype.org/downloads/nexus-webapp-1.9.0.2.war
mv nexus-webapp-1.9.0.2.war /usr/local/apache-tomcat-7.0/webapps/nexus.war

安装配置 Apache

安装 Apache 作为 Tomcat 的前端,虽然这不是必须的,但我们常常需要 Apache 来运行其它的应用,并共享一个 80 端口,比如 TracSubversion等。

cd /usr/ports/www/apache22/ && make install clean

注意勾选 PROXY_AJP 。
配置文件 httpd.conf 或者其 include 的文件中添加

ProxyPass /nexus ajp://localhost:8009/nexus
ProxyPassReverse /nexus ajp://localhost:8009/nexus
<Location /nexus>
    SetEnv no-gzip
</Location>

注意这里一定要加上 no-gzip 否则,用浏览器查看就会看到又如压缩文件被记事本打开了的乱码样的网页。这是因为 Nexus 默认会把 HTTP Resposne 压缩,然后如果 apache 也配置了压缩的话,apache 又会把 response 给压缩一遍,而到浏览器那端只会解压缩一次。所以告诉 apache 不要压缩。

启动 Tomcat 和 Apache

首先让 tomcat 和 apache 设置为开机自动启动吧:

/usr/local/etc/rc.d/tomcat7 rcvar | sed s/NO/YES/ >> /etc/rc.conf
/usr/local/etc/rc.d/apache22 rcvar | sed s/NO/YES/ >> /etc/rc.conf

还要配置下 tomcat 启动参数,让 nexus 把配置数据之类的都放到 /var/nexus 目录里去,在 /etc/rc.conf 里添加下面一行:

tomcat7_java_opts="-Dplexus.nexus-work=/var/nexus"

并且给它创建好 /var/nexus 这个目录:

mkdir /var/nexus && chown www:www /var/nexus

然后启动它们:

/usr/local/etc/rc.d/tomcat7 start
apachectl start

使用方法

浏览器访问

http://localhost/nexus

Maven使用

修改 ~/.m2/settings.xml,添加一个mirror:

<mirror>
    <id>mynexus</id>
    <name>mynexus</name>
    <url>http://localhost/content/groups/public</url>
    <mirrorOf>central</mirrorOf>
</mirror>
Advertisements

#apache-http-server, #freebsd, #maven, #nexus, #tomcat

在 FreeBSD 上安装 sshguard-ipfilter

Sshguard 通过服务的日志活动来监视服务。它通过本地翻火墙阻断源地址来对危险活动做出响应。

安装 sshguard-ipfilter

cd /usr/ports/security/sshguard-ipfilter/ && make install clean

编辑 ipf.rules

当然,在进行这段之前,请先配置好 IPFILTER(IPF)。在 ipf.rules 里加入

##sshguard-begin##
##sshguard-end##

如果有 pass-all 规则,那么上面这段要放在 pass-all 规则之前。

启用 sshguard

编辑文件 /etc/syslog.conf,把下面这行(这行是上一步安装的时候自动添加进去的)前面的“#”(“#”是注释的意思)给去掉,即变成下面这个样子:

auth.info;authpriv.info     |exec /usr/local/sbin/sshguard

激活上面的修改:

/etc/rc.d/syslogd reload

然后可以在 /var/log/auth.log 里看到类似下面的日志:

Apr 10 10:53:25 www sshguard[17225]: Started successfully [(a,p,s)=(4, 420, 1200)], now ready to scan.

在这条日志里,可以看到有三个参数值[(a,p,s)=(4, 420, 1200)],通过 man sshguard 可以查到它们的含义。

测试

用 ssh 登录时故意输错密码多次。
就会在 /var/log/auth.log 里看到类似这样的日志:

Apr 10 10:57:39 www sshguard[34020]: Blocking 192.168.1.2:4 for >0secs: 4 failures over 6 seconds.

并且 /etc/ipf.rules 里也多出了一条规则:

##sshguard-begin##
block in quick proto tcp from 192.168.1.2 to any
##sshguard-end##

参考资料

  1. IPFILTER (IPF) 防火墙
  2. Set up IPFilter firewall

#freebsd, #ipfilter, #sshguard