简体   繁体   中英

How to customize the servlet port for an embedded JBoss server using Maven plugin 'jboss-as-maven-plugin'?

I'm using Maven 3.0.4 with jboss-as-maven-plugin for embedded JBoss server. I would like to customize the port on which JBoss listens for requests, normally 8080. However, I can't customize it with the "port" property in the configuration section. Below is my configuration:

    <plugin>
        <groupId>org.jboss.as.plugins</groupId>
        <artifactId>jboss-as-maven-plugin</artifactId>
        <version>7.4.Final</version>                
        <configuration>
             <port>8082</port>
        </configuration>                
    </plugin>

I've checked the official documentation for jboss-as-maven-plugin: https://docs.jboss.org/jbossas/7/plugins/maven/latest/run-mojo.html but don't know what's wrong in it.

In server.log, there is no ERROR message but stop at below:

...
12:52:03,385 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-8) Pausing Coyote HTTP/1.1 on http--127.0.0.1-8080
12:52:03,385 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-8) Stopping Coyote HTTP/1.1 on http--127.0.0.1-8080
12:52:12,859 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
12:52:12,866 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
12:52:12,876 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
12:52:12,877 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
12:52:12,888 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
12:52:12,910 INFO  [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
12:52:12,936 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
12:52:12,964 INFO  [org.jboss.as.security] (MSC service thread 1-5) JBAS013100: Current PicketBox version=4.0.7.Final
12:52:12,978 INFO  [org.jboss.as.naming] (MSC service thread 1-8) JBAS011802: Starting Naming Service
12:52:13,016 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]
12:52:13,078 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
12:52:13,112 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-2) JBoss Web Services - Stack CXF Server 4.0.2.GA
12:52:13,393 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory D:\mshello\SWS-Client\target\jboss-as-run\jboss-as-7.1.1.Final\standalone\deployments
12:52:13,400 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on /127.0.0.1:4447
12:52:13,401 INFO  [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on /127.0.0.1:9999
12:52:13,408 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
12:52:13,523 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
12:52:15,125 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
12:52:15,127 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 3534ms - Started 133 of 208 services (74 services are passive or on-demand)
<< stopped here >>

I can see [org.apache.coyote.http11.Http11Protocol] is still listening on http--127.0.0.1-8080, is it the cause? If yes, how to configurate it in pom.xml?

After removing the whole configuration about port 8082, the server can be startup successfully by mvn jboss-as:run without any problem.

Any suggestion?

You could copy the standalone.xml and change the port numbers in the <socket-binding-group/> section. Then you would use the serverConfig configuration property to point to the standalone.xml you created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM