springboot项目使用中创InforSuiteAS替换tomcat
学习地址
InforSuiteAS是国产付费中间件,对标 tomcat
官网地址:https://www.inforbus.com/
学习:https://www.showapi.com/news/article/679cade04ddd79f11a3ddf44
一、部署InforSuiteAS
准备:
中间件压缩包:InforSuiteAS_StE_V10.0.5.3.9.zip
临时授权文件(买了才有):license.infor
1、部署
系统:centos8
压缩包存放目录(拷贝进去):/usr/local/src/inforSuit-as
安装unzip:sudo yum install unzip
解压:
unzip InforSuiteAS_StE_V10.0.5.3.9.zip
解压完成后:
把临时授权文件放到 as 文件夹下
2、运行
环境准备:jdk8
[root@localhost bin]# java -version
java version "1.8.0_371"
Java(TM) SE Runtime Environment (build 1.8.0_371-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.371-b11, mixed mode)
进入到目录内: /usr/local/src/inforSuit-as/InforSuiteAS_StE_V10.0.5.3.9/as/bin
启动命令:
方式一(窗口关了就停了):
./startas.sh
方式二(官方启动方式,推荐):
sh asadmin start-domain
第一次启动的时候需要设置初始密码,我这里设置的是:!Aa123456@
我之前启动过一次,启动后:
浏览器输入:
https://192.168.145.131:8060/console
账号(初始的):inforsAdmin
密码(刚刚设定的): !Aa123456@
登录后:
二、springboot项目打包成war包 特殊处理
完整资料:https://download.csdn.net/download/chou342175867/90460631
1、pom文件处理
1、排除内嵌的tomcat包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 排除内置的tomcat -->
<exclusions>
<exclusion>
<artifactId>org.springframework.boot</artifactId>
<groupId>spring-boot-starter-tomcat</groupId>
</exclusion>
</exclusions>
</dependency>
2、新增tomcat、javax.servlet-api
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!-- tomcat范围改成provided,否则后面就会出问题,tomcat无法解析jsp -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
3、打包格式设置为war
<packaging>war</packaging>
4、打包后的项目名称
<build>
<!--我这里是设置为ROOT,这样部署到tomcat中后,请求地址无需加上项目名称-->
<finalName>ROOT</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.4.2.Final</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 代表maven打包时会将外部引入的jar包(比如在根目录下或resource文件下新加外部jar包)打包到项目jar,在服务器上项目才能运行 -->
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
5、启动类修改
1、原来的不动:TransLineApplication
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableScheduling
@SpringBootApplication
@EnableSwagger2
public class TransLineApplication {
public static void main(String[] args) {
SpringApplication.run(TransLineApplication.class, args);
}
}
2、新增SpringBootStartApplication
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* 重新写一个类 SpringBootStartApplication,和HeroesApplication平级,
* TransLineApplication可以不做更改,这个方法更方便,推荐用这个
*/
public class SpringBootStartApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(TransLineApplication.class);
}
}
6、打包成war
2、部署到InforsuiteAS
1、ROOT.war中的WEB-INF目录下放入inforsuite-web.xml
inforsuite-web.xml内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<inforsuite-web-app>
<property name="relativeRedirectAllowed" value="true"/>
<class-loader delegate="false" />
<whitelist-package>jdk</whitelist-package>
<whitelist-package>org.omg</whitelist-package>
<whitelist-package>org.ietf</whitelist-package>
<whitelist-package>org.eclipse</whitelist-package>
<whitelist-package>META-INF/services</whitelist-package>
<locale-charset-info>
<parameter-encoding default-charset="UTF-8"/>
</locale-charset-info>
</inforsuite-web-app>
放入后的截图
2、InforsuiteAS管理页面中进行部署
2.1、先部署war
应用程序 —>部署,最后点确定
部署完成后:
点击“访问”按钮,可以看到访问地址,这个是不能访问的
2.2、修改访问ip、端口
配置—》server-config —>HTTP服务 —》 HTTP监听程序
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/c7b3e9d52acd4951988f5de388a4ab48.png
修改:http-listener-1,若有修改ssh的 需要修改 http-listener-2
修改对应的 ip、端口,最后保存;就是你服务器的地址和端口
输入浏览器就可以访问了,输入:http://192.168.145.131:8082
3、部署到tomcat中
1、安装tomcat
2、tomcat控制台乱码处理
找到/conf/logging.properties
# utf-8 修改为 GBK
java.util.logging.ConsoleHandler.encoding = GBK
3、运行
将ROOT.war拷贝到tomcat的webapps目录中
进入到 /bin 目录下,双击“startup.bat”启动
4、修改运行端口
/conf/server.xml 找到端口修改