由于当前项目是微服务开发,用传统的tomcat启动服务。解决办法如下
1、先在tomcat的conf目录下修改server.xml。中增加service 如下
<Service name="admin">
<Connector port="9007" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"/>
<Engine name="admin" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps/admin"
unpackWARs="true" autoDeploy="true">
</Host>
</Engine>
</Service>
<Service name="system">
<Connector port="9000" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"/>
<Engine name="system" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps/system"
unpackWARs="true" autoDeploy="true">
</Host>
</Engine>
</Service>
在上面我加入了两个service 分别对应9007 端口 和 9000 端口 并且在 <Host>
中 appBase
属性代表我们war包放的位置,我这里的意思 在webapps 下面的某个文件夹里面是我这次运行的包。
然后我们就需要在yml当中配置
spring:
jmx:
enabled: false
最后打包放入我们的文件夹里面例如我的 admin
和system
最后直接运行 startup.bat
我们访问地址 是需要
ip+端口+项目war名称+加接口
例如我的