The nexus service was launched, but failed to start. --nexus启动报错完美解决
程序员文章站
2022-07-10 20:19:56
...
在windows环境下安装并启动nexus可能会出现以下情况
wrapper: waiting to start...
wrapper: waiting to start...
wrapper: waiting to start...
The nexus service was launched, but failed to start.
在\nexus-2.13.0-01-bundle-2\nexus-2.13.0-01\logs打开日志文件wrapper.log下
查看日志文件,显示:
wrapper | The nexus service was not running.
wrapper | Starting the nexus service...
wrapper | --> Wrapper Started as Service
wrapper | Launching a JVM...
wrapper | Unable to execute Java command. 系统找不到指定的文件。 (0x2)
wrapper | "C:\Environment\Java\jdk1.7.0_45\bin\java" -Djava.io.tmpdir=./tmp -
...
大概说明了nexus找不到系统环境中的JVM,那么我们手动在nexus配置jvm路径
在在Nexus安装目录下 找到…\bin\jsw\conf.wrapper.conf文件,用notepad++打开
定位到配置文件的13~15行:(或者查找set the jvm)
#Set the JVM executable
#(modify this to absolute path if you need a Java that is not on the OS path)
wrapper.java.command=java
把上述标红的一行的jvm路径指定为你系统下jdk的绝对路径,我这里改为:
wrapper.java.command=C:\Users\10547\Desktop\java\JDK\bin\java
保存,重新启动nexus,如果依然提示
The nexus service was launched, but failed to start.
再次查看日志文件:
报错:
java.lang.TypeNotPresentException: Type javax.xml.bind.JAXBContext not present
报这个错的原因是JDK9中移除了该nexus版本需要的相关jar包
去maven官网下载这两个jar: activation-1.1.1.jar jaxb-api-2.3.0.jar
放到nexus安装目录的lib下就可以了
PS:我系统中对应lib中的路径 …\nexus-2.12.0-01\nexus\WEB-INF\lib
再次启动nexus,cmd命令窗口自动退出,浏览器输入localhost:8081/nexus
出现主界面即启动成功。