tomcat context resource not working - centos

i have a tomcat6 server running on a CentOS 6 machine and so far so good.
in one of my webapps i need to use a context param to access an external folder located in the filesystem, i configured my server.xml like this (relevant portion of <Host> tag only) :
<Context path="/userimages" docBase="/home/someuser/faces/32x32" debug="0" reloadable="true" crossContext="true"/>
when i start the server i get this error :
java.lang.IllegalArgumentException: Document base /home/someuser/faces/32x32 does not exist or is not a readable directory
i read something about folder permission so i set both "32x32" and "webapps" folder to 777, but it's still not working...any idea of how to fix this ?
P.S. on windows OS it works perfectly

My suggestion is to put your data into /usr/share/tomcat6/conf/context.xml which is a symlink to /etc/tomcat6/context.xml on CentOS 6. At least tomcat6 does read the contents of that file when it restarts, and I had some luck getting resource data loaded from there. It would seem that this file is new in tomcat6.
I used strace to check which files it was visiting and it does run stat() on the various files like /var/lib/tomcat6/webapps/*/META-INF/context.xml but nowhere does it actually open() those files, so I'm pretty sure it does not read the contents. Maybe some bug? Maybe imaginary future feature?
I managed to get Plandora (uses context to supply MySQL database connection details) running on CentOS 6 with these packages (from yum):
apache-tomcat-apis-0.1-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.i686
mysql-connector-java-5.1.17-6.el6.noarch
tomcat6-6.0.24-52.el6_4.noarch
tomcat6-servlet-2.5-api-6.0.24-52.el6_4.noarch
tomcat6-el-2.1-api-6.0.24-52.el6_4.noarch
tomcat6-admin-webapps-6.0.24-52.el6_4.noarch
tomcat6-jsp-2.1-api-6.0.24-52.el6_4.noarch
tomcat6-lib-6.0.24-52.el6_4.noarch
tomcat6-webapps-6.0.24-52.el6_4.noarch
Just in case anyone else is trying to get Plandora to work on CentOS 6, you also need to make sure you symlink:
ln -s /usr/share/java/mysql-connector-java.jar /usr/share/tomcat6/lib/

Related

How to change MariaDB's data directory?

I use CentOS7 as my system
I tried to change the data direction on MariaDB 10.1.43
I follow the process on internet and all show to change the datadir=/var/lib/mysql/ in my.cnf
but the problem is there is no my.cnf file in my computer
only a my.cnf.d folder with a server.cnf file in it
I type datadir=/newpath/ in this server.cnf
but it didn't work, the datadir that mariaDB shows is still /var/lib/mysql/
what should I do for now? how can I find this my.cnf file?
I realize this is an old question. But wanted to add an answer that worked for me on a legacy machine running MariaDB 10.1.43 and CentOS 6.
Within the /etc/my.cnf file add this under [client-server] to look like this:
[client-server]
port=3306
socket=/home/mysql/mysql.sock
Then, within the /etc/my.cnf.d folder in the server.cnf file add this under [mysqld] to look like this:
[mysqld]
datadir=/home/mysql
socket=/home/mysql/mysql.sock
I moved the data to the /home directory, which is a newly mounted volume with additional space for this machine.
The next part of my answer is out of scope for this question. But the instructions here worked like a charm for moving your MySQL/MariaDB data directory. Semi-pro tip: Be sure to follow the RedHat/CentOS step to add the security context.

Creating symbolic links resulting in 500 error

Currently running a WHM / Cpanel server running Centos. Server seems to be running fine no issues there. However I'm using a deployment process to put files outside of the document root. e.g.
~/deployment
instead of:
~/public_html
Obviously I need to point public_html to this folder so my site will run. So, I'm removing the public_html and creating a symlink and pointing it to the new deployment folder. This results in a 500 error.
So looking at the logs I've discovered that it produces the following error:
Directory "/home/xyz/deployment" is writeable by group
Checking the file permissions looks as though the symlink is 777 where i need it to be 755 for the server to allow viewing.
Is there a setting in WHM ? Is there a setting in Centos? I have another box running that doesn't have this issue so I'm assuming that this is related to the current setup of this machine.
Any help would be appreciated, thanks.
when you create a hard link from a file or folder, This file/folder inherits the accesses and permissions of the original file/folder, and in soft link it will be 777 permission, so i think you can use rsync options for both purpose :
1- have a folder with all files in source
2- have your own permissions in folder

Samba Share Not Writable (Linux)

I am currently running a fresh install of CentOS 7 (64-bit). This machine isn't used for anything except for storage via Samba. However, for some strange reason, I can't see to get the share to be writable through windows. With the drive mapped, I can read the file lists and browse (even accessing files), but I cannot write any new files.
The steps that I took was to install samba via yum. I added a system user, bdawson, and then added that same user as a Samba user. I then logged in as that user and make a directory called storage (path being /home/bdawson/Storage).
I then edited my Samba config and added the following:
[Storage]
valid users = bdawson,#bdawson
path = /home/bdawson/Storage
write list = bdawson,#bdawson
/home/bdawson was chown -R'd to be owned by bdawson:bdawson. File permissions are set to 0755 for both /home/bdawson and /home/bdawson/Storage.
At this point, I am not sure what I'm doing wrong that is preventing me from being able to write. This same configuration worked just fine on a different machine, so I'm at a complete loss. (Side note: Samba logs aren't showing any issues and watching the Samba connections via Webmin does show that I am connecting and reading from the share, but attempts to write to it fail saying I need permission.)
After a lot of digging, I discovered this was due to a missing SELinux label. This was not an issue with my Ubuntu share, since Ubuntu doesn't use SELinux.

PostgreSQL issue: could not access file "$libdir/plpgsql": No such file or directory

I get this exception in PostgreSQL:
org.postgresql.util.PSQLException: ERROR: could not access file "$libdir/plpgsql": No such file or directory
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1721)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1489)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:193)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
I searched a lot and most solution points to a wrong installation. But this is my test db which has been running without issues for a long time. Also inserts are working. Issue occurs only on select queries.
Apparently, you moved your PostgreSQL lib directory out of place. To confirm this, try the following in psql:
> SET client_encoding TO iso88591;
ERROR: could not access file "$libdir/utf8_and_iso8859_1": No such file or directory
If you get an error message like this, then my theory is correct. You'll need to find out where those files ended up, or you can reinstall PostgreSQL to restore them.
To find out what $libdir is referring to, run the following command:
pg_config --pkglibdir
For me, this produces:
/usr/lib/postgresql
I have the same problem: the other postgres server instance (8.4) was interfering with the 9.1 one; when the 8.4 instance is removed it works.
the other instance can sometimes be removed from the system while still running (e.g. you do a gentoo update and a depclean without stopping and migrating your data). so the error seems particularly mysterious.
the solution is usually going to be doing a slot install/eselect of the old version (in gentoo terms, or simply downgrading on other distros), running its pg_dumpall, and then uninstalling/reinstalling the new version and importing the data.
this worked pretty painlessly for me

Problem after migrating Magento

I am trying to create an exact mirror of a Magento production server on my local server for further development, but I have run into a few issues.
On the production server, our Magento is configured to run without displaying the index.php, but after attempting a migration to my local server, the index.php is required to access any links. Additionally, when I select a category to visit (for example), I am directed to http://localhost/category.html instead of http://localhost/my-magento-store.com/index.php/category.html
The other issue I've noticed is that I am unable to log in to the admin section. After entering the correct login credentials, I am redirected to the login screen again without any error messages.
I am running a MAMP stack on the local server, and here is what I have done:
Created a tar of the entire production server
Created a database backup in Magento System > Tools > Backups
Downloaded and extracted tar into local directory
Imported database dump into local MySQL using Alexey Ozerov's big dump script. (The .sql file is 1.3m lines)
Changed values of web/unsecure/base_url and web/secure/base_url in core_config_data table. (As I don't have a self-signed SSL cert, I put http://localhost:8888/my-magento-store/ for both values)
Dumped contents of var/cache and var/sesson
Changed permissions to 755 for all files on local dev server
Navigated to http://localhost:8888/my-magento-store/ but got the "Index of /" page instead.
Navigated to http://localhost:8888/my-magento-store/index.php and got an error.
Followed these steps to solve the error, reloaded the page, and the home page loaded correctly.
Any ideas?
URL Rewriting depends on your .htaccess file, so there are a couple of things to check:
web/seo/use_rewrites in core_config_data should be true.
when you created your tarball, did it include . files in the root directory especially .htaccess? If you used tar -cvf archive.tar * then it may have missed them. (Nice "feature" of *nix).
Check that your MAMP httpd.conf has AllowOverride All, otherwise your local .htaccess will be ignored.
I'm not familiar with MAMP, but it's possible that it's having a problem reading/interpreting your .htaccess, though this is unlikely. I'd focus on options 1 thru 3 first.
HTH,
JD