views:

80

answers:

3

I'm having trouble calling the Microsoft Cabinet Maker utility (makecab) from a batch script on a Windows Server 2003 server. The batch script is being run by Hudson (continuous integration service) installed as a windows service on the machine.

The hudson.exe (64-bit) process spawns a java.exe (32-bit) process, which spawns a cmd.exe (32-bit) process, which spawns a makecab.exe (32-bit) process. Makecab then produces an error:

D:\Hudson\jobs\Testing\workspace>C:\WINDOWS\system32\makecab.exe /F "D:\Build\2.3.278.40859.cab.df" 
Microsoft (R) Cabinet Maker - Version 5.2.3790.0
Copyright (c) Microsoft Corporation. All rights reserved..

Parsing directives
Parsing directives (D:\Build\2.3.278.40859.cab.df: 1 lines)

D:\Build\2.3.278.40859.cab.df(12): ERROR: 

However if I open a remote desktop connection to the server and open a command prompt window and run makecab it works perfectly. But I've noticed that running cmd.exe from Start > Run spawns a 64-bit process, which then runs a 64-bit makecab process.

Can anyone explain why the 32-bit makecab might be throwing an error? The executable exists in both C:\WINDOWS\system32 and C:\WINDOWS\SysWOW64.

Is there any way, from within the 32-bit cmd.exe batch script that java.exe spawns and runs, to run the 64-bit version of makecab.exe (other than copying the physical executable from C:\WINDOWS\system32 to C:\WINDOWS\SysWOW64)?

Thanks

A: 

It looks like you are specifying the path to makecab. My suggestion would be to not do that. Makecab is already in the default path when cmd.exe starts up, and by specifying the path to it, you are forcing it to be used. If you just call makecab.exe directly, cmd.exe will choose the right now.

AFAIK, you cannot run the 64 bit of makecab from the 32 bit version of cmd. It will not run.

It seems makecab is complaining about the directives file. Can you post the contents of your directives file?

Also, I believe the the extension of the directives file should be .ddf, not .df (although I'm not sure how much of a different it makes).

Sagar
Use: **makecab.exe /F "D:\Build\2.3.278.40859.cab.df"** NOT C:\WINDOWS\system32\makecab.exe /F "D:\Build\2.3.278.40859.cab.df"
Sagar
+1  A: 

This one is fairly obvious to me now. Hudson is configured to run the 32-bit version of Java, in hudson.xml:

<executable>C:\Program Files (x86)\Java\jre6\bin\java</executable>

The 32-bit Java executable is spawning a 32-bit cmd.exe.

All I need to do is use the 64-bit version of Java (available here: https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter) and point to it in hudson.xml.

Only problem is it looks like the Hudson Active Directory plugin doesn't work with 64-bit Java..

24-Aug-2010 19:39:52 hudson.WebAppMain$2 run
SEVERE: Failed to initialize Hudson
org.jvnet.hudson.reactor.ReactorException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activeDirectory': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider]: Constructor threw exception; nested exception is java.lang.NullPointerException
    at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:246)
    at hudson.model.Hudson.executeReactor(Hudson.java:689)
    at hudson.model.Hudson.<init>(Hudson.java:606)
    at hudson.model.Hudson.<init>(Hudson.java:546)
    at hudson.WebAppMain$2.run(WebAppMain.java:222)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activeDirectory': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider]: Constructor threw exception; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:231)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:957)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:869)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:514)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:413)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:735)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
    at hudson.util.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:94)
    at hudson.util.spring.BeanBuilder.createApplicationContext(BeanBuilder.java:388)
    at hudson.plugins.active_directory.ActiveDirectorySecurityRealm.createSecurityComponents(ActiveDirectorySecurityRealm.java:62)
    at hudson.security.SecurityRealm.getSecurityComponents(SecurityRealm.java:359)
    at hudson.security.HudsonFilter.reset(HudsonFilter.java:134)
    at hudson.model.Hudson.setSecurityRealm(Hudson.java:1767)
    at hudson.model.Hudson$13.run(Hudson.java:2165)
    at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
    at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
    at hudson.model.Hudson$3.runTask(Hudson.java:671)
    at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
    at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider]: Constructor threw exception; nested exception is java.lang.NullPointerException
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:98)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:225)
    ... 28 more
Caused by: java.lang.NullPointerException
    at hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.<init>(ActiveDirectoryUnixAuthenticationProvider.java:52)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:83)
    ... 30 more
Tom
I created a JIRA for the Active Directory plugin bug: http://issues.hudson-ci.org/browse/HUDSON-7286
Tom
+1  A: 

Using a 64-bit JVM should fix your root problem.

To fix the Active Directory problem with Hudson, you need to specify the Domain Name (Advanced configuration) when using the Active Directory plugin on 64-bit JVMs.

Because of a com4j problem with Win64, the Active Directory plugin uses the unix implementation on 64-bit windows.

Jason