A: 

In MyEclipse server configuration, you find the field "Optional Shutdown Argument", which is filled with the default value

--shutdown

Change it to

-s jnp://localhost:11099 --shutdown

Edited:

Sorry, this answer is related to MyEclipse. However, there must be some place where you can specify the JBoss shutdown command in your environment as well. Maybe you take a look at the "Run..." configurations?

huo73
I cannot find the field (see the "eclipse setup" image, those are the fields I have.
Balint Pato
Run configuration as well did not solve the problem.
Balint Pato
+1  A: 

OK, what you have to do is File->New->Other->Server, and set up your JBoss server there. It will then appear in Preferences->JBossTools->Servers.

Convoluted.

skaffman
cool. one step closer I think! I would vote if I've had enough points :) Now the shutdown is working (see the 2. phase -- it's 1. phase because of an SO bug), but still throws an error message, I'm not sure to accept fully this answer yet.
Balint Pato
And a second thought...I accept it, the original question is now answered.
Balint Pato
A: 

you should modify in the file "/home/fmoisa/workspace/eclipse/plugins/org.eclipse.jst.server.generic.jboss_1.5.206.v20090115/servers/jboss42.serverdef" this:

org.jboss.Shutdown ${serverRootDirectory}/bin -S -Djboss.boot.loader.name=shutdown.bat jboss.shutdown

to this:

org.jboss.Shutdown ${serverRootDirectory}/bin -S -sjnp://localhost:11099 -Djboss.boot.loader.name=shutdown.bat jboss.shutdown

gl all ;)

A: 

Use the server adapter provided by JBoss tools and not the one that comes default from Eclipse WTP.

Then you can simply double click on the server and you can edit the JNDI port (which btw. is automatically picked up from the XML configuration if you don't do any thing). You can also do the trick about setting the JNDI port via command line arguments in the Launch Configuration but that is more trouble than just setting the port values.

Max Rydahl Andersen
+2  A: 

Here is a detailed fix for this problem: The Eclipse WTP server connector won't shut down JBoss when the jndi port is remapped.

This is because the default server connector profiles don't use their own alias for the jndiPort. This problem is also discussed at eclipse.org: http://www.eclipse.org/forums/index.php?t=msg&goto=489439&S=0db4920aab0a501c80a626edff84c17d#msg%5F489439

The solution comes from the .serverdef files in eclipse:


<eclipse>\plugins\org.eclipse.jst.server.generic.jboss_1.5.105.v200709061325\servers\jboss*.serverdef

They declare an xml property for the jndi port:


<property id="jndiPort"
 label="%jndiPort"
 type="string"
 context="server"
 default="1099" /> 

This simply needs to be used where the serverdef has the STOP command coded:

So this:


 <stop>
  <mainClass>org.jboss.Shutdown</mainClass>
  <workingDirectory>${serverRootDirectory}/bin</workingDirectory>
  <programArguments>-S</programArguments>
  <vmParameters></vmParameters>
  <classpathReference>jboss</classpathReference>
 </stop>

becomes this:


 <stop>
  <mainClass>org.jboss.Shutdown</mainClass>
  <workingDirectory>${serverRootDirectory}/bin</workingDirectory>
  <programArguments>-s jnp://${serverAddress}:${jndiPort}</programArguments>
  <vmParameters></vmParameters>
  <classpathReference>jboss</classpathReference>
 </stop>

The philosophy for this can be verified by comparison to the definition for the jndi connection:


 <jndiConnection>
  <providerUrl>jnp://${serverAddress}:${jndiPort}</providerUrl>
<initialContextFactory>org.jnp.interfaces.NamingContextFactory</initialContextFactory>
  <jndiProperty>
   <name></name>
   <value></value>
  </jndiProperty>
 </jndiConnection>

Credit for the inspiration for this general case fix goes to: Moisa Laurentiu Florin. It was their contribution that got me to look for a way of substituting in the ${jndiPort} instead of a hard coded value.

This fix corrects both plain Eclipse WTP server connector. I'm still investigating the JBOss IDE connector

Louis
A: 

This was changed in JBoss 6.0.0M3.

The stop command is now: "- s service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi"

Note that the port also changed: it is no longer the JNDI port at 1099, but RMI/JMX port 1090. So, you will need another config parameter in the server definition.

I don't know whether the "JNDI port" parameter is required at all for JBoss 6.0.0M3 servers.

I have a modified eclipse plugin at http://www.cs.hs-rm.de/~knauf/public/ which contains a server definition for 6.0.0M3 including this change. This site also links to a JBoss forum thread with more details about this change.

Best regards

Wolfgang Knauf

Wolfgang