NPanday and CI (like Teamcity)

Jun 4, 2010 at 1:10 PM

Hi all,

Today I encountered a problem when trying to build a project using Maven2 builder in Teamcity (pom file was generated by NPanday VS plugin). Everything work well - he could figure out all necessary NPanday's plugins but during execution of install goal produced an error:

[15:38:17]: Parameter 'build.number=%maven.project.version%.12' is not fully resolved, using as is.
[15:38:23]: Jun 4, 2010 3:38:22 PM npanday.registry.ConnectionsRepository lazyLoad
[15:38:23]: INFO: NPANDAY-080-001: Adding data access object: Class Name = npanday.dao.impl.ProjectDaoImpl
[15:38:23]: Jun 4, 2010 3:38:22 PM npanday.registry.ConnectionsRepository lazyLoad
[15:38:23]: INFO: NPANDAY-080-004: Connection Start Up: Time = 70
[15:38:23]: Jun 4, 2010 3:38:23 PM info.aduna.lang.service.ServiceRegistry <init>
[15:38:23]: INFO: Registered service class org.openrdf.query.parser.serql.SeRQLParserFactory
[15:38:23]: Jun 4, 2010 3:38:23 PM info.aduna.lang.service.ServiceRegistry <init>
[15:38:23]: INFO: Registered service class org.openrdf.query.parser.sparql.SPARQLParserFactory
[15:38:26]: [ERROR]
[15:38:26]: [ERROR] Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\.m2\npanday-settings.xml'.
[15:38:26]: [ERROR]
[15:38:26]: [ERROR] Server stack trace:
[15:38:26]: [ERROR] at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
[15:38:26]: [ERROR] at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
[15:38:26]: [ERROR] at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
[15:38:26]: [ERROR] at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
[15:38:26]: [ERROR] at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
[15:38:26]: [ERROR] at System.IO.StreamWriter..ctor(String path)
[15:38:26]: [ERROR] at NPanday.Plugin.Settings.SettingsGeneratorMojo.Execute()
[15:38:26]: [ERROR] at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[15:38:26]: [ERROR] at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[15:38:26]: [ERROR]
[15:38:26]: [ERROR] Exception rethrown at [0]:
[15:38:26]: [ERROR] at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[15:38:26]: [ERROR] at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[15:38:26]: [ERROR] at NPanday.Plugin.AbstractMojo.Execute()
[15:38:26]: [ERROR] at NPanday.Plugin.Loader.PluginLoader.Main(String[] args)
[15:38:26]: [ERROR] BUILD ERROR
[15:38:26]: [INFO] ------------------------------------------------------------------------
[15:38:26]: [INFO] NPANDAY-xxx-000
[15:38:26]: Embedded error: NPANDAY-063-000: Execution Path = C:\.m2\pab\gac_msil\NPanday.Plugin.Runner\1.1__npanday.plugin, Command = [parameterFile=C:\TeamCity\buildAgent\temp\buildTmp\Plugin6154926453811471240.xml, assemblyFile=C:\.m2\pab\gac_msil\NPanday.Plugin.Settings\1.1__npanday.plugin\NPanday.Plugin.Settings.dll, mojoName=NPanday.Plugin.Settings.SettingsGeneratorMojo, startProcessAssembly=C:\.m2\pab\gac_msil\NPanday.Plugin.Loader\1.1__npanday.plugin\NPanday.Plugin.Loader.exe]
[15:38:26]: NPANDAY-040-001: Could not execute: Command = CMD.EXE /X /C NPanday.Plugin.Runner.exe parameterFile=C:\TeamCity\buildAgent\temp\buildTmp\Plugin6154926453811471240.xml assemblyFile=C:\.m2\pab\gac_msil\NPanday.Plugin.Settings\1.1__npanday.plugin\NPanday.Plugin.Settings.dll mojoName=NPanday.Plugin.Settings.SettingsGeneratorMojo startProcessAssembly=C:\.m2\pab\gac_msil\NPanday.Plugin.Loader\1.1__npanday.plugin\NPanday.Plugin.Loader.exe, Result = -532459699
[15:38:27]: Build finished
Looking at this line of log:
[15:38:26]: [ERROR] Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\.m2\npanday-settings.xml'
I could understand that the problem is that the CI service is run under Local System Account and NPanday tries to search for npanday-settings.xml under its profile setting. For known reasons path to .m2 folder is set for C:\.m2 (non-default). That did not cause problem during NPanday install and download although led to the error like this.
I researched on code base (regarding stack trace) and found a line like this (trunk\plugins\netplugins\NPnaday.Plugin.Settings\src\main\csharp\NPanday\Plugin\Settings\SettingsGeneratorMojo.cs  line 43):
string outputFile = Environment.GetEnvironmentVariable("USERPROFILE") + "/.m2/npanday-settings.xml";
As I understand this causes the error. It tries to serialize the npanday settings to user profile folder regardless of the setting for .m2 folder.
So, is it possible to take this path in the same way as for uac and pab folders? Because this will resolve the issue - uac and pab were created in the rigth place (in my case under c:\.m2).
P.S. trying to execute "mvn install" with the same pom file from command line works without any errors.
Thanks, Artem
Developer
Jun 8, 2010 at 12:56 PM

There are too many places where the repo-location is hardcoded. In addition npanday uses other hardcoded paths. We plan to fix this for the major release.

Related Issues:

  • http://npanday.codeplex.com/workitem/10841
  • http://npanday.codeplex.com/workitem/12009
  • http://npanday.codeplex.com/workitem/13452

Sorry for the unconvnience. If you wan't to help us fixing it, welcome! :-)

- Lars

Coordinator
Jun 10, 2010 at 6:45 AM

Artem, if you have a patch for making this configurable, we'd be happy to apply it also :)

Jun 10, 2010 at 6:48 AM

For now I used a workaround: creating a user account for service and run it under this account. But will write a patch for this issue as soon as finish current work (end of this week)

Coordinator
Jun 10, 2010 at 6:52 AM

Great! Our current priority is getting the 1.2 release out - it looks like a quick 1.2.1 with some of the queued patches might be in order.

Dec 15, 2010 at 2:39 PM

Hi, we are trying to get the build run on hudson CI, but hudson run on windows server 2008 as system account, an we get reakky problems with the hard coded paths. Would you please make a fix to either use (the configurable)  m2 directory as base for all plugins or add an evionrment variable, which can be set via maven settings profile.

Tx in advance!

Coordinator
Dec 15, 2010 at 6:12 PM

BTW, the lists to reach us have moved: http://incubator.apache.org/npanday/mail-lists.html

On 16/12/2010, at 2:39 AM, cforce wrote:

From: cforce

Hi, we are trying to get the build run on hudson CI, but hudson run on windows server 2008 as system account, an we get reakky problems with the hard coded paths. Would you please make a fix to either use (the configurable) m2 directory as base for all plugins or add an evionrment variable, which can be set via maven settings profile.

Tx in advance!