This content has been marked as final.
Show 24 replies
-
15. Re: EJBTHREE-1396 MockServer must report startup / shutdown
jaikiran Nov 24, 2008 12:55 AM (in response to jaikiran)The only difference i see between my setup and the Hudson build setup is that i am on Windows and the build is on a Unix system. I will rollback the changes, till i understand why its failing there.
-
16. Re: EJBTHREE-1396 MockServer must report startup / shutdown
jaikiran Nov 24, 2008 1:10 AM (in response to jaikiran)"jaikiran" wrote:
I will rollback the changes, till i understand why its failing there.
Andrew's already done that. Let me see if i can find a Unix system to debug this. -
17. Re: EJBTHREE-1396 MockServer must report startup / shutdown
jaikiran Nov 24, 2008 1:12 AM (in response to jaikiran)And yes, sorry about the build failure, hadn't expected it to fail!
-
18. Re: EJBTHREE-1396 MockServer must report startup / shutdown
alrubinger Nov 24, 2008 1:26 AM (in response to jaikiran)If you've got a platform-specific problem here, I'll be happy to look into it. Just let me know.
S,
ALR -
19. Re: EJBTHREE-1396 MockServer must report startup / shutdown
jaikiran Nov 24, 2008 1:49 AM (in response to jaikiran)I just did a clean install of the entire project including my r81462 changes. The test case is passing on my setup:
------------------------------------------------------------------------------- Test set: org.jboss.ejb3.test.proxy.remoteaccess.unit.RemoteAccessTestCase ------------------------------------------------------------------------------- Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.563 sec
12:06:19,823 INFO [RedirectClassloader] Replacing request for jndi.properties with jndi-remote.properties 12:06:19,917 DEBUG [MockServerController] Remote Process working directory: D:\JBoss\CleanEJB3\proxy 12:06:19,917 INFO [MockServerController] Launching in separate process: C:\jdk1.5.0_10\bin\java -cp "D:\JBoss\CleanEJB3\proxy\target\classes;D:\JBoss\CleanEJB3\proxy\target\tests-classes;D:\JBoss\CleanEJB3\proxy\conf;C:\Documents and Settings\jaikiran_pai\.m2\repository\apache-log4j\log4j\1.2.14\log4j-1.2.14.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\apache-xerces\xercesImpl\2.9.1\xercesImpl-2.9.1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\apache-xerces\xml-apis\2.9.1\xml-apis-2.9.1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\javassist\javassist\3.8.0.GA\javassist-3.8.0.GA.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\javax\activation\activation\1.0.2\activation-1.0.2.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\javax\security\jacc\1.0\jacc-1.0.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\javax\xml\bind\jaxb-api\2.1\jaxb-api-2.1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\jboss\jboss-serialization\1.0.3.GA\jboss-serialization-1.0.3.GA.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\jboss\jbossws\jboss-jaxrpc\1.0.4.GA\jboss-jaxrpc-1.0.4.GA.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\junit\junit\4.4\junit-4.4.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\apache\ant\ant\1.7.0\ant-1.7.0.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\jboss-common-core\2.2.5.GA\jboss-common-core-2.2.5.GA.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\jboss-jaxws\2.0.1.GA\jboss-jaxws-2.0.1.GA.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\jboss-mdr\2.0.0.Beta17\jboss-mdr-2.0.0.Beta17.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\jboss-reflect\2.0.0.Beta13\jboss-reflect-2.0.0.Beta13.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\jboss-transaction-spi\5.0.0.Beta4\jboss-transaction-spi-5.0.0.Beta4.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\jboss-vfs\2.0.0.Beta18\jboss-vfs-2.0.0.Beta18.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\jbossxb\2.0.0.CR12\jbossxb-2.0.0.CR12.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\aop\jboss-aop\2.0.0.CR15\jboss-aop-2.0.0.CR15.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\aspects\jboss-current-invocation-aspects\1.0.0.CR1\jboss-current-invocation-aspects-1.0.0.CR1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\aspects\jboss-remoting-aspects\1.0.1.CR3\jboss-remoting-aspects-1.0.1.CR3.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\aspects\jboss-security-aspects\1.0.0.Beta1\jboss-security-aspects-1.0.0.Beta1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\aspects\jboss-transaction-aspects\1.0.0.Beta1\jboss-transaction-aspects-1.0.0.Beta1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\ejb3\jboss-ejb3-common\0.1.5\jboss-ejb3-common-0.1.5.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\ejb3\jboss-ejb3-ext-api\0.4\jboss-ejb3-ext-api-0.4.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\ejb3\jboss-ejb3-interceptors\0.13.3\jboss-ejb3-interceptors-0.13.3.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\ejb3\jboss-ejb3-metadata\0.12.2\jboss-ejb3-metadata-0.12.2.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\ejb3\jboss-ejb3-test\1.0.0-Beta1\jboss-ejb3-test-1.0.0-Beta1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\javaee\jboss-ejb-api\3.0.0.CR1\jboss-ejb-api-3.0.0.CR1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\javaee\jboss-jaspi-api\1.0.0.CR1\jboss-jaspi-api-1.0.0.CR1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\javaee\jboss-jca-api\1.5.0.CR1\jboss-jca-api-1.5.0.CR1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\javaee\jboss-jms-api\1.1.0.CR1\jboss-jms-api-1.1.0.CR1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\javaee\jboss-persistence-api\3.0.0.CR1\jboss-persistence-api-3.0.0.CR1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\javaee\jboss-transaction-api\1.0.1.CR1\jboss-transaction-api-1.0.1.CR1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\logging\jboss-logging-log4j\2.0.5.GA\jboss-logging-log4j-2.0.5.GA.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\logging\jboss-logging-spi\2.0.5.GA\jboss-logging-spi-2.0.5.GA.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\metadata\jboss-metadata\1.0.0.Beta37\jboss-metadata-1.0.0.Beta37.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\microcontainer\jboss-dependency\2.0.0.Beta17\jboss-dependency-2.0.0.Beta17.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\microcontainer\jboss-kernel\2.0.0.Beta17\jboss-kernel-2.0.0.Beta17.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\naming\jnpserver\5.0.0.CR1\jnpserver-5.0.0.CR1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\remoting\jboss-remoting\2.4.0.CR2\jboss-remoting-2.4.0.CR2.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\security\jboss-security-spi\2.0.2.Beta5\jboss-security-spi-2.0.2.Beta5.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\security\jbosssx-client\2.0.2.Beta5\jbosssx-client-2.0.2.Beta5.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\org\jboss\ws\jbossws-spi\1.0.3.GA\jbossws-spi-1.0.3.GA.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\oswego-concurrent\concurrent\1.3.4-jboss-update1\concurrent-1.3.4-jboss-update1.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\qdox\qdox\1.6\qdox-1.6.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\trove\trove\1.0.2\trove-1.0.2.jar;C:\Documents and Settings\jaikiran_pai\.m2\repository\wutka-dtdparser\dtdparser121\1.2.1\dtdparser121-1.2.1.jar" -ea org.jboss.ejb3.test.proxy.remoteaccess.MockServer org.jboss.ejb3.test.proxy.remoteaccess.unit.RemoteAccessTestCase localhost 12345 12:06:19,917 INFO [MockServerController] Remote process = java.lang.ProcessImpl@3901c6 12:06:21,151 INFO [MockServerInvocationHandler] Received request: START 12:06:21,182 DEBUG [EmbeddedTestMcBootstrap] Starting org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap@1174b07... 12:06:21,448 INFO [EmbeddedTestMcBootstrap] Started: org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap@1174b07 12:06:21,464 DEBUG [Ejb3McRegistrar] Created Ejb3McRegistrar with backing Kernel: org.jboss.kernel.Kernel@1808199 ..... 12:06:23,948 INFO [MockServer] MockServer started 12:06:23,948 DEBUG [MockServerInvocationHandler] Server in STARTED state 12:06:23,948 INFO [MockServerController] Server started. Status = STARTED 12:06:23,948 INFO [RemoteAccessTestCase] MockServer started in 4063 milli sec.
I suspect that on the Hudson setup, the MockServer is failing to start, maybe some port/socket connection related exception in the remote process, which ultimately results in the failure of the (client) test case.
If you've got a platform-specific problem here, I'll be happy to look into it. Just let me know.
That would be great. I think we would have to attach a debugger with a breakpoint in the MockServer constructor. Let me know if i can be of any help in this. Thanks! -
20. Re: EJBTHREE-1396 MockServer must report startup / shutdown
alrubinger Nov 24, 2008 3:38 PM (in response to jaikiran)I'm actually surprised this works for you.
After launching the remote process, we need to wait a bit until it opens the command socket. From my MockServerController.startServer():createRemoteProcess(processArgs); /* * Wait a max of 5 seconds for the remote process to start */ long start = System.currentTimeMillis(); int timeoutIntervalSeconds = 5; long timeout = timeoutIntervalSeconds * 1000 + start; while (true) { try { // Start the server sendStartRequestToServer(); } // Couldn't start server catch (CannotConnectException cce) { // If we haven't yet timed out long current = System.currentTimeMillis(); if (current < timeout) { // Swallow exception and try again logger.trace("Can't connect to server @ " + current + ", trying until " + timeout); Thread.sleep(100); continue; } // Throw the exception, timeout's past throw cce; } }
Even after that, I'm getting CNFEs when the command to start the server is received:15:26:01,003 ERROR [AbstractKernelController] Error installing to PreInstall: name=org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar state=Not Installed java.lang.ClassNotFoundException: org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar
...which is odd, I can see that the CP is getting set correctly to the remote process command:/opt/sun/java/jdk1.5.0_15/bin/java -cp "/home/alrubinger/business/jboss/wc/jbossas/projects/ejb3/trunk/proxy/target/classes:...[etc]" -ea org.jboss.ejb3.test.proxy.remoteaccess.MockServer org.jboss.ejb3.test.proxy.remoteaccess.unit.RemoteAccessTestCase localhost 12345
Running this directly from the shell works just fine.
I'll have to look into this more later, probably after this week.
Some other misc impressions to be elaborated upon later:
* MockServer isn't Thread-safe and there's some inconsistent synchronization when accessing its state, etc.
* I neglected to provide facility for parent CLs in my Hack CLs that do the jndi.properties replacements.
* Let's use Generics:Map configParams = new HashMap(); configParams.put("timeout", String.valueOf(TIMEOUT));
* Make an SPI (expose publically) the value of the "timeout" String for the config params
* Always reset TCL to the original in a "finally" block.
S,
ALR -
21. Re: EJBTHREE-1396 MockServer must report startup / shutdown
jaikiran Nov 26, 2008 10:09 AM (in response to jaikiran)"ALRubinger" wrote:
* I neglected to provide facility for parent CLs in my Hack CLs that do the jndi.properties replacements.
* Always reset TCL to the original in a "finally" block.
S,
ALR
Andrew,
From what i see in the code and understand from the comments, the purpose of JndiPropertiesToJndiRemotePropertiesHackCl is toswitch requests for "jndi.properties" to use "jndi-remote.properties"
// Switch up to the hacky CL so that "jndi.properties" is not loaded, and uses instead "jndi-remote.properties" ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(new JndiPropertiesToJndiRemotePropertiesHackCl()); RemoteAccessTestCase.setContext(new InitialContext());
Any specific reason for using a different classloader, instead of something like this:// get the input stream for jndi-remote.properties file, which will be available // in classpath InputStream inputStream = RemoteAccessTestCase.class.getClassLoader().getResourceAsStream("jndi-remote.properties"); // load the jndi-remote.properties Properties jndiRemoteProperties = new Properties(); jndiRemoteProperties.load(inputStream); // Use the non-default constructor of InitialContext and pass the // properties RemoteAccessTestCase.setContext(new InitialContext(jndiRemoteProperties));
Am i missing something here (which is very likely)? -
22. Re: EJBTHREE-1396 MockServer must report startup / shutdown
alrubinger Nov 26, 2008 11:00 AM (in response to jaikiran)"jaikiran" wrote:
Any specific reason for using a different classloader, instead of something like this:
No, that's better.
S,
ALR -
23. Re: EJBTHREE-1396 MockServer must report startup / shutdown
jaikiran Dec 13, 2008 6:36 AM (in response to jaikiran)"ALRubinger" wrote:
Even after that, I'm getting CNFEs when the command to start the server is received:15:26:01,003 ERROR [AbstractKernelController] Error installing to PreInstall: name=org.jboss.ejb3.JndiRegistrar.Session.SLSBJndiRegistrar state=Not Installed java.lang.ClassNotFoundException: org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar
...which is odd, I can see that the CP is getting set correctly to the remote process command:/opt/sun/java/jdk1.5.0_15/bin/java -cp "/home/alrubinger/business/jboss/wc/jbossas/projects/ejb3/trunk/proxy/target/classes:...[etc]" -ea org.jboss.ejb3.test.proxy.remoteaccess.MockServer org.jboss.ejb3.test.proxy.remoteaccess.unit.RemoteAccessTestCase localhost 12345
I could reproduce this on my local system (RHEL 5 OS). The issue is because of this change that i did to support Windows platform (my earlier setup) http://www.jboss.com/index.html?module=bb&op=viewtopic&t=145100&postdays=0&postorder=asc&start=0#4187002
Since we are using the ProcessBuilder to start a Java process, the double quotes at the beginning and the end of the -cp classpath are being passed to Java which seems to not like them on *nix platform."ALRubinger" wrote:
Running this directly from the shell works just fine.
Since the shell takes care of removing the double quotes before passing on the parameters to Java, it works from shell.
I'll undo the double quotes change and introduce a better way to take care of any space in the classpath."ALRubinger" wrote:
* MockServer isn't Thread-safe and there's some inconsistent synchronization when accessing its state, etc.
Moved the piece of code accessing the state, into the synchronized block. Was there anything else which you think is incorrectly synchronized?/** * On receiving a {@link MockServerRequest} the invocation handler will * carry out appropriate operation on the {@link MockServer} <br> * * Supported requests are <br/> * <li> * <ul> * {@link MockServerRequest.START} - On receiving this request, the invocation * handler will start the {@link MockServer} * </ul> * <ul> * {@link MockServerRequest.STOP} - On receiving this request, the invocation * handler will stop the {@link MockServer} * </ul> * </li> * @throws {@link IllegalArgumentException} If the <code>invocationRequest</code> * is not supported * @see org.jboss.remoting.ServerInvocationHandler#invoke(org.jboss.remoting.InvocationRequest) */ public Object invoke(InvocationRequest invocationRequest) throws Throwable { ..... // The same invocation handler can be called by multiple threads. synchronized (this.mockServer) { if (request.equals(MockServerRequest.START)) { this.mockServer.start(); } else if (request.equals(MockServerRequest.STOP)) { this.mockServer.stop(); } else { throw new IllegalArgumentException("Unrecognized request " + invocationRequest.getParameter()); } return mockServer.getStatus(); } }
"ALRubinger" wrote:
* Let's use Generics:
Done."ALRubinger" wrote:
* Make an SPI (expose publically) the value of the "timeout" String for the config params
The MockServerController now has/** * Sets the timeout for the server startup. * <br/> * This method has to be called before calling the {@link #startServer(String[])} method, * for the timeout to be considered. * * @param timeout The timeout value in milli seconds. */ public void setServerStartupTimeout(int timeout) { // code } /** * Returns the timeout set for the server startup. * * @return */ public int getServerStartupTimeout() { // ... } /** * Returns the timeout set for server to stop * * @return */ public int getServerStopTimeout() { // ... } /** * Sets the timeout for the server to stop. * <br/> * This method has to be called before calling the {@link #stopServer()} method, * for the timeout to be considered. * * @param timeout The timeout value in milli seconds. */ public void setServerStopTimeout(int timeout) { // ... }
-
24. Re: EJBTHREE-1396 MockServer must report startup / shutdown
jaikiran Dec 17, 2008 6:50 AM (in response to jaikiran)"jaikiran" wrote:
I'll undo the double quotes change and introduce a better way to take care of any space in the classpath.
Even though the original issue with the space was observed on my Windows setup, i was able to reproduce it on RHEL 5 too. This has now been fixed. The test case now passes even when there is a space in the folder names of the classpath. Tested on RHEL 5.
With this, the remaining changes have been completed for the MockServer.