Command line runner and Native library problem

I trying to port the current build process to team city 4.5.3. We have our own build component which compiles and creates jar files, this is created in java and I intend to use this as is using command line runner feature of team city. When I try to invoke this component from batch file passing some parameters, the build hangs. Debugging it further reveals that build component use some native libraries and system hangs while loading them using System.loadLibrary().  The details of command line runner configuration is

Working directory : <Directory under which build component is installed>
Command executable : <batch file which invoke java class of build component>
Command parameters : <parameter to the batch files>

The batch file inturns do
"C:\Program Files\Java\jdk1.6.0_03\bin\java" -classpath "%USERPROFILE%";jars\<Jar List>   <main-class> %*

I am logged on to the system as one of the user "gjoshi'

Please help!

10 comments

How do you run agent? Do you use service? What user account is specified for the service?
I do not know exactly what the problem is, but I would try to run agent from the agent.bat file to see what happens.

0

Thanks Pavel for replying. Well I have tried running the agent from batch file as well as service. I made sure that user through which it is started is same. Moreover when I tried and executed the same batch file from command prompt, it ran absolutely fine.
I was wondering if it is something to do with security manager permission of JRE on which build agent is running beacuse somewhere I have read that java is used to exec process in case of command line processor.

0

You can check this assertion by specifying cmd as an executable and batch file as parameter.

0

did that as well but of no avail....I had specified cmd.exe in executable with /c parameter.

0

Is it possible that you are using different working directories when start batch file from the command line or when batch file is started by agent?

0

I was using the same working directory. I even specified it in working directory config of command line runner as well..

0

I quickly run out of ideas
Maybe your batch script uses some environment variables (like JAVA_HOME)? Is it possible that your build starts under different JVM? Not the one you expected? In fact command line runner does not do any unusual things - it just starts the process, nothing more.

0

Really appretiate your replies. Well the batch file is just 2-3 lines long which just invokes the build component main class. I have tried all the permutation and combination but of no avail.
I even tried do the remote debugging, and just some how it gets stuck in System.Load(Dll Path) lines. Pausing the debugger moves the debugging to class loader's load native file method.
There is just one thing left to try,  do the entire process using adminstrator login. I'll try this as well and let you know about that. Thanks for you help

0

Hi All,

I have found the solution to the problem and is not realted to Team city. My project was loading the system library and at the same time was accessing System.in. This caused a deadlock and is reported in Sun website (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4809647). The reason that it occured in team city and not in normal command line is that it occurs only when if the JVM has been started by another
JVM (using Runtime.getRuntime().exec()).

This problem has wasted lots of time for me. I hope this reply save few hours for others.

Thanks

0

Comment has been made in the reply

0

Please sign in to leave a comment.