JBoss AS 安装配置部署报错以及使用wildfly替换

一、JBOSS下载
jdk:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


jboss:
https://developers.redhat.com/products/eap/download/

https://developers.redhat.com/content-gateway/file/jboss-eap-7.4.0.zip

 

红帽官方下载JBOSS EAP可能需要先注册红帽账号才能下载,版本比较新。如果安装旧版的JBOSS AS可以在以下地址下载:
http://jbossas.jboss.org/downloads

jboss-as-7.1.1.

修改配置文件 vim /data/tools/jboss/standalone/configuration/standalone.xml

修改监听地址,有127.0.0.1 修改成0.0.0.0 

<interfaces> <interface name="management"> <inet-address value="${jboss.bind.address.management:0.0.0.0}"/> </interface> <interface name="public"> <inet-address value="${jboss.bind.address:0.0.0.0}"/> </interface> <!-- TODO - only show this if the jacorb subsystem is added --> <interface name="unsecure"> <!-- ~ Used for IIOP sockets in the standard configuration. ~ To secure JacORB you need to setup SSL --> <inet-address value="${jboss.bind.address.unsecure:0.0.0.0}"/> </interface>

 

修改http启动端口

 vim /data/tools/jboss/standalone/configuration/standalone.xml

 <socket-binding name="http" port="80"/>

 

修改jvm

[root@jboss1 bin]# vim /data/tools/jboss/bin/standalone.conf

if [ "x$JAVA_OPTS" = "x" ]; then
  JAVA_OPTS="-Xms1024m -Xmx1024m -Xmn256m -Xss228k -XX:+UseG1GC -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:+DisableExplicitGC -Djava.net.prefe
rIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
else
echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi

 

 

[root@jboss1 bin]# ./standalone.sh 
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /data/tools/jboss-as-7.1.1.Final

  JAVA: /data/jdk/bin/java

  JAVA_OPTS:  -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml

=========================================================================

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Exception in thread "main" javax.xml.parsers.FactoryConfigurationError: Provider __redirected.__SAXParserFactory could not be instantiated: java.lang.NullPointerException
        at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:204)
        at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:152)
        at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:232)
        at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:127)
        at jdk.xml.internal.JdkXmlUtils.getSAXFactory(JdkXmlUtils.java:235)
        at jdk.xml.internal.JdkXmlUtils.<clinit>(JdkXmlUtils.java:78)
        at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.<init>(SchemaParsingConfig.java:319)
        at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.<init>(SchemaParsingConfig.java:254)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.<init>(XSDHandler.java:480)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.<init>(XSDHandler.java:487)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.<init>(XMLSchemaLoader.java:357)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.<init>(XMLSchemaLoader.java:292)
        at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.<init>(XMLSchemaFactory.java:97)
        at javax.xml.validation.SchemaFactoryFinder._newFactory(SchemaFactoryFinder.java:232)
        at javax.xml.validation.SchemaFactoryFinder.newFactory(SchemaFactoryFinder.java:146)
        at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:213)
        at __redirected.__SchemaFactory.<clinit>(__SchemaFactory.java:66)
        at __redirected.__JAXPRedirected.initAll(__JAXPRedirected.java:88)
        at org.jboss.modules.Module$1.run(Module.java:85)
        at org.jboss.modules.Module$1.run(Module.java:72)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.jboss.modules.Module.<clinit>(Module.java:72)
        at org.jboss.modules.Main.main(Main.java:255)
Caused by: java.lang.NullPointerException
        at __redirected.__RedirectedUtils.loadProvider(__RedirectedUtils.java:94)
        at __redirected.__RedirectedUtils.loadProvider(__RedirectedUtils.java:87)
        at __redirected.__SAXParserFactory.<init>(__SAXParserFactory.java:102)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:192)

 

解决办法

将JBoss主目录下的jboss-modules.jar替换为jboss-modules-1.1.5.GA.jar,并将其重命名为jboss-modules.jar;
[root@jboss1 jboss-as-7.1.1.Final]# unzip jboss-modules-1.1.5.ga.jar.zip
[root@jboss1 jboss-as-7.1.1.Final]# mv jboss-modules-1.1.5.ga.jar jboss-modules.jar

下载地址 http:
//www.java2s.com/Code/JarDownload/jboss-modules/jboss-modules-1.1.5.ga.jar.zip

 

添加访问账户

[root@jboss1 bin]# ./add-user.sh 

 

 

启动

[root@jboss1 bin]# ./standalone.sh

[root@jboss1 log]# /data/tools/jboss/bin/standalone.sh

JBoss Bootstrap Environment

JBOSS_HOME: /data/tools/jboss

JAVA: /data/jdk/bin/java

JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms1024m -Xmx1024m -Xmn256m -Xss228k -XX:+UseG1GC -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:+DisableExplicitGC -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml

=========================================================================

18:40:25,718 INFO [org.jboss.modules] JBoss Modules version 1.1.5.GA
18:40:26,502 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
18:40:26,651 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting

 

启动不了, 

原因: jdk用的是1.8版本

JDK8中有一些变化,阻止AS7和当前版本的EAP6在JDK8下启动。我们在WildFly中有很多JDK8相关的修复程序,建议使用它。

可以更改jdk版本,但最好的办法就是

 

下载widlfly

https://github.com/wildfly/wildfly/releases/download/26.0.1.Final/wildfly-26.0.1.Final.tar.gz

配置与jboss相同

 

启动jboss

[root@jboss1 bin]#  ./standalone.sh &

 

关闭jboss

[root@jboss1 bin]# ./jboss-cli.sh --connect command=:shutdown

 

 

redhat jboss eap 版本  jdk1.8 匹配没有以上问题

 

 

 

JBOSS7下配置程序为根路径

1.JBOSS7下的standalone.xml文件<virtual-server></virtual-server>节点改为以下内容    

<virtual-server name="default-host" enable-welcome-root="false">
         <alias name="localhost"/>
         <alias name="example.com"/>
</virtual-server>

2.将欲配置为根路径的程序的WEB-INF文件夹下添加jboss-web.xml文件,里面的内容如下:

<?xml version="1.0" encoding="UTF-8"?> 
<jboss-web> 
    <context-root>/</context-root> 
</jboss-web>

 

posted @ 2022-03-15 18:47  fengjian1585  阅读(499)  评论(0编辑  收藏  举报