
文章目录
-
- [下载Jboss eap 7安装包](#下载Jboss eap 7安装包)
- 执行standalone.bat
- 修改jdk8不兼容的一些内存空间参数
- 查看端口是否被占用
- 解决端口占用
- 环境变量配置
- 修改项目中的pom文件
- 配置Jboos启动项
- 本地localhost启动测试
下载Jboss eap 7安装包
Jboss EAP:JBoss Enterprise Application Platform Download | Red Hat Developer

Jboss 开源:JBoss Application Server Downloads - JBoss Community

执行standalone.bat
解压后,可执行standalone.bat
技巧:区分是windows的包还是linux的包的一种方式是 可以查看bin路径下是.sh还是bat启动项

注意:jdk8不兼容Jboss 7.x ,只能兼容Jboss eap 7
如果是Jboss7.x 在启动的时候会一直报starting,所以启动会一直在starting 我这里是后续在项目中执行才发现这个问题

解决:可以下载一个1.7或以前的版本
用记事本进入jboss的目录:找到bin目录下的standalone.bat,用记事本或者其他的文本编辑软件,修改JBOSS_HOME,为你的jdk1.7,安装路径。(前提是你的jboss环境变量配置正确。JBOSS_HOME:你的jboss路径。path下,加;%JBOSS_HOME%\bin)
修改jdk8不兼容的一些内存空间参数
-XX:MaxPermSize=256M 这个参数在 JDK 1.8 中已经不再支持,因为 Java 8 引入了元空间(Metaspace)取代了永久代(PermGen)。需要将其从 JAVA_OPTS 中移除

查看端口是否被占用
bash
netstat -ano | findstr 8080
tasklist | findstr 17744

解决端口占用
如果,要想修改你的jboss服务器端口,可以到jboss->standalone->configuration,找到standalone.xml文件:把 8080修改成你想要的端口重启即可

环境变量配置


修改项目中的pom文件
将原来的tomcat注释掉,加上jboss的依赖,并且要打包为war包,jboss兼容war包
JBoss 是一个 Java EE 应用服务器,而 WAR 包是 Java EE 规范中用于部署 Web 应用程序的标准格式。它包含了 Web 应用程序的所有组件,如 WEB-INF 目录(包含 web.xml 等配置文件)、classes 目录(包含编译后的类文件)和 lib 目录(包含依赖的库)。

java
<artifactId>hke.web.service</artifactId>
<packaging>war</packaging>
<version>${parent.version}</version>
java
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.tomcat.embed</groupId>-->
<!-- <artifactId>tomcat-embed-core</artifactId>-->
<!-- <scope>${scope.tomcat}</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.tomcat.embed</groupId>-->
<!-- <artifactId>tomcat-embed-el</artifactId>-->
<!-- <scope>${scope.tomcat}</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.tomcat.embed</groupId>-->
<!-- <artifactId>tomcat-embed-websocket</artifactId>-->
<!-- <scope>${scope.tomcat}</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.tomcat</groupId>-->
<!-- <artifactId>tomcat-annotations-api</artifactId>-->
<!-- <scope>${scope.tomcat}</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.3.Final</version> <!-- 推荐使用 3.0.3.Final 版本,因为它更适合 JBoss 7.1.1.Final -->
<type>pom</type>
<scope>provided</scope>
</dependency>
配置Jboos启动项
注意:如果是社区版idea,没有jboos启动项需要去下载jboos插件,最好建议切换成专业版会自动集成好,这里也是重新下载了一个idea
企业版:去setting中的Plugins下载Jboss的相关插件,搜到什么下什么,然后重启idea,也可能会出现,但是个人觉得不好用

专业版:

本地localhost启动测试

总结:
idea社区版建议使用专业版
jboss7.x不兼容jdk8,jboss eap 7 兼容jdk8
pom文件修改
8080 端口占用