Marc Gagnon [https://community.jboss.org/people/MarcGagnonPincourt] created the 
document:

"How to define multiple jboss 7 server instances based on the standalone folder 
using eclipse juno and jboss tools 4.0"

To view the document, visit: https://community.jboss.org/docs/DOC-48321

--------------------------------------------------------------
How to define multiple jboss 7 server instances based on the standalone folder 
using eclipse juno and jboss tools 4.0
I posted this in the general Jboss 7 discussion and then realized I could write 
it as a document...

Assume you are developping applications on your PC...
You might want to do deploy multiple instances when you need to deploy two 
applications, each one having different configuration. 
Another reason might be that you have two applications that must be running but 
one of these will be stopped and restarted often while the other one could stay 
up. If the application which could stay up takes a while to deploy, you 
definitely prefer to run it in a different server instance.

It is true that we can deploy all applications in the same JBoss instance.
But sometimes, we need to isolate a specific instance with specific 
configuration files.
In previous versions of the JBoss server, all we had to do was to copy 
“server/default” to “server/foo” + provide an offset for ports.
In eclipse, the jboss plugin has to be updated.
See:  http://www.eclipse.org/forums/index.php?t=msg&goto=489439 
http://www.eclipse.org/forums/index.php?t=msg&goto=489439
Or:  
http://stackoverflow.com/questions/173487/problems-with-shutting-down-jboss-in-eclipse-if-i-change-jndi-port
 
http://stackoverflow.com/questions/173487/problems-with-shutting-down-jboss-in-eclipse-if-i-change-jndi-port
Now, different JBoss version, different problem...

Let’s say we have this situation with application “foo” and “bar”.
Let’s say also that you want to use the basic standalone server configuration.
I will assume you are running eclipse on a windows PC with JBoss-7.1.1.Final.
Assume also that the JBoss home is C:\tools\jboss\jboss-as-7.1.1.Final

Steps to create a server instance for “foo” and control it from eclipse:

1-From the JBoss 7 home directory, copy “standalone” to “foo”.
The goal is to leave “standalone” unmodified and work on a copy.
That way, you keep your golden master available as a base for other server 
instances you might need.
Of course, you could also keep a copy elsewhere.
I prefer to keep “standalone” untouched and create as many copies as necessary 
but this is a personal preference.

2-Update foo/standalone.xml  to specify the port offset to use right in the 
standalone.xml configuration file like this:
...
<socket-binding-group name="standard-sockets" default-interface="public" 
port-offset="${jboss.socket.binding.port-offset:10000}">
 <socket-binding name="management-native" interface="management" 
port="${jboss.management.native.port:9999}"/>

...
This example uses 10000 so that the resulting HTTP port will be “18080”.
Do not replace with “port-offset="10000"” :  that will not work.
Believe me, we tried many combinations and this is the only way to make it work 
properly.
This seems to be related to the way the JBoss tools plugin works.

If you simply need to start the server from the command line, you’re done:
C:\tools\jboss-as-7.1.1.Final\bin>standalone.bat -Djboss.server.base.dir=../foo

3-In eclipse, go to Window  / Preferences / Server / Runtime Environments / Add
Create a runtime environment “JBoss 7.1 Runtime foo”.
The configuration file must be a relative path like this: 
..\..\foo\configuration\standalone.xml
The JBoss tools eclipse seems to expect files to be in the default “standalone” 
folder.

4-In the server view, right click New / Server
Select JBoss Community / JBoss AS 7.1 with the runtime created at step 3.

5-In the server view, double click on the server created at step 4 (or press 
F3) to open the parameter editor.
In section “Server Ports”, uncheck “Detect from Local Runtime” and specify 
offset 10000.
Again, we spent some time checking and unchecking these options and the only 
way to make it work is to override only this field.

Click on the “Deployment” tab to see deployment default settings.
Select “Use a custom deploy folder” and edit the directory fields.
Replace “standalone/deployments” by “foo/deployments”.
Replace “standalone/tmp” by “foo/tmp”.

6-In the server’s parameter editor, go back to the overview, General 
Information, click “Open launch configuration”.

First, uncheck “Always update arguments related to the runtime”.

The “Program arguments” should look like this:
-mp "C:/tools/jboss/jboss-as-7.1.1.Final/modules" -jaxpmodule 
javax.xml.jaxp-provider org.jboss.as.standalone -b 0.0.0.0 
--server-config=..\..\foo\configuration\standalone.xml

You may use whatever parameters you need, the important thing for our setup is 
to specify the server configuration file relative to the default “standalone” 
path.

The VM arguments now:
-server -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 
"-Dorg.jboss.boot.log.file=C:/tools/jboss/jboss-as-7.1.1.Final/foo/log/boot.log"
 
"-Dlogging.configuration=file:/C:/tools/jboss/jboss-as-7.1.1.Final/foo/configuration/logging.properties"
 "-Djboss.home.dir=C:/tools/jboss/jboss-as-7.1.1.Final" 
"-Djboss.server.base.dir=C:\tools\jboss\jboss-as-7.1.1.Final\foo"

Again, you may have to adjust these parameters to your needs.
The important thing is to define the following:
Boot log file : -Dorg.jboss.boot.log.file=<path to boot file>
Logging configuration file: -Dlogging.configuration=<URL to log file 
configuration>
Base directory: -Djboss.server.base.dir=<Instance path>

7-Try to start and stop the server, look at the output to make sure the ports 
have the expected offset.
Make sure everything works:
Open a browser on “localhost:18080”, then open the administrative console.
In the “Runtime” section, click “Configuration” and “Environment Properties”.
Look at, say, “catalina.home” : it should be 
“C:\tools\jboss\jboss-as-7.1.1.Final\foo\tmp”.

That’s it!
Like I mentioned, some paths seems to be, somehow, hard coded as 
“standalone/...”.
This is probably because copying “standalone” like we did with “server/default” 
is not a use case planned for JBoss 7.
I hope that some JBoss developpers will be able to elaborate on this.
In the mean time, maybe this post could be edited and added to  
https://docs.jboss.org/author/display/AS71/Starting+JBoss+AS+from+Eclipse+with+JBoss+Tools
 
https://docs.jboss.org/author/display/AS71/Starting+JBoss+AS+from+Eclipse+with+JBoss+Tools
--------------------------------------------------------------

Comment by going to Community
[https://community.jboss.org/docs/DOC-48321]

Create a new document in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2128]
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to