Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

TomCat 9.0.27 -> java.lang.UnsatisfiedLinkError: Failed to create temporary file for jnidispatch.dll

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,

today I installed TomCat in Version 9.0.27 on a Windows Server 2016.

I get the following error log when I try to start a specific application:
SEVERE [https-openssl-nio-10110-exec-5] org.apache.catalina.core.StandardHostValve.invoke Exception Processing /application1/dispatch java.lang.UnsatisfiedLinkError: Failed to create temporary file for /com/sun/jna/win32-x86-64/jnidispatch.dll library: Access is denied

Please see below for more details from the log file.

My understanding is, that TomCat cannot write into the relevant temp-directory which is within the path f:\appexec\tomcat\inst\tom01\temp (owner = tomadmin with read and write permission). In Windows-Registry, DJava.io.temp is set to the mentioned path.

The question is, why tomcat cannot write the relevant dll into the path of which tomadmin is the owner with permission to read and to write.

My suspicion is that one of the following 2 aspects might be the "problem":

1. Tomcat tries prior to the extraction of the dll to the above mentioned path to temporarily extract the dll to another path on that tomadmin has no permission and stops after it fails. Is there another temp directory in that TomCat tries to write temporarily specific files? How could I find that out - is there a way to increase the level of detail in the TomCat log files (specific debug-options, etc.)?

2. The permissions are ok. The problem is that in the context of the extraction of the DLL-file another process (e.g. malware-detector, windows defender, etc.) blocks TomCat so that TomCat cannot write the dll into the above mentioned path. How could I figure out whether there is such a process without trying to switch off all the security related mechanisms on the Windows Server?

Many thanks in advance!

Kind regards,

XDev

TomCat Log:

SEVERE [https-openssl-nio-10110-exec-5] org.apache.catalina.core.StandardHostValve.invoke Exception Processing /application1/dispatch java.lang.UnsatisfiedLinkError: Failed to create temporary file for /com/sun/jna/win32-x86-64/jnidispatch.dll library: Access is denied
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:962
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922)
at com.sun.jna.Native.<clinit>(Native.java:190)
at com.sun.jna.Pointer.<clinit>(Pointer.java:54)
at com.sun.jna.Structure.<clinit>(Structure.java:2130)
at waffle.windows.auth.impl.WindowsCredentialsHandleImpl.initialize(WindowsCredentialsHandleImpl.java:79)
at waffle.windows.auth.impl.WindowsAuthProviderImpl.acceptSecurityToken(WindowsAuthProviderImpl.java:116)
at waffle.apache.NegotiateAuthenticator.authenticate(NegotiateAuthenticator.java:99)
at waffle.apache.NegotiateAuthenticator.doAuthenticate(NegotiateAuthenticator.java:182)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:608)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
 
Saloon Keeper
Posts: 21311
140
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Deniz!

You appear to be using Apache Waffle. I'm not familiar with it, but I think that it is not the main problem. Although you should check the Waffle installation and setup instructions carefully.

Not that it matters, but Tomcat is not camel-case (TomCat). A Tomcat - or tom cat is simply an English way of saying "male cat". A female cat is often referred as a "molly" or "queen" and in the case of my little furball, she is very definitely royal and has no qualms about being a tyrant. As far as I know, "Tomcat" is not an acronym, just a name that someone liked. I have no idea where it came from.

Waffle, on the other hand, stands for "Windows Authentication Framework" at least if you are creative in your acronym design.

Now to important things. Tomcat runs as a single OS process, which is the JVM executing it. Tomcat is 100% write-once/run-anywhere with Java, so it does not play games with different user IDs or other OS-dependent services. In Windows, Tomcat is often wrapped inside Windows executables in order to make it possible to run Tomcat as a Windows System Service, but they don't play identity games either. So the userID that you launch Tomcat with is the same OS userID that every part of Tomcat uses.That includes the Tomcat server itself, its plugins, such as the security Realms (like Waffle) and the webapps.

Tomcat also uses the temporary-file services that are defined in the java.io.File interface. It changes the tempfile location from the JVM default to TOMCAT_HOME/temp, although you can tell Tomcat to use a different directory if you want to. But basically that means that the Tomcat temp directory and everything in it should belong to the userID that Tomcat is running under. If not, you will have access problems.

So check your userids and owner privileges carefully.

One other possibility does exist. Windows has finally started to get serious about security. If Waffle is trying to install a DLL, it's just possible that Windows might be requiring it to be properly digitally signed now. Your Waffle documentation should tell you if that is something you have to consider.
 
Deniz Kaan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

Thanks a lot for your prompt response.

Today, we had the chance to better understand the problem.

It seems that Tomcat (sorry for the camel-case I used in my posting on yesterday - really painful for me ;-) ) tries to write that file temporarily on a different path to that it has no write permission and subsequently moves it to the right path. I need to double-check that matter - after I am sure probably on tomorrow I will confirm the facts. However, the problem is solved by granting additional write permissions for tomadmin to that location.

Kind regards,

Deniz
 
Tim Holloway
Saloon Keeper
Posts: 21311
140
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem. And I, too have problems. Thanks to Java, I often end up accidentally CamelCasing things that aren't even computer related sometimes!

If you could tell us that the directory that was having access rights problems was, I'd appreciate it. Someone else may have that problem someday and they can look to you for the answer.
 
Deniz Kaan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

I validated that matter - Tomcat tries to write into f:\ ("root directory") - that is why it stops that task - tomadmin has no write permissions to f:\ - access is denied... See attached the evidence we got by using Process Explorer.

Unfortunately we cannot provide Tomcat with write permissions to f:\  - it seems, that the only way is to find out how we can force Tomcat not to write to f:\ but into the Tomcat-directory or one its subdirectories.

However, now I am going to study the relevant documentation of Tomcat to understand where we can set that path - it seems that there is another parameter which might be used additionally to -djava.io.temp and $CATALINA_HOME...

If you have any further insights into that matter I would really appreciate all details....

Kind regards,

Deniz
Tomcat_CreateFile_in_f.jpg
[Thumbnail for Tomcat_CreateFile_in_f.jpg]
Access Denied - Attempt to write into root directory
 
Tim Holloway
Saloon Keeper
Posts: 21311
140
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat's startup script actually overrides the java.io.tmpfile property, so for you to override Tomcat's override, you'd have to set CATALINA_TMPDIR.

However, CATALINA_TMPDIR is set to %CATALINA_BASE%\temp, and NOT to the root of a disk drive.

What I think is happening is that Waffle is doing some work of its own and unpacking into F: instead of into %CATALINA_BASE%\temp (java.io.tmpdir). Check their instructions, and if that doesn't help, ask them about this.
 
Deniz Kaan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

I'll do so - thanks a lot for all the hints you provided me with - I think the solution is not far away ;-)

Cheers,

Deniz
 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!