Jboss启动报错:Unrecognized VM option ‘MaxPermSize=256m‘

Jboss启动报错:

Unrecognized VM option 'MaxPermSize=256m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

翻译过来就是:

无法识别的VM选项“MaxPermSize=256m”

错误:无法创建Java虚拟机。

错误:发生致命异常。程序将退出。

意思是VM选项“MaxPermSize=256m”在当前虚拟机不可用,其实原因是:

在jdk8(含)以后,永久代被移除了,所以虚拟机的启动参数MaxPermSize(最大永久代大小)不可用。

我的Jboss配置的jdk是17,当然没有MaxPermSize选项,所以报这个错就很正常了。那么这个错误怎么解决呢?有两种方案:

1.jdk版本更换到8以前;

2.移除MaxPermSize这个虚拟机启动参数即可。

关于第一点,我们开始试验一下。

首先,下载jdk7,然后通过ftp工具上传到linux中:

 第二步,解压后的java-se-7u75-ri就是jdk7,打开看一下:

 第三步,配置jdk环境变量。

# 编辑profile文件,修改jdk环境变量为jdk1.7
vim /etc/profile

 保存退出,然后使用命令让文件立即生效:

# 使该文件立即生效
source /etc/profile

第四步,查看jdk版本:

 结果并没有什么卵用,这其实不应该的,除非配置错误了,但是配置的时候已经仔细检查过了,那可能就是需要重启ssh工具,我们重启之后再试。

 我们看到已经成功配置jdk为1.7,然后启动Jboss。

第五步,启动Jboss。

切换到Jboss的安装目录,然后到bin目录下,启动脚本standalone.sh。

 我们也看到了我们配置的jdk1.7的环境变量,以及Jboss的环境变量,还有一些虚拟机启动参数等信息。但是下面显示报错了:

 以上是全部报错信息,其实最重要的一句话是:

Caused by: java.io.FileNotFoundException: /opt/jboss/jboss-as-7.1.1.Final/standalone/log/boot.log (没有那个文件或目录)

 第六步,解决Jboss启动报错。

 切换到对应目录,发现确实没有log目录,当然也没有对应的boot.log文件,我们手动创建log文件夹以及boot.log文件,再启动试试。

 第七步,启动成功。

 第八步,测试是否启动成功。

打开另外一个窗口,然后测试:

curl http://127.0.0.1:8080

然后我们看到:

<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright (c) 2011, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <title>Welcome to JBoss Application Server 7</title>
  <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
  <link rel="StyleSheet" href="as7_style.css" type="text/css">
</head>

<body>
  <div class="wrapper">
    <div class="as7">
      <img src="as7_logo.png" alt="JBoss Application Server 7... it's here." width="195" height="228" border="0">
    </div>

    <div class="content">
      <h1>Welcome to AS 7</h1>

      <h3>Your JBoss Application Server 7 is running.</h3>

      <p><a href="documentation.html">Documentation</a> | <a href="https://docs.jboss.org/author/display/AS71/Quickstarts">Quickstarts</a> | <a href="/console">Administration Console</a> <br/>

      <a href="http://www.jboss.org/jbossas"><br>
      JBoss AS Project</a> | <a href="http://community.jboss.org/en/jbossas/as7_users?view=all">User
      Forum</a> | <a href=
      "https://issues.jboss.org/browse/AS7">Report an issue</a></p>

      <p class="logos"><a href="http://jboss.org"><img src="jboss_community.png" alt="JBoss and JBoss Community" width=
      "254" height="31" border="0"></a></p>

      <p class="note">To replace this page set "enable-welcome-root" to false in your server configuration and deploy
      your own war with / as its context path.</p>
    </div>
  </div>
</body>
</html>

我们看到这其实就是一个HTML页面。

继续测试对应的端口,我们可以看我们说启动成功那个截图,上面监听了4447端口、9999端口、9990端口。

ss -an | grep 8080
ss -an | grep 9999
ss -an | grep 9990

 我们也可以使用命令:

curl -I 127.0.0.1:8080

来验证启动情况。

 上面几个红框,第一个是我们使用的命令;第二个是HTTP返回码,200表示ok;第三个是最后更新时间,显示的是2012年,也就是我们当前版本的Jboss最后更新时间;第四个,也就是最后一个是我们当前操作时间:2022年2月2日11:10:17,星期二,格林威治标准时间。其实这个时间是不准确的,或者说不是我们中国目前的北京时间,我们目前的时间是19:17分。如果是对应我们输入命令时的时间,应该对应的是19:10分。这样我们看到相差了8个小时,这个是Jboss默认的时区设置问题。上面我们说了,它显示的是格林威治标准时间,而格林威治标准时间比北京时间慢了8个小时,如果我们百度格林威治标准时间的话,显示如下:

关于时间的话我们就清楚了,回头设置Jboss的时区即可。

  • 6
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北冥牧之

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值