Problems with shutting down JBoss in Eclipse if I change JNDI port
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_489439
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
Open jboss-path\bin\shutdown.jar
example: jboss-4.2.3.GA\bin\shutdown.jar
and open jboss-path\bin\shutdown.jar\jndi.properties
and change
java.naming.provider.url=jnp://localhost:1099 to java.naming.provider.url=jnp://localhost:11099