我无法从Windows Server 2003服务器上的批处理脚本调用Microsoft Cabinet Maker实用程序(makecab)。批处理脚本由Hudson(持续集成服务)运行,作为计算机上的Windows服务安装。
hudson.exe
(64位)进程产生java.exe
(32位)进程,该进程产生cmd.exe
(32位)进程,该进程产生{{1} (32位)进程。 Makecab然后产生错误:
makecab.exe
但是,如果我打开与服务器的远程桌面连接并打开命令提示符窗口并运行makecab,它可以正常工作。但我注意到从开始>运行cmd.exe Run会生成一个64位进程,然后运行64位makecab进程。
任何人都可以解释为什么32位makecab可能会抛出错误?可执行文件同时存在于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:
和C:\WINDOWS\system32
。
是否有任何方法,从C:\WINDOWS\SysWOW64
生成并运行的32位cmd.exe
批处理脚本中运行64位版本的java.exe
(除了复制物理外)可执行文件从makecab.exe
到C:\WINDOWS\system32
)?
由于
答案 0 :(得分:1)
这个对我来说相当明显。 Hudson配置为在hudson.xml中运行32位版本的Java:
<executable>C:\Program Files (x86)\Java\jre6\bin\java</executable>
32位Java可执行文件正在生成32位cmd.exe。
我需要做的就是使用64位版本的Java(可在此处获取:https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter)并在hudson.xml中指向它。
唯一的问题是看起来Hudson Active Directory插件无法与64位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
答案 1 :(得分:1)
使用64位JVM应该解决根本问题。
要修复Hudson的Active Directory问题,您需要在64位JVM上使用Active Directory插件时指定域名(高级配置)。
由于Win64的com4j问题,64位窗口上的Active Directory插件uses the unix implementation。
答案 2 :(得分:0)
看起来您正在指定makecab的路径。我的建议是不要这样做。当cmd.exe启动时,Makecab已经处于默认路径中,并且通过指定它的路径,您将强制使用它。如果您只是直接调用makecab.exe,cmd.exe将立即选择。
AFAIK,你不能从32位版本的cmd运行64位的makecab。它不会运行。
似乎makecab抱怨指令文件。你可以发布指令文件的内容吗?
另外,我认为指令文件的扩展名应该是 .ddf ,而不是 .df (虽然我不确定它有多大不一样)。