java.lang.IllegalStateException: Could not start Nexus

Sonatype JIRA | Martin Meinhold [Atlassian] | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    While using the excellent REST interface to create scheduled tasks, I've noticed that apparently the start date of 01.01.1970 in combination with the time '00:00' causes some trouble (the resulting {{startDate}} should be "0", right?). Assuming I submit the following JSON document via POST to {{<nexus-baseurl>/service/local/schedules}}: {code} {"data":{"name":"Empty Trash","enabled":true,"typeId":"EmptyTrashTask","schedule":"daily","properties":[{"key":"repositoryId","value":"all_repo"},{"key":"EmptyTrashItemsOlderThan","value":""}],"startDate":"0","recurringTime":"00:00"}}{code} The scheduled task to empty the trash once a day is successfully created. Response from the REST interface is OK and the task is visible at the UI as well (see the attached screen shot). All good. Unfortunately not. But as soon as I restart Nexus, it doesn't come back and writes the following exception into the log file: {noformat} 2014-07-23 03:15:16 ERROR [WrapperListener_start_runner] org.sonatype.nexus.bootstrap.jsw.JswLauncher - Failed to start java.lang.IllegalStateException: Could not start Nexus at org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:40) ~[na:na] at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:775) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) ~[jetty-servlet-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:767) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) ~[jetty-servlet-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1252) ~[jetty-webapp-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) ~[jetty-webapp-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.server.Server.doStart(Server.java:282) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520] at org.sonatype.sisu.jetty.Jetty8$JettyWrapperThread.run(Jetty8.java:145) ~[nexus-jetty8-2.7.2-03.jar:2.7.2-03] Caused by: java.lang.NullPointerException: Starting Date of org.sonatype.scheduling.iterators.DailySchedulerIterator cannot be null! at org.sonatype.scheduling.iterators.AbstractSchedulerIterator.<init>(AbstractSchedulerIterator.java:33) ~[na:na] at org.sonatype.scheduling.iterators.AbstractCalendarBasedSchedulerIterator.<init>(AbstractCalendarBasedSchedulerIterator.java:29) ~[na:na] at org.sonatype.scheduling.iterators.DailySchedulerIterator.<init>(DailySchedulerIterator.java:27) ~[na:na] at org.sonatype.scheduling.schedules.DailySchedule.createIterator(DailySchedule.java:29) ~[na:na] at org.sonatype.scheduling.schedules.AbstractSchedule.getIterator(AbstractSchedule.java:47) ~[na:na] at org.sonatype.scheduling.DefaultTaskConfigManager.translateFrom(DefaultTaskConfigManager.java:343) ~[na:na] at org.sonatype.scheduling.DefaultTaskConfigManager.initializeTasks(DefaultTaskConfigManager.java:124) ~[na:na] at org.sonatype.scheduling.DefaultTaskConfigManager.initializeTasks(DefaultTaskConfigManager.java:102) ~[na:na] at org.sonatype.scheduling.DefaultScheduler.initializeTasks(DefaultScheduler.java:102) ~[na:na] at org.sonatype.nexus.scheduling.DefaultNexusScheduler.initializeTasks(DefaultNexusScheduler.java:47) ~[na:na] at org.sonatype.nexus.NxApplication.doStart(NxApplication.java:132) ~[na:na] at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport$Handler.doStart(LifecycleSupport.java:70) ~[na:na] at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext$MainMap_Starting.started(LifecycleHandlerContext.java:255) ~[na:na] at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext.started(LifecycleHandlerContext.java:57) ~[na:na] at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:129) ~[na:na] at org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:37) ~[na:na] ... 16 common frames omitted {noformat} And looking at the {{nexus.xml}} file, the exception is right: {noformat} <tasks> <task> <id>1</id> <name>Empty Trash</name> <enabled>true</enabled> <type>EmptyTrashTask</type> <status>SUBMITTED</status> <nextRun>1406160000000</nextRun> <schedule> <type>daily</type> </schedule> <properties> <property> <key>EmptyTrashItemsOlderThan</key> <value></value> </property> <property> <key>.name</key> <value>Empty Trash</value> </property> <property> <key>repositoryId</key> <value>all_repo</value> </property> </properties> </task> </tasks> {noformat} The scheduled task doesn't have a start date. It should look like {noformat} <schedule> <type>daily</type> <startDate>0</startDate> </schedule> {noformat} It happens for the other reoccurrence types that use a start date as well. Can I ask to fix this issue, please? Thanks

    Sonatype JIRA | 3 years ago | Martin Meinhold [Atlassian]
    java.lang.IllegalStateException: Could not start Nexus

    Root Cause Analysis

    1. java.lang.NullPointerException

      Starting Date of org.sonatype.scheduling.iterators.DailySchedulerIterator cannot be null!

      at org.sonatype.scheduling.iterators.AbstractSchedulerIterator.<init>()
    2. ${project.groupId}:${project.artifactId}
      DefaultScheduler.initializeTasks
      1. org.sonatype.scheduling.iterators.AbstractSchedulerIterator.<init>(AbstractSchedulerIterator.java:33)[na:na]
      2. org.sonatype.scheduling.iterators.AbstractCalendarBasedSchedulerIterator.<init>(AbstractCalendarBasedSchedulerIterator.java:29)[na:na]
      3. org.sonatype.scheduling.iterators.DailySchedulerIterator.<init>(DailySchedulerIterator.java:27)[na:na]
      4. org.sonatype.scheduling.schedules.DailySchedule.createIterator(DailySchedule.java:29)[na:na]
      5. org.sonatype.scheduling.schedules.AbstractSchedule.getIterator(AbstractSchedule.java:47)[na:na]
      6. org.sonatype.scheduling.DefaultTaskConfigManager.translateFrom(DefaultTaskConfigManager.java:343)[na:na]
      7. org.sonatype.scheduling.DefaultTaskConfigManager.initializeTasks(DefaultTaskConfigManager.java:124)[na:na]
      8. org.sonatype.scheduling.DefaultTaskConfigManager.initializeTasks(DefaultTaskConfigManager.java:102)[na:na]
      9. org.sonatype.scheduling.DefaultScheduler.initializeTasks(DefaultScheduler.java:102)[na:na]
      9 frames
    3. ${project.groupId}:${project.artifactId}
      NxApplication.doStart
      1. org.sonatype.nexus.scheduling.DefaultNexusScheduler.initializeTasks(DefaultNexusScheduler.java:47)[na:na]
      2. org.sonatype.nexus.NxApplication.doStart(NxApplication.java:132)[na:na]
      2 frames
    4. ${project.groupId}:${project.artifactId}
      LifecycleSupport.start
      1. org.sonatype.sisu.goodies.lifecycle.LifecycleSupport$Handler.doStart(LifecycleSupport.java:70)[na:na]
      2. org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext$MainMap_Starting.started(LifecycleHandlerContext.java:255)[na:na]
      3. org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext.started(LifecycleHandlerContext.java:57)[na:na]
      4. org.sonatype.sisu.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:129)[na:na]
      4 frames
    5. ${project.groupId}:${project.artifactId}
      NexusBooterListener.contextInitialized
      1. org.sonatype.nexus.web.NexusBooterListener.contextInitialized(NexusBooterListener.java:37)[na:na]
      1 frame
    6. Jetty
      AbstractLifeCycle.start
      1. org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:775)[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
      2. org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)[jetty-servlet-8.1.11.v20130520.jar:8.1.11.v20130520]
      3. org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:767)[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
      4. org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)[jetty-servlet-8.1.11.v20130520.jar:8.1.11.v20130520]
      5. org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1252)[jetty-webapp-8.1.11.v20130520.jar:8.1.11.v20130520]
      6. org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710)[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
      7. org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)[jetty-webapp-8.1.11.v20130520.jar:8.1.11.v20130520]
      8. org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
      9. org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
      10. org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
      11. org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
      12. org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
      13. org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
      14. org.eclipse.jetty.server.Server.doStart(Server.java:282)[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
      15. org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
      15 frames
    7. org.sonatype.sisu
      Jetty8$JettyWrapperThread.run
      1. org.sonatype.sisu.jetty.Jetty8$JettyWrapperThread.run(Jetty8.java:145)[nexus-jetty8-2.7.2-03.jar:2.7.2-03]
      1 frame