开发者

app launched from java commons-exec can't access web on win7, but launched from cmd.exe can

Running on windows7, using wkhtmltopdf to generate a pdf from our site works fine from a command prompt. Running the exact same wkhtmltopdf command from a servlet running in jetty via commons-exec results in a blank pdf.

I've turned on the accesslog valve on our site as well as installed netmon on win7, and I can clearly see that the web request to our site itself is being generated when invoked from the command prompt, but isn't being generated at all from the jetty-launched process.

开发者_Go百科I've examined the event logs with Event Viewer on win7, but I don't see any security exceptions or such that might explain the empty pdf. The fact that it is generating a pdf implies that the wkhtmltopdf executable is being invoked correctly.

Any ideas what might be causing wkhtmltopdf to not have http access?


Solved it, in case anyone else runs across this: Though the wkhtmltopdf executable was running fine, it was being launched with no environment variables whatsoever, and that was causing the http request to fail silently (or at least in a way that I never discovered). Changing the process launcher to copy over all the env vars from the launching process into the wkhtmltopdf process solved the problem.

Note that I finally solved this by wrapping wkhtmltopdf in a bat script and printing out env vars and other state in there. Had to brush up on my bat scripting, but it was worth it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜