soul网关支持tars,尝试跑通tars插件
1、环境搭建
- soul-admin
登录soul-admin打开tars插件开关
- soul-bootstrap
soul-bootstrap/src/main/resources/application-local.yml 增加如下依赖
<dependency>
<groupId>org.dromara</groupId>
<artifactId>soul-spring-boot-starter-plugin-tars</artifactId>
<version>${project.version}</version>
</dependency>
- soul-examples-tars
soul-examples-tars/pom.xml 增加如下依赖
<dependency>
<groupId>org.dromara</groupId>
<artifactId>soul-spring-boot-starter-client-tars</artifactId>
<version>${soul.version}</version>
<exclusions>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
soul-examples-tars/src/main/resources/application.yml 添加如下配置
soul:
tars:
adminUrl: http://localhost:9095
contextPath: /tars
appName: tars
ipAndPort: 192.168.41.103:21715 # 还不清楚作用
2、启动服务
soul-admin 启动
soul-bootstrap 启动
soul-examples-tars 未启动成功
3、遇到问题
今天尝试启动 soul-examples-tars 报 NullPointerException 异常,对tars不是很熟悉还未解决…
RemotePropertySource sources = event.getSpringApplication().getMainApplicationClass().getAnnotation(RemotePropertySource.class);
[TARS] start server construction
com.qq.tars.server.config.ConfigurationException: error occurred on load server config
at com.qq.tars.server.config.ConfigurationManager.loadServerConfig(ConfigurationManager.java:113)
at com.qq.tars.server.config.ConfigurationManager.init(ConfigurationManager.java:57)
at com.qq.tars.server.core.Server.loadServerConfig(Server.java:90)
at com.qq.tars.server.core.Server.<init>(Server.java:42)
at com.qq.tars.server.core.Server.<clinit>(Server.java:38)
at com.qq.tars.spring.bean.PropertiesListener.onApplicationEvent(PropertiesListener.java:37)
at com.qq.tars.spring.bean.PropertiesListener.onApplicationEvent(PropertiesListener.java:31)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at org.dromara.soul.examples.tars.SoulTestTarsApplication.main(SoulTestTarsApplication.java:38)
Caused by: java.lang.NullPointerException
at java.io.FileInputStream.<init>(FileInputStream.java:130)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at com.qq.tars.common.util.Config.parseFile(Config.java:211)
at com.qq.tars.server.config.ConfigurationManager.loadServerConfig(ConfigurationManager.java:63)
... 17 more
The exception occurred at load server config