English 中文(简体)
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.

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.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签