@Andy: any objection if we revert it and do the fix I proposed?
Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2014-05-31 14:21 GMT+02:00 Thiago Veronezi <[email protected]>: > Hi guys, > > It looks like cdi-tomee complains about this commit. > > Tests run: 1128, Failures: 1, Errors: 0, Skipped: 1127, Time elapsed: > 189.898 sec <<< FAILURE! - in TestSuite > > beforeSuite(org.jboss.jsr299.tck.tests.implementation.simple.resource.ejb.EjbInjectionTest) > Time elapsed: 185.126 sec <<< FAILURE! > org.apache.openejb.OpenEJBRuntimeException: Could not connect to server > at org.apache.openejb.config.RemoteServer.cmd(RemoteServer.java:348) > at org.apache.openejb.config.RemoteServer.start(RemoteServer.java:144) > at > > org.apache.openejb.tck.impl.ContainersImplTomEE.setup(ContainersImplTomEE.java:159) > at org.jboss.testharness.AbstractTest.beforeSuite(AbstractTest.java:180) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > > I guess it complains about it because the previous revision (r1598528) > works great. > > []s, > Thiago. > > > On Fri, May 30, 2014 at 8:52 AM, Romain Manni-Bucau <[email protected] > > > wrote: > > > Hmm, checking protected Deployer deployer() throws NamingException in > > TomEEContainer we should make retry number configurable in > arquillian.xml I > > think (TomEEConfiguration). Default to 5 with a pause of 200ms doesn't > > sound that good, I'd go for a default duration of 20s with a pause of > > 100ms. Wdyt? > > > > > > > > Romain Manni-Bucau > > Twitter: @rmannibucau > > Blog: http://rmannibucau.wordpress.com/ > > LinkedIn: http://fr.linkedin.com/in/rmannibucau > > Github: https://github.com/rmannibucau > > > > > > 2014-05-30 14:41 GMT+02:00 Romain Manni-Bucau <[email protected]>: > > > > > Hmm > > > > > > actually RemoteServer doesn't need it. I think you see the issue with > > > arquillian mainly and in this case we have a retry mecanism created for > > it > > > in deployer lookup. > > > > > > Isn't it what should have been configured? > > > > > > > > > > > > Romain Manni-Bucau > > > Twitter: @rmannibucau > > > Blog: http://rmannibucau.wordpress.com/ > > > LinkedIn: http://fr.linkedin.com/in/rmannibucau > > > Github: https://github.com/rmannibucau > > > > > > > > > 2014-05-30 14:34 GMT+02:00 Andy Gumbrecht <[email protected]>: > > > > > > Sure Romain, > > >> > > >> The RemoteServer.java does not know what the context is (OpenEJB, > TomEE, > > >> Arquillian) - So what is the service port ? (4201, 8080, ?) - Could > > maybe > > >> work it out internally from properties, but the caller already knows, > > hence > > >> the setter. > > >> If the setter is not used then it defaults to previous action, which > is > > >> to use the self-determined shutdown port. > > >> > > >> The RemoteServer is/was only looking at the shutdown port (OpenEJB, > > >> Tomcat) to determine if the server is running. > > >> > > >> The Tomcat/OpenEJB shutdown port can start to accepts calls before the > > >> actual service port (Several seconds or more on a busy machine like > the > > >> buildbot). > > >> So using it (in RemoteServer) to see if the server is running often > > leads > > >> to an overlap (Port already in use or bind exceptions). > > >> > > >> Giving RemoteServer the service port to monitor for a startup > connection > > >> makes more sense to me, as this is the port required for access and > not > > the > > >> shutdown port. > > >> > > >> Shutdown is less of an issue because the shutdown port goes down after > > >> the service port. > > >> > > >> The changes apply to usages of RemoteServer, where the service port is > > >> known. > > >> > > >> Andy. > > >> > > >> > > >> > > >> On 30/05/2014 14:09, Romain Manni-Bucau wrote: > > >> > > >>> Hi > > >>> > > >>> I'm not sure to get the goal of it. > > >>> > > >>> PortStartup is set as system property where needed (mainly > arquillian) > > >>> but > > >>> doesn't add much value otherwise since it can just be not existing (I > > saw > > >>> several instances with only https or ajp configured) > > >>> > > >>> Can you detail the cause please? > > >>> > > >>> > > >>> > > >>> > > >>> Romain Manni-Bucau > > >>> Twitter: @rmannibucau > > >>> Blog: http://rmannibucau.wordpress.com/ > > >>> LinkedIn: http://fr.linkedin.com/in/rmannibucau > > >>> Github: https://github.com/rmannibucau > > >>> > > >>> > > >>> 2014-05-30 13:50 GMT+02:00 <[email protected]>: > > >>> > > >>> Author: andygumbrecht > > >>>> Date: Fri May 30 11:50:45 2014 > > >>>> New Revision: 1598562 > > >>>> > > >>>> URL: http://svn.apache.org/r1598562 > > >>>> Log: > > >>>> TOMEE-1230 Provide the known server service port to RemoteServer for > > >>>> better startup monitoring. > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-remote/ (props > > >>>> changed) > > >>>> > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/ > > >>>> > main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java > > >>>> > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-webapp- > > >>>> remote/src/main/java/org/apache/tomee/arquillian/ > > >>>> webapp/TomEEWebappContainer.java > > >>>> > > >>>> tomee/tomee/trunk/container/openejb-core/src/main/java/ > > >>>> org/apache/openejb/config/RemoteServer.java > > >>>> > > >>>> tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/ > > >>>> org/apache/openejb/maven/plugin/AbstractTomEEMojo.java > > >>>> > > >>>> tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/ > > >>>> org/apache/openejb/maven/plugin/runner/ExecRunner.java > > >>>> > > >>>> tomee/tomee/trunk/tck/tck-common/src/main/java/org/ > > >>>> apache/openejb/tck/impl/ContainersImplTomEE.java > > >>>> > > >>>> tomee/tomee/trunk/tck/tck-common/src/main/java/org/ > > >>>> apache/openejb/tck/impl/FullRestartContainer.java > > >>>> > > >>>> tomee/tomee/trunk/tomee/apache-tomee/src/main/java/org/apache/tomee/ > > >>>> RemoteTomEEEJBContainer.java > > >>>> > > >>>> Propchange: tomee/tomee/trunk/arquillian/arquillian-tomee-remote/ > > >>>> > > >>>> ------------------------------------------------------------ > > >>>> ------------------ > > >>>> --- svn:ignore (original) > > >>>> +++ svn:ignore Fri May 30 11:50:45 2014 > > >>>> @@ -1,6 +1,8 @@ > > >>>> *.iml > > >>>> .classpath > > >>>> +.idea > > >>>> .project > > >>>> .settings > > >>>> target > > >>>> velocity.* > > >>>> +.idea > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/ > > >>>> > main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java > > >>>> URL: > > >>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/ > > >>>> arquillian-tomee-remote/src/main/java/org/apache/tomee/ > > >>>> arquillian/remote/RemoteTomEEContainer.java?rev= > > >>>> 1598562&r1=1598561&r2=1598562&view=diff > > >>>> > > >>>> ============================================================ > > >>>> ================== > > >>>> --- > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/ > > >>>> > main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java > > >>>> (original) > > >>>> +++ > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-remote/src/ > > >>>> > main/java/org/apache/tomee/arquillian/remote/RemoteTomEEContainer.java > > >>>> Fri May 30 11:50:45 2014 > > >>>> @@ -71,9 +71,11 @@ public class RemoteTomEEContainer extend > > >>>> @Override > > >>>> public void start() throws LifecycleException { > > >>>> // see if TomEE is already running by checking the http > port > > >>>> - if (Setup.isRunning(configuration.getHost(), > > >>>> configuration.getHttpPort())) { > > >>>> + final int httpPort = configuration.getHttpPort(); > > >>>> > > >>>> - logger.info(String.format("TomEE found running on port > > >>>> %s", > > >>>> configuration.getHttpPort())); > > >>>> + if (Setup.isRunning(configuration.getHost(), httpPort)) { > > >>>> + > > >>>> + logger.info(String.format("TomEE found running on port > > >>>> %s", > > >>>> httpPort)); > > >>>> > > >>>> return; > > >>>> } > > >>>> @@ -90,15 +92,18 @@ public class RemoteTomEEContainer extend > > >>>> > > >>>> configure(); > > >>>> > > >>>> - System.setProperty(RemoteServer.SERVER_SHUTDOWN_PORT, > > >>>> Integer.toString(configuration.getStopPort())); > > >>>> + int stopPort = configuration.getStopPort(); > > >>>> + System.setProperty(RemoteServer.SERVER_SHUTDOWN_PORT, > > >>>> Integer.toString(stopPort)); > > >>>> > System.setProperty(RemoteServer.SERVER_SHUTDOWN_COMMAND, > > >>>> configuration.getStopCommand()); > > >>>> System.setProperty(RemoteServer.SERVER_SHUTDOWN_HOST, > > >>>> configuration.getStopHost()); > > >>>> + > > >>>> if (configuration.isDebug()) { > > >>>> > > System.setProperty(RemoteServer.OPENEJB_SERVER_DEBUG, > > >>>> "true"); > > >>>> System.setProperty(RemoteServer.SERVER_DEBUG_PORT, > > >>>> Integer.toString(configuration.getDebugPort())); > > >>>> } > > >>>> - container = new RemoteServer(); > > >>>> > > >>>> + container = new RemoteServer(); > > >>>> + container.setPortStartup(httpPort); > > >>>> container.start(args(), "start", true); > > >>>> container.killOnExit(); > > >>>> > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-webapp- > > >>>> remote/src/main/java/org/apache/tomee/arquillian/ > > >>>> webapp/TomEEWebappContainer.java > > >>>> URL: > > >>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/ > > >>>> arquillian-tomee-webapp-remote/src/main/java/org/ > > >>>> apache/tomee/arquillian/webapp/TomEEWebappContainer. > > >>>> java?rev=1598562&r1=1598561&r2=1598562&view=diff > > >>>> > > >>>> ============================================================ > > >>>> ================== > > >>>> --- > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-webapp- > > >>>> remote/src/main/java/org/apache/tomee/arquillian/ > > >>>> webapp/TomEEWebappContainer.java > > >>>> (original) > > >>>> +++ > > >>>> tomee/tomee/trunk/arquillian/arquillian-tomee-webapp- > > >>>> remote/src/main/java/org/apache/tomee/arquillian/ > > >>>> webapp/TomEEWebappContainer.java > > >>>> Fri May 30 11:50:45 2014 > > >>>> @@ -54,9 +54,10 @@ public class TomEEWebappContainer extend > > >>>> @Override > > >>>> public void start() throws LifecycleException { > > >>>> // see if TomEE is already running by checking the http > port > > >>>> - if (Setup.isRunning(configuration.getHost(), > > >>>> configuration.getHttpPort())) { > > >>>> + int httpPort = configuration.getHttpPort(); > > >>>> + if (Setup.isRunning(configuration.getHost(), httpPort)) { > > >>>> > > >>>> - logger.info(String.format("Tomcat found running on > port > > >>>> %s", > > >>>> configuration.getHttpPort())); > > >>>> + logger.info(String.format("Tomcat found running on > port > > >>>> %s", > > >>>> httpPort)); > > >>>> > > >>>> return; > > >>>> } > > >>>> @@ -141,12 +142,13 @@ public class TomEEWebappContainer extend > > >>>> if (!wereOpenejbHomeSet && > > >>>> configuration.isUseInstallerServlet()) { > > >>>> // instead of calling the Installer, let's just do > > >>>> like > > >>>> users do > > >>>> // call the servlet installer instead > > >>>> - final String baseUrl = "http://" + > > >>>> configuration.getHost() + ":" + configuration.getHttpPort() + > > >>>> "/tomee/installer"; > > >>>> + final String baseUrl = "http://" + > > >>>> configuration.getHost() + ":" + httpPort + "/tomee/installer"; > > >>>> > > >>>> assert installer != null; > > >>>> installer.addTomEEAdminConfInTomcatUsers(true); > > >>>> > > >>>> final RemoteServer tmpContainer = new > > RemoteServer(); > > >>>> + tmpContainer.setPortStartup(httpPort); > > >>>> tmpContainer.start(); > > >>>> > > >>>> final URL url = new URL(baseUrl); > > >>>> @@ -156,7 +158,7 @@ public class TomEEWebappContainer extend > > >>>> final URLConnection uc = url.openConnection(); > > >>>> // dG9tZWU6dG9tZWU= --> Base64 of tomee:tomee > > >>>> final String authorizationString = "Basic > > >>>> dG9tZWU6dG9tZWU="; > > >>>> - uc.setRequestProperty ("Authorization", > > >>>> authorizationString); > > >>>> + uc.setRequestProperty("Authorization", > > >>>> authorizationString); > > >>>> try { > > >>>> final InputStream is = > uc.getInputStream(); > > >>>> org.apache.openejb.loader.IO.slurp(is); > > >>>> @@ -173,6 +175,7 @@ public class TomEEWebappContainer extend > > >>>> } > > >>>> > > >>>> container = new RemoteServer(); > > >>>> + container.setPortStartup(httpPort); > > >>>> > > >>>> > > container.start(Arrays.asList("-Dorg.apache.openejb.servlet.filters=" > > >>>> + > > >>>> ArquillianFilterRunner.class.getName() + "=" + > > >>>> ServletMethodExecutor.ARQUILLIAN_SERVLET_MAPPING), "start", true); > > >>>> container.killOnExit(); > > >>>> } catch (final Exception e) { > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/container/openejb-core/src/main/java/ > > >>>> org/apache/openejb/config/RemoteServer.java > > >>>> URL: > > >>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/container/ > > >>>> openejb-core/src/main/java/org/apache/openejb/config/ > > >>>> RemoteServer.java?rev=1598562&r1=1598561&r2=1598562&view=diff > > >>>> > > >>>> ============================================================ > > >>>> ================== > > >>>> --- > > >>>> tomee/tomee/trunk/container/openejb-core/src/main/java/ > > >>>> org/apache/openejb/config/RemoteServer.java > > >>>> (original) > > >>>> +++ > > >>>> tomee/tomee/trunk/container/openejb-core/src/main/java/ > > >>>> org/apache/openejb/config/RemoteServer.java > > >>>> Fri May 30 11:50:45 2014 > > >>>> @@ -50,6 +50,8 @@ public class RemoteServer { > > >>>> public static final String SERVER_SHUTDOWN_HOST = > > >>>> "server.shutdown.host"; > > >>>> public static final String SERVER_SHUTDOWN_COMMAND = > > >>>> "server.shutdown.command"; > > >>>> public static final String OPENEJB_SERVER_DEBUG = > > >>>> "openejb.server.debug"; > > >>>> + public static final String START = "start"; > > >>>> + public static final String STOP = "stop"; > > >>>> > > >>>> private boolean debug = options.get(OPENEJB_SERVER_DEBUG, > > false); > > >>>> private final boolean profile = options.get("openejb.server. > > >>>> profile", > > >>>> false); > > >>>> @@ -66,10 +68,11 @@ public class RemoteServer { > > >>>> private Process server; > > >>>> private final int tries; > > >>>> private final boolean verbose; > > >>>> - private final int shutdownPort; > > >>>> + private final int portShutdown; > > >>>> private final String host; > > >>>> private final String command; > > >>>> private File home; > > >>>> + private int portStartup; > > >>>> > > >>>> public RemoteServer() { > > >>>> this(options.get("connect.tries", 60), > > options.get("verbose", > > >>>> false)); > > >>>> @@ -81,7 +84,8 @@ public class RemoteServer { > > >>>> home = getHome(); > > >>>> tomcat = (home != null) && (new File(new File(home, > "bin"), > > >>>> "catalina.sh").exists()); > > >>>> > > >>>> - shutdownPort = options.get(SERVER_SHUTDOWN_PORT, tomcat ? > > >>>> 8005 : > > >>>> 4200); > > >>>> + portShutdown = options.get(SERVER_SHUTDOWN_PORT, tomcat ? > > >>>> 8005 : > > >>>> 4200); > > >>>> + portStartup = portShutdown; > > >>>> command = options.get(SERVER_SHUTDOWN_COMMAND, > "SHUTDOWN"); > > >>>> host = options.get(SERVER_SHUTDOWN_HOST, "localhost"); > > >>>> } > > >>>> @@ -97,10 +101,10 @@ public class RemoteServer { > > >>>> } > > >>>> > > >>>> public static void main(final String[] args) { > > >>>> - assert args.length > 0 : "no arguments supplied: valid > > argumen > > >>>> -efts are 'start' or 'stop'"; > > >>>> - if (args[0].equalsIgnoreCase("start")) { > > >>>> + assert args.length > 0 : "no arguments supplied: valid > > >>>> arguments > > >>>> are 'start' or 'stop'"; > > >>>> + if (args[0].equalsIgnoreCase(START)) { > > >>>> new RemoteServer().start(); > > >>>> - } else if (args[0].equalsIgnoreCase("stop")) { > > >>>> + } else if (args[0].equalsIgnoreCase(STOP)) { > > >>>> final RemoteServer remoteServer = new RemoteServer(); > > >>>> remoteServer.serverHasAlreadyBeenStarted = false; > > >>>> remoteServer.stop(); > > >>>> @@ -109,8 +113,16 @@ public class RemoteServer { > > >>>> } > > >>>> } > > >>>> > > >>>> + public int getPortStartup() { > > >>>> + return this.portStartup; > > >>>> + } > > >>>> + > > >>>> + public void setPortStartup(int portStartup) { > > >>>> + this.portStartup = portStartup; > > >>>> + } > > >>>> + > > >>>> public Properties getProperties() { > > >>>> - return properties; > > >>>> + return this.properties; > > >>>> } > > >>>> > > >>>> public void destroy() { > > >>>> @@ -125,7 +137,7 @@ public class RemoteServer { > > >>>> } > > >>>> > > >>>> public void start() { > > >>>> - start(Collections.<String>emptyList(), "start", true); > > >>>> + start(Collections.<String>emptyList(), START, true); > > >>>> } > > >>>> > > >>>> public void start(final List<String> additionalArgs, final > > String > > >>>> cmd, final boolean checkPortAvailable) { > > >>>> @@ -134,9 +146,12 @@ public class RemoteServer { > > >>>> > > >>>> private void cmd(final List<String> additionalArgs, final > String > > >>>> cmd, > > >>>> final boolean checkPortAvailable) { > > >>>> boolean ok = true; > > >>>> + final int port = START.equals(cmd) ? portStartup : > > >>>> portShutdown; > > >>>> + > > >>>> if (checkPortAvailable) { > > >>>> - ok = !connect(); > > >>>> + ok = !connect(port, 1); > > >>>> } > > >>>> + > > >>>> if (ok) { > > >>>> try { > > >>>> if (verbose) { > > >>>> @@ -170,7 +185,7 @@ public class RemoteServer { > > >>>> > > >>>> final String java; > > >>>> final boolean isWindows = System.getProperty(" > > os.name > > >>>> ", > > >>>> "unknown").toLowerCase().startsWith("windows"); > > >>>> - if (isWindows && "start".equals(cmd) && > > >>>> options.get("server.windows.fork", false)) { > > >>>> + if (isWindows && START.equals(cmd) && > > >>>> options.get("server.windows.fork", false)) { > > >>>> // run and forget > > >>>> java = new > File(System.getProperty("java.home"), > > >>>> "bin/javaw").getAbsolutePath(); > > >>>> } else { > > >>>> @@ -298,7 +313,7 @@ public class RemoteServer { > > >>>> } > > >>>> > > >>>> if (cmd == null) { > > >>>> - argsList.add("start"); > > >>>> + argsList.add(START); > > >>>> } else { > > >>>> argsList.add(cmd); > > >>>> } > > >>>> @@ -313,9 +328,9 @@ public class RemoteServer { > > >>>> final Process process = Runtime.getRuntime().exec( > > >>>> args); > > >>>> Pipe.pipeOut(process); // why would we need to > > >>>> redirect > > >>>> System.in to the process, TomEE doesn't use it > > >>>> > > >>>> - if ("start".equals(cmd)) { > > >>>> + if (START.equals(cmd)) { > > >>>> server = process; > > >>>> - } else if ("stop".equals(cmd) && server != null) { > > >>>> + } else if (STOP.equals(cmd) && server != null) { > > >>>> server.waitFor(); > > >>>> } > > >>>> > > >>>> @@ -324,11 +339,12 @@ public class RemoteServer { > > >>>> } > > >>>> if (checkPortAvailable) { > > >>>> if (debug) { > > >>>> - if (!connect(Integer.MAX_VALUE)) { > > >>>> + > > >>>> + if (!connect(port, Integer.MAX_VALUE)) { > > >>>> throw new OpenEJBRuntimeException("Could > not > > >>>> connect to server"); > > >>>> } > > >>>> } else { > > >>>> - if (!connect(tries)) { > > >>>> + if (!connect(port, tries)) { > > >>>> throw new OpenEJBRuntimeException("Could > not > > >>>> connect to server"); > > >>>> } > > >>>> } > > >>>> @@ -443,7 +459,7 @@ public class RemoteServer { > > >>>> if (verbose) { > > >>>> System.out.print("Waiting for TomEE shutdown."); > > >>>> } > > >>>> - while (connect()) { > > >>>> + while (connect(portShutdown, tries)) { > > >>>> Thread.sleep(1000); > > >>>> if (verbose) { > > >>>> System.out.print("."); > > >>>> @@ -459,7 +475,7 @@ public class RemoteServer { > > >>>> Socket socket = null; > > >>>> OutputStream stream = null; > > >>>> try { > > >>>> - socket = new Socket(host, shutdownPort); > > >>>> + socket = new Socket(host, portShutdown); > > >>>> stream = socket.getOutputStream(); > > >>>> final String shutdown = command + > > >>>> Character.toString((char) > > >>>> 0); > > >>>> for (int i = 0; i < shutdown.length(); i++) { > > >>>> @@ -478,11 +494,7 @@ public class RemoteServer { > > >>>> } > > >>>> } > > >>>> > > >>>> - private boolean connect() { > > >>>> - return connect(1); > > >>>> - } > > >>>> - > > >>>> - private boolean connect(int tries) { > > >>>> + private boolean connect(final int port, int tries) { > > >>>> if (verbose) { > > >>>> System.out.println("[] CONNECT ATTEMPT " + > (this.tries - > > >>>> tries)); > > >>>> } > > >>>> @@ -490,7 +502,7 @@ public class RemoteServer { > > >>>> Socket s = null; > > >>>> try { > > >>>> s = new Socket(); > > >>>> - s.connect(new InetSocketAddress(host, shutdownPort), > > 1000); > > >>>> + s.connect(new InetSocketAddress(this.host, port), > 1000); > > >>>> s.getOutputStream().close(); > > >>>> if (verbose) { > > >>>> System.out.println("[] CONNECTED IN " + > (this.tries > > - > > >>>> tries)); > > >>>> @@ -507,7 +519,7 @@ public class RemoteServer { > > >>>> } catch (final Exception e2) { > > >>>> e.printStackTrace(); > > >>>> } > > >>>> - return connect(--tries); > > >>>> + return connect(port, --tries); > > >>>> } > > >>>> } finally { > > >>>> if (s != null) { > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/ > > >>>> org/apache/openejb/maven/plugin/AbstractTomEEMojo.java > > >>>> URL: > > >>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/maven/tomee- > > >>>> maven-plugin/src/main/java/org/apache/openejb/maven/ > > >>>> plugin/AbstractTomEEMojo.java?rev=1598562&r1=1598561&r2= > > >>>> 1598562&view=diff > > >>>> > > >>>> ============================================================ > > >>>> ================== > > >>>> --- > > >>>> tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/ > > >>>> org/apache/openejb/maven/plugin/AbstractTomEEMojo.java > > >>>> (original) > > >>>> +++ > > >>>> tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/ > > >>>> org/apache/openejb/maven/plugin/AbstractTomEEMojo.java > > >>>> Fri May 30 11:50:45 2014 > > >>>> @@ -81,6 +81,7 @@ public abstract class AbstractTomEEMojo > > >>>> private static final String REMOVE_PREFIX = "remove:"; > > >>>> public static final String QUIT_CMD = "quit"; > > >>>> public static final String EXIT_CMD = "exit"; > > >>>> + public static final String TOM_EE = "TomEE"; > > >>>> > > >>>> @Component > > >>>> protected ArtifactFactory factory; > > >>>> @@ -258,7 +259,7 @@ public abstract class AbstractTomEEMojo > > >>>> > > >>>> protected File deployedFile = null; > > >>>> protected RemoteServer server = null; > > >>>> - protected String container = "TomEE"; > > >>>> + protected String container = TOM_EE; > > >>>> > > >>>> @Override > > >>>> public void execute() throws MojoExecutionException, > > >>>> MojoFailureException { > > >>>> @@ -711,7 +712,10 @@ public abstract class AbstractTomEEMojo > > >>>> > > >>>> addShutdownHooks(server); // some shutdown hooks are > always > > >>>> added > > >>>> (see UpdatableTomEEMojo) > > >>>> > > >>>> - if ("TomEE".equals(container)) { > > >>>> + if (TOM_EE.equals(container)) { > > >>>> + > > >>>> + server.setPortStartup(tomeeHttpPort); > > >>>> + > > >>>> getLog().info("Running '" + > > >>>> getClass().getSimpleName().replace("TomEEMojo", > > >>>> "").toLowerCase(Locale.ENGLISH) > > >>>> + "'. Configured TomEE in plugin is " + tomeeHost > + > > >>>> ":" + > > >>>> tomeeHttpPort > > >>>> + " (plugin shutdown port is " + > tomeeShutdownPort + > > >>>> ")"); > > >>>> @@ -998,7 +1002,7 @@ public abstract class AbstractTomEEMojo > > >>>> > > >>>> File file = new File(catalinaBase, "conf/tomee.xml"); > > >>>> if (file.exists()) { > > >>>> - container = "TomEE"; > > >>>> + container = TOM_EE; > > >>>> } else { > > >>>> container = "OpenEJB"; > > >>>> file = new File(catalinaBase, "conf/openejb.xml"); > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/ > > >>>> org/apache/openejb/maven/plugin/runner/ExecRunner.java > > >>>> URL: > > >>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/maven/tomee- > > >>>> maven-plugin/src/main/java/org/apache/openejb/maven/ > > >>>> plugin/runner/ExecRunner.java?rev=1598562&r1=1598561&r2= > > >>>> 1598562&view=diff > > >>>> > > >>>> ============================================================ > > >>>> ================== > > >>>> --- > > >>>> tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/ > > >>>> org/apache/openejb/maven/plugin/runner/ExecRunner.java > > >>>> (original) > > >>>> +++ > > >>>> tomee/tomee/trunk/maven/tomee-maven-plugin/src/main/java/ > > >>>> org/apache/openejb/maven/plugin/runner/ExecRunner.java > > >>>> Fri May 30 11:50:45 2014 > > >>>> @@ -28,6 +28,7 @@ import java.io.InputStream; > > >>>> import java.io.InputStreamReader; > > >>>> import java.util.ArrayList; > > >>>> import java.util.Collection; > > >>>> +import java.util.Collections; > > >>>> import java.util.LinkedList; > > >>>> import java.util.List; > > >>>> import java.util.Locale; > > >>>> @@ -83,7 +84,9 @@ public class ExecRunner { > > >>>> if (scripts != null) { // dont use filefilter to avoid > > >>>> dependency > > >>>> issue > > >>>> for (final File f : scripts) { > > >>>> if (f.getName().endsWith(".sh") && > !f.canExecute()) > > { > > >>>> - f.setExecutable(true, true); > > >>>> + if(!f.setExecutable(true, true)){ > > >>>> + System.err.println("Failed make file > > >>>> executable: > > >>>> " + f); > > >>>> + } > > >>>> } > > >>>> } > > >>>> } > > >>>> @@ -101,7 +104,9 @@ public class ExecRunner { > > >>>> throw new IllegalArgumentException("Can't find > > >>>> " + > > >>>> cmd); > > >>>> } > > >>>> if (cmd.endsWith(".sh")) { > > >>>> - scriptFile.setExecutable(true); > > >>>> + if(!scriptFile.setExecutable(true)){ > > >>>> + System.err.println("Failed make script file > > >>>> executable: " + scriptFile); > > >>>> + } > > >>>> } > > >>>> } > > >>>> } > > >>>> @@ -117,15 +122,15 @@ public class ExecRunner { > > >>>> System.setProperty("server.shutdown.command", > > >>>> config.getProperty("shutdownCommand")); > > >>>> > > >>>> final RemoteServer server = new RemoteServer(); > > >>>> + server.setPortStartup(Integer.parseInt(parser.http())); > > >>>> + > > >>>> if (config.containsKey("additionalClasspath")) { > > >>>> > > >>>> server.setAdditionalClasspath(config.getProperty(" > > >>>> additionalClasspath")); > > >>>> } > > >>>> > > >>>> final List<String> jvmArgs = new LinkedList<String>(); > > >>>> if (additionalArgs != null) { > > >>>> - for (final String kv : additionalArgs.split(" ")) { > > >>>> - jvmArgs.add(kv); > > >>>> - } > > >>>> + Collections.addAll(jvmArgs, additionalArgs.split(" > > ")); > > >>>> } > > >>>> for (final String k : config.stringPropertyNames()) { > > >>>> if (k.startsWith("jvmArg.")) { > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/tck/tck-common/src/main/java/org/ > > >>>> apache/openejb/tck/impl/ContainersImplTomEE.java > > >>>> URL: > > >>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/tck/tck- > > >>>> common/src/main/java/org/apache/openejb/tck/impl/ > > >>>> ContainersImplTomEE.java?rev=1598562&r1=1598561&r2=1598562&view=diff > > >>>> > > >>>> ============================================================ > > >>>> ================== > > >>>> --- > > >>>> tomee/tomee/trunk/tck/tck-common/src/main/java/org/ > > >>>> apache/openejb/tck/impl/ContainersImplTomEE.java > > >>>> (original) > > >>>> +++ > > >>>> tomee/tomee/trunk/tck/tck-common/src/main/java/org/ > > >>>> apache/openejb/tck/impl/ContainersImplTomEE.java > > >>>> Fri May 30 11:50:45 2014 > > >>>> @@ -32,7 +32,6 @@ import java.io.File; > > >>>> import java.io.IOException; > > >>>> import java.io.InputStream; > > >>>> import java.util.Arrays; > > >>>> -import java.util.Collections; > > >>>> import java.util.Properties; > > >>>> > > >>>> /** > > >>>> @@ -45,6 +44,7 @@ public class ContainersImplTomEE extends > > >>>> private Exception exception; > > >>>> private AppInfo appInfo; > > >>>> private File currentFile = null; > > >>>> + private int port = 8080; > > >>>> > > >>>> private Deployer lookup() { > > >>>> final Options options = new > Options(System.getProperties()); > > >>>> @@ -53,8 +53,9 @@ public class ContainersImplTomEE extends > > >>>> String port = System.getProperty("server.http.port"); > > >>>> if (port != null) { > > >>>> props.put(Context.PROVIDER_URL, > > >>>> options.get(Context.PROVIDER_URL,"http://localhost:" + port + > > >>>> "/tomee/ejb")); > > >>>> + this.port = Integer.parseInt(port); > > >>>> } else { > > >>>> - throw new OpenEJBTCKRuntimeException("Please set the > > tomee > > >>>> port as a system property"); > > >>>> + throw new OpenEJBTCKRuntimeException("Please set the > > tomee > > >>>> port using the system property 'server.http.port'"); > > >>>> } > > >>>> > > >>>> final String deployerJndi = > > >>>> System.getProperty("openejb.deployer.jndiname", > > >>>> "openejb/DeployerBusinessRemote"); > > >>>> @@ -70,6 +71,7 @@ public class ContainersImplTomEE extends > > >>>> System.out.println("ContainersImpl=" + > > >>>> ContainersImplTomEE.class.getName()); > > >>>> System.out.println("Initialized ContainersImplTomEE " + > > >>>> (++count)); > > >>>> server = new RemoteServer(); > > >>>> + server.setPortStartup(this.port); > > >>>> } > > >>>> @Override > > >>>> public boolean deploy(InputStream archive, String name) throws > > >>>> IOException { > > >>>> @@ -143,8 +145,10 @@ public class ContainersImplTomEE extends > > >>>> } > > >>>> > > >>>> protected File getFile(String name) { > > >>>> - final File dir = new File(tmpDir, Math.random()+""); > > >>>> - dir.mkdir(); > > >>>> + final File dir = new File(tmpDir, Math.random() + ""); > > >>>> + if (!dir.exists() && !dir.mkdir()) { > > >>>> + throw new RuntimeException("Failed to create directory: > > " + > > >>>> dir); > > >>>> + } > > >>>> dir.deleteOnExit(); > > >>>> return new File(dir, name); > > >>>> } > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/tck/tck-common/src/main/java/org/ > > >>>> apache/openejb/tck/impl/FullRestartContainer.java > > >>>> URL: > > >>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/tck/tck- > > >>>> common/src/main/java/org/apache/openejb/tck/impl/ > > >>>> > FullRestartContainer.java?rev=1598562&r1=1598561&r2=1598562&view=diff > > >>>> > > >>>> ============================================================ > > >>>> ================== > > >>>> --- > > >>>> tomee/tomee/trunk/tck/tck-common/src/main/java/org/ > > >>>> apache/openejb/tck/impl/FullRestartContainer.java > > >>>> (original) > > >>>> +++ > > >>>> tomee/tomee/trunk/tck/tck-common/src/main/java/org/ > > >>>> apache/openejb/tck/impl/FullRestartContainer.java > > >>>> Fri May 30 11:50:45 2014 > > >>>> @@ -71,7 +71,14 @@ public class FullRestartContainer extend > > >>>> System.out.println(currentFile); > > >>>> writeToFile(currentFile, archive); > > >>>> > > >>>> - server = new RemoteServer(100, true); > > >>>> + String port = System.getProperty("server.http.port"); > > >>>> + if (port != null) { > > >>>> + server = new RemoteServer(100, true); > > >>>> + server.setPortStartup(Integer.parseInt(port)); > > >>>> + } else { > > >>>> + throw new OpenEJBTCKRuntimeException("Please set the > > tomee > > >>>> port using the system property 'server.http.port'"); > > >>>> + } > > >>>> + > > >>>> try { > > >>>> server.start(); > > >>>> } catch (RuntimeException e) { > > >>>> @@ -84,7 +91,11 @@ public class FullRestartContainer extend > > >>>> > > >>>> @Override > > >>>> public void undeploy(String name) throws IOException { > > >>>> - server.destroy(); > > >>>> + > > >>>> + if (null != server) { > > >>>> + server.destroy(); > > >>>> + } > > >>>> + > > >>>> File folder = new File(currentFile.getParentFile(), > > >>>> currentFile.getName().substring(0, currentFile.getName().length() - > > >>>> 4)); > > >>>> if (folder.exists()) { > > >>>> delete(folder); > > >>>> @@ -109,9 +120,9 @@ public class FullRestartContainer extend > > >>>> String port = System.getProperty("server.http.port"); > > >>>> if (port != null) { > > >>>> System.out.println("provider url = " + " > > http://localhost:" > > >>>> + > > >>>> port + "/tomee/ejb"); > > >>>> - props.put(Context.PROVIDER_URL, > > >>>> options.get(Context.PROVIDER_URL,"http://localhost:" + port + > > >>>> "/tomee/ejb")); > > >>>> + props.put(Context.PROVIDER_URL, > > >>>> options.get(Context.PROVIDER_URL, "http://localhost:" + port + > > >>>> "/tomee/ejb")); > > >>>> } else { > > >>>> - throw new OpenEJBTCKRuntimeException("Please set the > > tomee > > >>>> port as a system property"); > > >>>> + throw new OpenEJBTCKRuntimeException("Please set the > > tomee > > >>>> port using the system property 'server.http.port'"); > > >>>> } > > >>>> > > >>>> try { > > >>>> > > >>>> Modified: > > >>>> tomee/tomee/trunk/tomee/apache-tomee/src/main/java/org/apache/tomee/ > > >>>> RemoteTomEEEJBContainer.java > > >>>> URL: > > >>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/ > > >>>> apache-tomee/src/main/java/org/apache/tomee/ > > >>>> RemoteTomEEEJBContainer.java?rev=1598562&r1=1598561&r2= > > >>>> 1598562&view=diff > > >>>> > > >>>> ============================================================ > > >>>> ================== > > >>>> --- > > >>>> tomee/tomee/trunk/tomee/apache-tomee/src/main/java/org/apache/tomee/ > > >>>> RemoteTomEEEJBContainer.java > > >>>> (original) > > >>>> +++ > > >>>> tomee/tomee/trunk/tomee/apache-tomee/src/main/java/org/apache/tomee/ > > >>>> RemoteTomEEEJBContainer.java > > >>>> Fri May 30 11:50:45 2014 > > >>>> @@ -92,6 +92,7 @@ public class RemoteTomEEEJBContainer ext > > >>>> try { > > >>>> instance = new RemoteTomEEEJBContainer(); > > >>>> instance.container = new RemoteServer(); > > >>>> + > > >>>> > instance.container.setPortStartup(Integer.parseInt(parser.http())); > > >>>> instance.container.start(); > > >>>> instance.context = new InitialContext(new > > >>>> Properties() {{ > > >>>> setProperty(Context.INITIAL_CONTEXT_FACTORY, > > >>>> RemoteInitialContextFactory.class.getName()); > > >>>> > > >>>> > > >>>> > > >>>> > > >> -- > > >> Andy Gumbrecht > > >> > > >> http://www.tomitribe.com > > >> [email protected] > > >> https://twitter.com/AndyGeeDe > > >> > > >> TomEE treibt Tomitribe! | http://tomee.apache.org > > >> > > >> > > > > > >
