i have a tomcat webapp which is called "app". Inside the folder tomcat/webapps/app/ is a file named index.html (as you can see in the screenshot)
when i start my tomcat and try to access the file with the url
http://localhost:8080/app/index.html
then i get a 404 - not found error. What am I doing propably wrong? I allready checked the rights of the tomcat directory on the filesystem and have all rights to access all files in the directory
Thank you in advance!
Hmmm try by changing permissions on the folder and make sure you apply the permission recursively (so this step "Replace all child object permissions with inheritable permissions from this object") so all the folders underneath your tomcat take the same command like here: https://serverfault.com/questions/157461/set-permissions-recursively-on-windows-7
Use the Sysinternals Process Monitor to see where Tomcat is looking for files when you do the HTTP request. This will help you understand what's going on.
Related
I'm trying to unzip in a directory symlinked in my WebApp and get this error
java.io.FileNotFoundException: /var/lib/tomcat/webapps/MyApp/_Apps/xxxxx.txt (Permission denied)
_Apps is my symlink (owned by tomcat, 777) and refers to a directory owned by tomcat (755)
My tomcat version is 7
I've put allowLinking="true" in my app context tag (plus override="true").
Any idea of what is going wrong?
I see several issues here, some related to your question, some to best practice:
You shouldn't upload any files to your webapp at runtime: They'll get overwritten with the next deployment (and will be lost), plus you open yourself up to uploads like attack.jsp - containing code that might end up running server side, under the account that tomcat is running as
Really, you should write to a different directory
That will make your issue go away.
In order to temporarily check what causes the issue:
Validate which user tomcat is running as
Validate that this user account has write access to the directory - to be more confident: Validate this through the linked directory and through the underlying directory, natively without using the link. (You can sudo -u tomcat /bin/bash to manually try)
Check, which file system the directory is on (it might be mounted read-only)
Once you've finished validating (or even before that, reluctant that you can work on a higher priority - security relevant - issue): Go back to the beginning of the list and change your implementation. Upload to a different folder.
I have Tomcat on Windows 10 with deployed app on it. It runs well except of when application tries to save file in filestore it throws an error.
Filestore is a folder on the disc path to which is defined in context.xml like this:
<Resource name="ххххх/FileStore"
type="org.ххххххх.filestore.FileStoreService"
factory="org.ххххххх.filestore.impl.LocalFileStoreFactory"
baseDir="/E:/files"
domain="ххххх"/>
Tomcat sees this path correctly and directory E:/files/xxxxx really exists. For testing purpose I have ran this app with Tomcat on Ubuntu and this process passed just fine. Also I emulated "Windows" error on Ubuntu by restricting the permission for Tomcat to write in filestore folder.
What i tried so far:
Gave all permission to write in the folder to everyone and to services (as I ran it like user or like a service) and to all other groups just in case.
Disable UAC, firewall, other "protective" soft, ran like administrator from GUI, command line, powershell.
Shared this folder in the network with permissions to write for everyone (password off). Tested it from another PC. Modified context.xml accordingly.
Is there another options that can help to solve this issue?
The problem was not in permissions. I forgot that Windows file system not allows to do several action with the file simultaneously, like in my case.
We have tomcat 7.0.55 in our unix server. We have deployed web applications manually inside webapps folder of tomcat instance. By default the clusterinfo.1200.properties and log4j logs are stored in .businessobjects folder under home directory of the user account in which tomcat runs.
While accessing the InfoView web application we get the below error,
"AccessControlException:"java.io.filePermission:Access Denied \home\<user account of tomcat>\.businessobjects\clusterinfo.properties"
Tomcat 7 has restriction to access the file outside the tomcat directory on the first logon. However on refreshing the page we are able to access the application.
I have tried the following steps.
stopped the tomcat instance
Moved .buisnessobjects from home directory to inside tomcat installed directory.
Created symlink as .businessobjects in home directory to point to the folder inside tomcat directory.
Started the tomcat instance.
It works. But I need to know where the configuration change has to be made in web application to place the clusterinfo property file and log4j file inside tomcat directory.
I am a novice in Java. Please let me know the file and its location to make this changes.
Desperately looking for a solution :-(
Did you try to grant more permissions on this file with chmod.
The exception explicitly says that its java.io.filePermission. So the problem is that jvm can't read your properties file because your OS prevents it from doing so based on the file permissions.
You can see file permissions with ls -l filepath.
I vaguely remember that you had to change owner of the accesed files in order for tomcat to work so chown tomcat7 \home\<user account of tomcat>\.businessobjects\clusterinfo.properties wouldn't hurt, but I don't remember if it was only applicable to deployed artifacts like *.war files or such.
I have successfully developed and deployed a java servlet in a tomcat server.
But in that servlet i call a dll file. In my computer that i run the tomcat server and i call the library
i use System.load("C:/java/src/calldllfile.dll"); and it works fine .
The problem is that in jelastic tomcat i don't really know what path i should use and where i should place my dll file for my servlet to call... and i catch in my code with a try it returns a UnsatisfiedLinkError
so it really must be the path ...
Following a similar answer in jelastic forum that is on comments below
i tried to set my file into home folder and call it with
System.loadLibrary(System.getProperty("user.home")+"/"+"calldllfile.dll");
but it didnt work.
So i don't really know what to do ... i include below an image of my deployed servlet with the location of the dll library that i cannot call. It would be just really helpfull if someone tell me what path i should use in System.load("?????");. Thanks
Folders webapps and home are located on the same level and the root folder for them is /opt/tomcat/ (equivalent of environment variable CATALINA.HOME - portion of docs). If you are talking about WEB-INF folder which is definitely located under your context (ROOT for example), to get it you need to use /opt/tomcat/webapps/ROOT/WEB-INF (or System.getProperty("catalina.home")+ "webapps/ROOT/WEB-INF/").
Concerning .dll libs you can check this
I know this is an old thread, but the answer can be useful for someone.
To access the home folder from a Tomcat installation you have to use the real path /opt/tomcat/
This way you can access your dll with the path /opt/tomcat/temp/calldllfile.dll
I have got a ROOT application on my tomcat application server. When I add files to the ROOT folder I can't access them. I had files in the folder before which were named help.html and index.html and they seem to work fine. Any new files which I create, I get 404 error when trying to access them. The permissions are the same. Any clues why ?
Are they *.html files as well? Have they the same owner and permissions as the rest of the files?