Tomcat Webapp Won't Launch - apache

Im new to tomcat and I'm having issues launching my tomcat webapp.
I have tomcat setup on localhost:8081 and the tomcat main page comes up if I put localhost:8081 in the address bar after launching launch-tomcat.bat
I've been stuck on this issue for a week now so I'm going to try and provide as much information as possible. Please let me know if you needed any other additional information.
Any help is greatly appreciated.
If I try to go to http://localhost:8081/week12app_novak/
I get the following error.
Here's a screenshot of the directory path to the webapp.
Also here's a pastebin of catalina.2015-11-22.log http://pastebin.com/U2Dqjqhc
launch-tomcat.bat
setlocal
SET TOOLS_HOME=C:\projects\tools\
SET TOMCAT_HOME=tomcat\apache-tomcat-8.0.14-windows-x64\apache-tomcat-8.0.14
::SET CATALINA_HOME=D:\tools\java\tomcat\apache-tomcat-8.0.14-windows-x64\apache-tomcat-8.0.14
::SET CATALINA_HOME=C:\projects\tools\tomcat\apache-tomcat-8.0.14-windows-x64\apache-tomcat-8.0.14
SET CATALINA_HOME=%TOOLS_HOME%%TOMCAT_HOME%
SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65
:: Start Tomcat
%CATALINA_HOME%\bin\startup.bat
endlocal
UPDATED IMAGE AFTER ADDED CODE TO WEB.XML

You didn't post your web.xml, but it probably does not have a welcome file list. If you don't supply one, Tomcat will look for index.html, index.htm, or index.jsp in the week12app_novak directory when you try to access http://localhost:8080/week12app_novak/.
You could rename user-accounts.html to index.html. Or you could add a welcome-file-list tag block to your web.xml.
<welcome-file-list>
<welcome-file>/user-accounts.html</welcome-file>
</welcome-file-list>

Related

cPanel throwing 503 error after editing a file in the www directory

I am struggling with this particular issue and cPanel's documentation really has not been any help.
This is a fresh setup of centOS7 (clean install) and cPanel for provisioning.
I am my own host - with a static IP.
I can login to cPanel on both common ports (2087 root and 2083 )
Ports 80,443,21,22 and 3306 are open
Here is my issue in a nutshell:
When I create an account in cPanel and then login as that account I can create a placeholder index.php file that simply just says "hi".
The problem is. After I edit the file once; if I try to create any other file or even edit the index.php file a second time? the domain will throw a 503 error. If I try to chmod the public_html folder in any way? cPanel throws a 503 error. If I try to extract my gitHub repo into the www folder? cPanel throws a 503 error.
The only way to fix it is to Terminate/Delete the account and then re-create it. So this is an endless loop of working/busted/working/busted.
The cPanel documentation has really been of zero help. Their support staff doesn't seem to have a clue either.
Is there a security setting I am missing? I have checked the log files. It is not giving me any info about why it is throwing an 503.
I have been going in circles for a day on this so any help is appreciated.
<?php
// Sample Placeholder Page
?>
<h1>This is a sample placeholder for cPanel</h1>
I expect that when editing a file such as index.php it should load properly.
The output is a 503 error after editing the file more than once or adding any other file.
The issue was caused by a corrupted PHP install by Easy Apache. Running a manual rebuild and switching from PHP 7.2 to 7.3 fixed the issue.

Unable to add header on Apache webserver hosted by azure

I am trying to enable Anti clickjacking on a website hosted by Azure.
Its a shared hosting package run on Apache server. Problem is that i cant find the correct conf file to modify and add this line of code to:
header always set x-frame-options "SAMEORIGIN"
we found a file called apache2.conf and added this but after restarting apache server the line is removed from the conf.
Anyone any ideas what i can do ?
The header code you are trying to add should be applied to a .htaccess file, placed in the folder where you want the action to happen. In your case it's likely the root of your site.
Be warned, though, that I've just ran in to an issue whereby mod_headers.c are not enabled in my container. So even if you put the code above in to a .htaccess file, it still may not work.
I'm interested in knowing where you found the apache2.conf file though. I can't see that on mine (but that may be due to me replying a custom docker container).

How to set custom JSP project url to default url on using tomcat8 local server?

I setup Tomcat8 and upload jsp project in webapps directory.
Now I can visit my site with the url like "http://sitename/project name/web".
But I hope my project to show when visit "http://sitename".
I tried to find solution but nothing is helpful.
Please help me.
Thank you.
Try making the directory named ROOT in webapps directory and put into your jsp file and rename to index.jsp.
If you create ROOT directory or ROOT.war in webapps directory, then the application can be accessed without /[context-name], like "http://sitename/your.jsp".
In addition, Tomcat regards index.jsp as the welcome file by the following default settings in conf/web.xml:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
So you can access to ROOT/index.jsp by requesting to "http://sitename".

Running jsp files from /srv/http using Apache HTTP server and Tomcat

I'd like run jsp files directly from /srv/http without deploying them the Tomcat-way. For example, I want to be able to create symbolic link to my webapp directory (e.g. /home/user/myapp/) in /srv/http and access some app's page through http://localhost/myapp/page.jsp.
Is this possible and how would I set this up?
NOTE: This is not for production. We have to use JSP at university and I want to be able to quickly test my pages.
Open the server.xml of your Tomcat. Assuming if your are using Tomcat 6.x+ then it would be at /tomcatDir/conf/server.xml.
Make an entry with your path
<Context path="/myapp" docBase="yourPathGoesHere" debug="0" reloadable="true" />
Restart Tomcat if already running.
What I did at the moment was creating a symlink in /var/lib/tomcatX/webapps to my project path. This is not the answer I was looking for though, but it is a way to deploy an app without much work.
(X in the above path means your Tomcat version)
If you set <Host name="localhost" appBase="/srv/http"> then all of the directories in it will be deployed as web applications.
If you want /srv/http to be the ROOT application/directory add a file: tomcat/conf/Catalina/localhost/ROOT.xml
with the Context docBase="/srv/http", rather than adding a Context definition to server.xml - this has been strongly discouraged for years.

JSESSIONID added to URL when Weblogic redirects to Apache?

Our application is running on WebLogic.
At some point the WebLogic is redirecting to Apache to allow the user to access PDF files.
This happens via:
final String encodedURL = resp.encodeRedirectURL(redirectURL);
resp.sendRedirect(encodedURL); //ok here because redirection to other server and not to itself
The problem is that WebLogic appends a JSESSIONIDto the URL and the apache fails to serve the PDF Document.
How can I prevent WebLogic from adding the JSESSIONID to the URL?
The whole point en encodeRedirectURL is to include the session ID in the URL if necessary. f you think it's not necessary to include it, don't encode the URL:
resp.sendRedirect(redirectURL);
the problem was, that in our weblogic.xml cookies were disabled:
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<session-descriptor>
<cookies-enabled>false</cookies-enabled>
</session-descriptor>
whe solved the issue by setting them to true. in this special application, this was not a problem:
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<session-descriptor>
<cookies-enabled>true</cookies-enabled>
</session-descriptor>
Adding this to my Facelets based application's web.xml avoids JSESSIONID:
<session-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>