Q: Cargo:ContainerException: Server port 8080 did not shutdown within the timeout period on JBoss EAP 5.1 On JBoss EAP 5.1 I cann't stop the container.
When I excute the container.stop, the port status is like this:
 TCP    127.0.0.1:2927         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2928         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2929         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2930         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2931         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2932         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2933         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2934         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2935         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2936         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2937         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2938         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2939         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2940         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2941         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2942         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2943         127.0.0.1:8080         TIME_WAIT
 TCP    127.0.0.1:2944         127.0.0.1:8080         TIME_WAIT

and have the following exception :
Caused by: org.codehaus.cargo.container.ContainerException: Server port 8080 did not shutdown within the timeout period [120000]
    at org.codehaus.cargo.container.spi.AbstractLocalContainer.waitForPortShutdown(AbstractLocalContainer.java:390)
    at org.codehaus.cargo.container.spi.AbstractLocalContainer.waitForPortShutdown(AbstractLocalContainer.java:301)
    at org.codehaus.cargo.container.jboss.internal.AbstractJBossInstalledLocalContainer.waitForCompletion(AbstractJBossInstalledLocalContainer.java:154)
    at org.codehaus.cargo.container.spi.AbstractLocalContainer.stop(AbstractLocalContainer.java:214)
    ... 33 more
org.codehaus.cargo.container.ContainerException: Server port 8080 did not shutdown within the timeout period [120000]
    at org.codehaus.cargo.container.spi.AbstractLocalContainer.waitForPortShutdown(AbstractLocalContainer.java:390)
    at org.codehaus.cargo.container.spi.AbstractLocalContainer.waitForPortShutdown(AbstractLocalContainer.java:301)
    at org.codehaus.cargo.container.jboss.internal.AbstractJBossInstalledLocalContainer.waitForCompletion(AbstractJBossInstalledLocalContainer.java:154)
    at org.codehaus.cargo.container.spi.AbstractLocalContainer.stop(AbstractLocalContainer.java:214)
    at jp.co.nri.kinshasa.util.server.JBossServerImpl.stopContainer(JBossServerImpl.java:151)

MY code is like that I use the JBoss51xInstalledLocalContainer:
    private void prepareJBoss() {
        ConfigurationFactory configurationFactory = new DefaultConfigurationFactory();

        localConfiguration = (StandaloneLocalConfiguration) configurationFactory
                .createConfiguration("jboss51x", ContainerType.INSTALLED,
                        ConfigurationType.STANDALONE, WORK_HOME);

        localConfiguration.setProperty(JBossPropertySet.JBOSS_USER, "admin");
        localConfiguration
                .setProperty(JBossPropertySet.JBOSS_PASSWORD, "admin");
        localConfiguration.setProperty(GeneralPropertySet.JVMARGS,
                "-Xms512m -Xmx512m");
    }


    private void startContainer() {
        container = new JBoss51xInstalledLocalContainer(localConfiguration);
        container.setHome(JBOSS_HOME);
        container.setExtraClasspath(new String[] {
                PROJECT_PATH + "/target/external/kss/apl_conf",
                PROJECT_PATH + "/target/external/kss/kiban_conf" });
        container.start();

    }


A: If you shutdown you need to have your environment right.
You use shutdown --server=localhost:1099 --user=admin --password=admin to shutdown the server.
But in you Environment you forgot to enter the admin user in /conf/props/jmx-console-users.properties
