Details
Description
The motivating use case: I would like to use Cargo to start containers from Eclipse. More importantly, I would like to attach the Eclipse debugger to the container/server JVM started by Cargo, to debug the servlets being deployed there. Technically, this boils down to use IVMRunner from the Eclipse JDT APIs. However, the JVM launching code in Cargo is currently hard-wired to use Ant's Java task.
In essence, the attached patch introduces the interface org.codehaus.cargo.container.spi.jvm.JvmLauncher. This interface is basically an abstraction of Ant's java task, allowing to provide alternative implementations (like the one from Eclipse). Subclasses of SpawnedContainer provide a setter that allows the client code to set the desired factory for the JvmLauncher instances being used. By default, a factory wrapping the Ant java task is used.
It's worth to note that Cargo forks JVMs for various tasks: starting a server, stopping it, pinging it, deploying into it, etc. For my case, I only want to provide a custom JvmLauncher when starting the server but stick with the Ant/default impl for all other JVMs. To enable this decision making, the JvmLauncherFactory is provided with a boolean to indicate whether a server JVM or some other client/utility JVM is launched. Instead of a boolean, an enum could have been used to denote the purpose of the launched JVM but I didn't see concrete use cases for such a fine-grained distinction so I went with the simple boolean.
This abstraction constitues a breaking change to the container SPI (which I hope is worth for Cargo 1.1) and the bulk of the changes in the patch deal with adjusting the existing container impls to the new SPI.
AFAICT, AntContainerExecutorThread is now only used from one package. If wanted, this class could be moved and even made package-private.
-
Hide
- all-jboss.zip
- 02/Mar/11 5:40 PM
- 71 kB
- Benjamin Bentmann
-
- surefire-reports/org.codehaus.cargo.sample.java.AllLocalContainerTest.txt 1 kB
- surefire-reports/org.codehaus.cargo.sample.java.BundleCapabilityContainerTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.DataSourceOnStandaloneConfigurationTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.EarCapabilityContainerTest.txt 2 kB
- surefire-reports/org.codehaus.cargo.sample.java.ExistingConfigurationTest.txt 2 kB
- surefire-reports/org.codehaus.cargo.sample.java.ExtraClasspathOnStandaloneConfigurationTest.txt 1 kB
- surefire-reports/org.codehaus.cargo.sample.java.jboss.EjbCapabilityContainerTest.txt 1 kB
- surefire-reports/org.codehaus.cargo.sample.java.RemoteDeploymentTest.txt 49 kB
- surefire-reports/org.codehaus.cargo.sample.java.ResourceOnStandaloneConfigurationTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.tomcat.TomcatPackagerTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.tomcat.TomcatWarTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.TransactionEmulationDataSourceOnStandaloneConfigurationTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.WarAndDeployerCapabilityContainerTest.txt 1 kB
- surefire-reports/org.codehaus.cargo.sample.java.WarAuthenticationTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.WarCapabilityContainerTest.txt 3 kB
- surefire-reports/org.codehaus.cargo.sample.java.XATransactionDataSourceOnStandaloneConfigurationTest.txt 0.3 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.AllLocalContainerTest.xml 16 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.BundleCapabilityContainerTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.DataSourceOnStandaloneConfigurationTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.EarCapabilityContainerTest.xml 17 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.ExistingConfigurationTest.xml 17 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.ExtraClasspathOnStandaloneConfigurationTest.xml 16 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.jboss.EjbCapabilityContainerTest.xml 16 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.RemoteDeploymentTest.xml 63 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.ResourceOnStandaloneConfigurationTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.tomcat.TomcatPackagerTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.tomcat.TomcatWarTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.TransactionEmulationDataSourceOnStandaloneConfigurationTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.WarAndDeployerCapabilityContainerTest.xml 16 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.WarAuthenticationTest.xml 15 kB
-
Hide
- all-tomcat.zip
- 02/Mar/11 5:40 PM
- 62 kB
- Benjamin Bentmann
-
- surefire-reports/org.codehaus.cargo.sample.java.AllLocalContainerTest.txt 0.9 kB
- surefire-reports/org.codehaus.cargo.sample.java.BundleCapabilityContainerTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.DataSourceOnStandaloneConfigurationTest.txt 5 kB
- surefire-reports/org.codehaus.cargo.sample.java.EarCapabilityContainerTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.ExistingConfigurationTest.txt 2 kB
- surefire-reports/org.codehaus.cargo.sample.java.ExtraClasspathOnStandaloneConfigurationTest.txt 0.9 kB
- surefire-reports/org.codehaus.cargo.sample.java.jboss.EjbCapabilityContainerTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.RemoteDeploymentTest.txt 0.8 kB
- surefire-reports/org.codehaus.cargo.sample.java.ResourceOnStandaloneConfigurationTest.txt 4 kB
- surefire-reports/org.codehaus.cargo.sample.java.tomcat.TomcatPackagerTest.txt 0.8 kB
- surefire-reports/org.codehaus.cargo.sample.java.tomcat.TomcatWarTest.txt 1 kB
- surefire-reports/org.codehaus.cargo.sample.java.TransactionEmulationDataSourceOnStandaloneConfigurationTest.txt 0.3 kB
- surefire-reports/org.codehaus.cargo.sample.java.WarAndDeployerCapabilityContainerTest.txt 1.0 kB
- surefire-reports/org.codehaus.cargo.sample.java.WarAuthenticationTest.txt 0.9 kB
- surefire-reports/org.codehaus.cargo.sample.java.WarCapabilityContainerTest.txt 5 kB
- surefire-reports/org.codehaus.cargo.sample.java.XATransactionDataSourceOnStandaloneConfigurationTest.txt 0.3 kB
- surefire-reports/output.log 4 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.AllLocalContainerTest.xml 17 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.BundleCapabilityContainerTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.DataSourceOnStandaloneConfigurationTest.xml 19 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.EarCapabilityContainerTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.ExistingConfigurationTest.xml 18 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.ExtraClasspathOnStandaloneConfigurationTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.jboss.EjbCapabilityContainerTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.RemoteDeploymentTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.ResourceOnStandaloneConfigurationTest.xml 19 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.tomcat.TomcatPackagerTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.tomcat.TomcatWarTest.xml 17 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.TransactionEmulationDataSourceOnStandaloneConfigurationTest.xml 15 kB
- surefire-reports/TEST-org.codehaus.cargo.sample.java.WarAndDeployerCapabilityContainerTest.xml 17 kB
-
- jvm-launcher.patch
- 04/Mar/11 7:59 AM
- 186 kB
- Benjamin Bentmann
Activity
Hi Benjamin
This patch looks pretty massive, which container do you test with?
Thank you
So far, I have only been able to successfully run the sample ITs for jo, jonas, jetty, geronimo and resin. For other containers like glassfish, jboss and tomcat I get failures even with plain cargo trunk which I hadn't had the time/motivation to look further into.
What kind of failures are you having on which container?
glassfish2x requires to be installed manually first, and I know tomcat4x is "randomly stable" (that's because we run it on a too new JVM I guess).
I managed to get a good glassfish run on trunk, jboss and tomcat fails with the attached errors.
Updated patch, the refactoring broke AbstractGlassFishInstalledLocalContainer.invokeAsAdmin() to not use the configured JAVA_HOME when forking the command.
On a related page, there are four other invocations of createAntTask("java") in the original code (Geronimo, Jonas) that don't obey the configured java home property AFAICT. But that's something for a future refactoring.
I've taken a closer look in your logs at what is failing:
- On Tomcat, only Tomcat 4.x is failing and that probably is our "random" issues. I think this can be ignored.
- On JBoss, the remote deployer for 5.1.x and 6.x is failing with a NPE. Did you change any JBossDeployer class?
The test failures were all generated with Cargo trunk, i.e. without my patch to try and get a baseline.
It's probably not really worth/interesting, to figure out the reasons for my test failures. What matters is actually whether my patch breaks things. So if you have a good baseline and observe new/unexpected test failures after applying my patch, please let me know what fails such that I can review the relevant refactoring of the container.
Looks good to me ... ![]()
Hopefully, all tests and checkstyle and everything are passing aren't they?
Revised patch, missed some ITs before. Might still have to revise later, I have troubles running some of the container ITs.