Unable to deploy war in tomcat 6.0.24 on linux server

We are tring to upload the war of our jsp servlet project named demo_nfc.war,but We are getting the below error while deploying war file.

==========================
Jul 25, 2014 3:07:53 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive demo_nfc.war
Jul 25, 2014 3:07:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat6/webapps/demo_nfc/WEB-INF/lib/servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 25, 2014 3:07:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat6/webapps/demo_nfc/WEB-INF/lib/servlet-api-3.0.20090124.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 25, 2014 3:07:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat6/webapps/demo_nfc/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 25, 2014 3:07:53 PM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/demo_nfc,J2EEApplication=none,J2EEServer=none
Jul 25, 2014 3:07:53 PM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive demo_nfc.war
java.lang.UnsupportedClassVersionError: com/servlet/AdminController : Unsupported major.minor version 51.0 (unable to load class com.servlet.AdminController)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2335)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:976)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1451)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:108)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:58)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1074)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4377)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
==========================

but when we deploy war with single jsp file it deployed successfully.

Redirect subdomain dynamic page with mod_write to subdomain static page

I have a sudomain app.example.com pointing to a directory named /app It contains a folder called uvf with an index.html file.

I am trying to redirect all automatically generated links like app.example.com/uvf/xxxxx (ex: app.example.com/uvf/99nimr?r=ufp__6snk7wGDA) to /app.example.com/uvf/

What would be the exact syntax in .htaccess?! the .htaccess must be in the root of example.com like usual?

subversion mysteriously getting disconnected

This is my first post on the forum, so please excuse any of my mistakes.

We have installed Subversion 1.7.2 with Apache 2.2 on a Windows 2008R2 VM server. And for authentication, svn is integrated with Active directory. We are facing a very strange problem. After 2-3 days of accessing svn, it suddenly becomes inaccessible from svn clients. While accessing the repository url it throws a 500 error. The log file doesn't show any error message. Apache seems to be running as well.

We tried to restart the Apache server but it doesn't resolve the issue. Since log file doesn't show any message its tough to debug. Even windows event log doesn't show anything on this error. The only way we have found is by restarting the server box, which is very embarrassing.

We are now absolutely clue less and planning to upgrade the svn to a higher version but we don't know which version will fix the issue.

How to use Require directive to limit file access in apache 2.4

I have a directory structure like the following for a website on Ubuntu 14.04, running apache 2.4.7:

/websites/mywebsite/index.htm /websites/mywebsite/private.htm /websites/myqwbsite/folder/privatefile.ext /websites/mywebsite/folder/subfolder/publicfile.ext

In the apache config for the site, I have

<Directory /websites/mywebsite/>
   AllowOverride Limit
   Require all granted
</Directory>

I want to use .htaccess files in the site folder such that the private.htm and privatefile.ext files are Require all denied but everything else is granted.

I tried the following two .htaccess files:

/websites/mywebsite/.htaccess:

<FilesMatch (private.*.htm)$>
   Require all denied
</FilesMatch>

/websites/mywebsite/folder/.htaccess:

Require all denied

/websites/mywebsite/folder/subfolder/.htaccess:

Require all granted

However, apache gives a 500 - "Require not allowed here" for /websites/mywebsite/.htaccess

How can I make what I want happen with apache 2.4-compatible configuration (ie I do not want to load mod_authz_compat and use the old style config)?

Wrong RewriteBase, not working [duplicate]

This question already has an answer here:

I don't know why, maybe I just misplaced the .htaccess file. I put it in my CodeIgniter root folder. I'm using CodeIgniter and trying to remove the index.php from the address, the website is located in this folder on the server: /domains/website.com/CodeIgniterRoot/ and my .htaccess file looks like that:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule %(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
<If Module>

Also what should I put in CodeIgniter config file in those lines:

$config['base_url'] = '';
$config['index_page']  = '';

Sorry if it already been asked, I'm new to php and CodeIgniter and quite understand what's going on there..

Thanks in advance.

How to redirect back to HTTP port 8080 from HTTPS port 8443?

I'm making a webapp but I'm new to this whole https thing. I followed the instructions at http://tomcat.apache.org/tomcat-8.0-doc/ssl-howto.html to create a keystore and set up tomcat to redirect from port 8080 to HTTPS port 8443. I've gotten it to work using both a web.xml file and web annotations in java.

Basically, I've set it up to that my webapps signUp page is https. Whenever I access the signup page I am redirected to the HTTPS port 8443. Yay! However, now whenever I access any other pages (i.e. the login page), the webapp REMAINS on port 8443. I'd like it to return to port 8080. Can anyone help?

"deny from all" with a custom message?

I'm moving to a new server and want to take all of my sites offline during the transition. I know I can put this in my root .htaccess file to block people from visiting the site:

order deny,allow
deny from all 

But I want to also output a message explaining why the site is down. Is this possible?

How can I allow PHP to use the at command in exec() calls when SELinux is enabled?

I have a PHP script that takes a long time to load. We have moved our sites to a new server which lives behind a cloud load balancer. The maximum time limit for the load balancer is 120 seconds, but the script takes well over 5 minutes. Splitting the script up is not an option.

I rewrote the script so it would run on the command line, and I can successfully call this:

php -f /path/to/long_php.php > /path/to/log_file.php

I can then call this from PHP by doing this:

exec('php -f /path/to/long_php.php > /path/to/log_file.php');

Of course, because this script takes a long time to load, I don't want the PHP page to wait. Back on the command line I successfully used the at command like so:

echo "php -f /path/to/long_php.php > /path/to/log_file.php" | at now

So, I expected when running a similar thing in PHP it would work:

exec('echo "php -f /path/to/long_php.php > /path/to/log_file.php" | at now');

However this doesn't work. Unlike all the previou tries, the final command here give me SELinux errors:

----
type=SYSCALL msg=audit(07/25/2014 21:12:50.027:793672) : arch=x86_64 syscall=open success=no exit=-13(Permission denied) a0=7fd6fc2186bb a1=80000 a2=1b6 a3=0 items=0 ppid=55040 pid=55041 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1517 comm=unix_chkpwd exe=/sbin/unix_chkpwd subj=unconfined_u:system_r:httpd_t:s0 key=(null)
type=AVC msg=audit(07/25/2014 21:12:50.027:793672) : avc:  denied  { read } for  pid=55041 comm=unix_chkpwd name=shadow dev=md2 ino=11797556 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:shadow_t:s0 tclass=file
----
type=SYSCALL msg=audit(07/25/2014 21:12:50.028:793673) : arch=x86_64 syscall=socket success=no exit=-13(Permission denied) a0=10 a1=3 a2=9 a3=7fff46547e40 items=0 ppid=55038 pid=55040 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1517 comm=at exe=/usr/bin/at subj=unconfined_u:system_r:httpd_t:s0 key=(null)
type=AVC msg=audit(07/25/2014 21:12:50.028:793673) : avc:  denied  { create } for  pid=55040 comm=at scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:system_r:httpd_t:s0 tclass=netlink_audit_socket
----
type=SYSCALL msg=audit(07/25/2014 21:12:50.028:793674) : arch=x86_64 syscall=socket success=no exit=-13(Permission denied) a0=10 a1=3 a2=9 a3=1 items=0 ppid=55038 pid=55040 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1517 comm=at exe=/usr/bin/at subj=unconfined_u:system_r:httpd_t:s0 key=(null)
type=AVC msg=audit(07/25/2014 21:12:50.028:793674) : avc:  denied  { create } for  pid=55040 comm=at scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:system_r:httpd_t:s0 tclass=netlink_audit_socket
----
type=SYSCALL msg=audit(07/25/2014 21:12:50.028:793675) : arch=x86_64 syscall=socket success=no exit=-13(Permission denied) a0=10 a1=3 a2=9 a3=7fff46547eb0 items=0 ppid=55038 pid=55040 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1517 comm=at exe=/usr/bin/at subj=unconfined_u:system_r:httpd_t:s0 key=(null)
type=AVC msg=audit(07/25/2014 21:12:50.028:793675) : avc:  denied  { create } for  pid=55040 comm=at scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:system_r:httpd_t:s0 tclass=netlink_audit_socket

Note: the above is from /var/log/audit/audit.log piped through ausearch -i

After this I piped those in to audit2allow -w to see why, and the first error was regarding allow_httpd_mod_auth_pam not being enabled. I then enabled this and got some other errors. Running them through audit2allow -M tmpat produced me tmpat.pp, with an associated tmpat.te:

module tmpat 1.0;

require {
        type initrc_var_run_t;
        type httpd_t;
        class capability audit_control;
        class file read;
}

#============= httpd_t ==============
allow httpd_t initrc_var_run_t:file read;
allow httpd_t self:capability audit_control;

Unfortunately, when I run semodule -i tmpat.pp it still doesn't work. Repeating the process of using audit2allow -w above gives me more of the same Missing type enforcement (TE) allow rule. errors. So with that in mind, I'm hoping someone can tell me what changes I need to make to the generated tmpat.te to make this work?

Note: I'm on CentOS 6.5, with Apache 2.2, PHP 5.4

Update:

After looking in to policies, albeit it being something new to me, and I came up with the following:

module tmpat 1.1;
  require {
  type tmp_t;
  type httpd_t;
  class file { create getattr open read rename unlink write };
  class dir { add_name getattr open read remove_name search write };
}

#============= httpd_t ==============
allow httpd_t tmp_t:file { create getattr open read rename unlink write };
allow httpd_t tmp_t:dir { add_name getattr open read remove_name search write };

Currently this compiles but won't install, giving me this:

[[email protected] tmp]# semodule -i tmpat
semodule:  Failed on tmpat!

...but hopefully this might give some insight in to what I'm trying to do.