Skip to content
本页导航

中间件 MiddleWare

常见中间件

  • 东方通 TongWeb
  • 宝兰德 BesWebServer

Spring Boot 适配指南

东方通TongWeb

注意:tongweb的依赖包只能从公司内部Nexus中拉取


Tongweb-Spring-Boot-Starter

在工程pom.xml添加tongweb-spring-boot-starter和嵌入式TongWeb的依赖,同时,排除掉Spring Boot自带的tomcat依赖

xml
<properties>
		<tongweb.version>7.0.E.6_P2</tongweb.version>
</properties>

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-web</artifactId>
	<exclusions>
		<exclusion>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
		</exclusion>
	</exclusions>
</dependency>

<!-- 添加tongweb-spring-boot-starter 依赖-->
<dependency>
	<groupId>com.tongweb.springboot</groupId>
	<artifactId>tongweb-spring-boot-starter-2.x</artifactId>
	<version>${tongweb.version}</version>
</dependency>
<properties>
		<tongweb.version>7.0.E.6_P2</tongweb.version>
</properties>

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-web</artifactId>
	<exclusions>
		<exclusion>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
		</exclusion>
	</exclusions>
</dependency>

<!-- 添加tongweb-spring-boot-starter 依赖-->
<dependency>
	<groupId>com.tongweb.springboot</groupId>
	<artifactId>tongweb-spring-boot-starter-2.x</artifactId>
	<version>${tongweb.version}</version>
</dependency>

Tongweb-Spring-Boot-WebSocket (若有)

xml
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
	<groupId>com.tongweb.springboot</groupId>
	<artifactId>tongweb-spring-boot-websocket-2.x</artifactId>
	<version>${tongweb.version}</version>
</dependency>
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
	<groupId>com.tongweb.springboot</groupId>
	<artifactId>tongweb-spring-boot-websocket-2.x</artifactId>
	<version>${tongweb.version}</version>
</dependency>

License授权认证

application.properties文件中配置授权认证

  • 本地磁盘模式

    properties
    server.tongweb.license.path=/usr/license/授权文件.dat
    server.tongweb.license.path=/usr/license/授权文件.dat
  • classpath模式

    properties
    server.tongweb.license.path=classpath:授权文件.dat
    server.tongweb.license.path=classpath:授权文件.dat

常见问题

  • 启动报错,提示找不到 ServletContext 类 getVirtualServerName 方法?

问题现象

Caused by: java.lang.NoSuchMethodError:

javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;

原因

该方法为servlet 3.1 规范定义,pom.xml或war包中,包含了较低版本servlet-api.jar

解决方案

剔除 pom.xml 或 war 包中,包含了较低版本 “servlet-api.jar” 并重新打包运行。

  • 更多问题请按东方通官方文档排查

lhiro