5

I can add JBoss 7 to eclipse in standalone mode but when i try to add a JBoss 7 server in domain mode the path to the config file is always resolved by Eclipse relative to standalone folder. So if I put in full path to domain.xml it doesn;t like it and if i just put in the file name it tires to resolve it standalone.

Any ideas?

Thanks w

2 Answers 2

3

Not Supported Currently.

Sources: JBoss Community Post & JBoss Issue JBIDE-12161

1

Not formally supported indeed... but there's a way to start and stop it from Eclipse so that you can enjoy all server logs in the Eclipse console and the start/stop icons. However, You won't be able to benefit from "run as -> run on server" because Eclipse won't identify which server you target among the process server, host controller, and main server instances. Yet, there's a remedy to that too because EAP7 supports a "unmanaged deployment mode" on exploded archives that can target your Eclipse/Maven build directories, allowing you to "refresh" deployed archives with enable/disable commands from JBoss-cli or the JBoss admin console (JBoss won't detect .class changes and trigger class loader reloads... you have to enforce it). Cherry on the cake, if you happen to work with GWT web front end technologies, you can enjoy hot redeployment of your GWT artifacts via the CodeServer in SuperDevMode within a Domain mode server instance...

Here is how to proceed:

  • I assume you have the JBoss Tools plug in installed in Eclipse

  • Create a "new server" into the 'Servers' view alike for standalone mode, and create a JBoss that takes the domain as server base dir and domain.xml as configuration file. Fill the rest and save it. As such, this server won't start properly.

  • select the just created server and right-click 'open'. In the Overview panel that fills the main Eclipse Window, click on the underlined "open launch configuration" link

  • You need to adjust the launch configuration to match the actual launch made by the domain.bat / domain.sh. So you'll need to update the long Program and VM arguments as explained below. Please, edit all paths strings illustrated below to match that of YOUR environment, e.g. "/jBOSS/EAP70/domain" may become "/projects/jb/as7/domain" in your context... and so forth

  • DO NOT forget to check OUT the option 'Always update arguments related to the runtime'

Program arguments:

-mp "C:/jBOSS/EAP70/modules" org.jboss.as.process-controller -jboss-home "C:\jBOSS\EAP70" -jvm "C:\java\JDK8U66\jre\bin\java" -mp "C:/jBOSS/EAP70/modules" -- "-Dorg.jboss.boot.log.file=C:/jBOSS/EAP70/domain/log/boot.log" "-Dlogging.configuration=file:/C:/jBOSS/EAP70/domain/configuration/logging.properties" -Xms64M -Xmx512M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -server -- -default-jvm "C:\java\JDK8U66\jre\bin\java"

VM arguments:

-Xms64M -Xmx512M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -server "-Dorg.jboss.boot.log.file=C:/jBOSS/EAP70/domain/log/boot.log" "-Dlogging.configuration=file:/C:/jBOSS/EAP70/domain/configuration/logging.properties" -cp "C:\jBOSS\EAP70\jboss-modules.jar" -Djboss.home.dir=C:/jBOSS/EAP70 -Djboss.bind.address.management=localhost

Working Directory: C:/jBOSS/EAP70/bin (of course you adapt values to equivalent paths in your context)

Main class: org.jboss.modules.Main

Classpath: (bootstrap) JRE system Library + (user entries) jboss-modules.jar

And you have done. Note that for stopping the server, the Servers' view red stop button will not work and you must instead use the similar-looking red button in the Console view (that kills the live java process launched in the console, here the JBoss process controller that in turn stops everything).

If you are curious to understand where the trick is...(continue reading)

In the long java command line, there is a separation around the main java class to launch, where "VM arguments" stand on the right of it, and "program arguments" on the left of it. You may capture the actual complete java command line that launches your server in domain mode with a tool like Microsoft sysinternals' process-explorer on Windows, or the "ps -eaf" or "pargs" shell command in LINUX/UNIX, after you have started jBOSS with domain.bat or domain.sh.

But you will observe here that the java command takes a "-jar module.jar" argument whereas Eclipse launch requires a conventional "-cp module.jar main-class" argument form. the '-jar' argument is indeed a variant spec where the main class is specified by the manifest file inside the jar.

In my case, the (very long) command line I captured from a classical domain.sh or domain.bat launch was:

C:\jBOSS\EAP70\bin>"C:\Program Files\Java\jre1.8.0_66\bin\java"  -Xms64M -Xmx512M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -server  "-Dorg.jboss.boot.log.file=C:\jBOSS\EAP70\domain\log\process-controller.log"  "-Dlogging.configuration=file:C:\jBOSS\EAP70\domain\configuration/logging.properties" -jar "C:\jBOSS\EAP70\jboss-modules.jar" -mp "C:\jBOSS\EAP70\modules"  org.jboss.as.process-controller  -jboss-home "C:\jBOSS\EAP70"  -jvm "C:\Program Files\Java\jre1.8.0_66\bin\java"  -mp "C:\jBOSS\EAP70\modules"  --  "-Dorg.jboss.boot.log.file=C:\jBOSS\EAP70\domain\log\host-controller.log"  "-Dlogging.configuration=file:C:\jBOSS\EAP70\domain\configuration/logging.properties"  -Xms64M -Xmx512M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -server  --  -default-jvm "C:\Program Files\Java\jre1.8.0_66\bin\java"

which breaks as follows:

JAVA_COMMAND>> "C:\Program Files\Java\jre1.8.0_66\bin\java"

followed by

VM_ARGS_____>> -Xms64M -Xmx512M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -server  "-Dorg.jboss.boot.log.file=C:\jBOSS\EAP70\domain\log\process-controller.log"  "-Dlogging.configuration=file:C:\jBOSS\EAP70\domain\configuration/logging.properties"

followed by:

MAIN_CLASS__>> -jar "C:\jBOSS\EAP70\jboss-modules.jar" 

whose equivalent is rewritten (peeking into the manifest of jboss-modules.jar):

MAIN_CLASS__>> -cp "C:\jBOSS\EAP70\jboss-modules.jar" org.jboss.modules.Main

followed by final chunk:

PROGRAM-ARGS>> -mp "C:\jBOSS\EAP70\modules"  org.jboss.as.process-controller     -jboss-home "C:\jBOSS\EAP70" -jvm "C:\Program Files\Java\jre1.8.0_66\bin\java"          -mp "C:\jBOSS\EAP70\modules"  --  "-Dorg.jboss.boot.log.file=C:\jBOSS\EAP70\domain\log\host-controller.log" "-Dlogging.configuration=file:C:\jBOSS\EAP70\domain\configuration/logging.properties" -Xms64M -Xmx512M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -server  --  -default-jvm "C:\Program Files\Java\jre1.8.0_66\bin\java"

From the point you understand this quite surprising program argument section that replicates many of the VM aguments (because the launched process controller has to invoke the server JVM with these args...), you can then map the pieces in Eclipse server launch configuration.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.