file not found in testng java call via ant

my projects unit tests are run via testng = java task in ant script
from there java throws a file not found:
java.io.FileNotFoundException: T:\mc247_deu\index.ind (Das System kann den angegebenen Pfad nicht finden)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.]]>(RandomAccessFile.java:204)

for a network drive that is available, the path is correct.

the ant task runs correctly when running outside of teamcity, but not via team city.
anybody can help?

7 comments
Comment actions Permalink

this is really blocking me now, which is a shame, as TeamCity really seems to offer what I need...
anyone has an idea what could be the reason why the path is not found?

here is the ant task I am using:
]]>
<arg line="-d $ -sourcedir $/test/src $/test/testng.xml"></arg>
</java>

when this is called via ant from command line, it works.
when it is called via team city, the path is not found.

0
Comment actions Permalink

I guess it can only be a credentials problem.
Will try to run the services (both teamcity and agent) with specific user account.
Then reboot and pray.

0
Comment actions Permalink

Please let us know if this helps.

0
Comment actions Permalink

Hello Michael,

I made the experience that NT-services can have serious trouble to access
network shares via a drive-letter. For me it turned out that letting the service
access the share by its UNC name (
server\share) works much better. Maybe you
can try that as well.

Sascha

Michael Damberger wrote:

my projects unit tests are run via testng = java task in ant script
from there java throws a file not found:
java.io.FileNotFoundException: T:\mc247_deu\index.ind (Das System kann den angegebenen Pfad nicht finden)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:204)

for a network drive that is available, the path is correct.

the ant task runs correctly when running outside of teamcity, but not via team city.
anybody can help?

0
Comment actions Permalink

thanks a lot for the feedback, Kirill and Sascha! It is really appreciated.

First we made the services be executed with a dedicated user.
Then we made sure this user has all required access rights to the network shares.
We then made a login with that user to the domain, which sometimes is required, as the admin said.

All this did not help. It was really required to reboot the server, then it worked. Windows... :)

I cannot say if the extra user is required for both of the services, and if not, for which one. We do it for both (agent and teamCity) and that works.

0
Comment actions Permalink

oh sorry... posted to early. forget the previous post.
the network drive is still unaccessible after reboot.

it works with the unc path!!

0
Comment actions Permalink

Network Drives (mapped) for a user are not accessible under a windows services even if that service is running under the context of that user.

0

Please sign in to leave a comment.