How to add a folder Jetty will run a site from? - jetty

I have Jetty running on an Oracle VBox VM (Win7) Guest. I need Jetty to run a site from a shared folder, so I can edit it on the host. How can I do that?
Edit: The site is HTML/JS, not a war file. I see from the docs I can copy a war to $JETTY_HOME. What I'm wondering is if I can add a path to $JETTY_HOME for Jetty to look in?
The path is \\VBOXSVR\MyCoolSite

Related

Copy PHP application from Jenkins to /var/www/html

I have installed Jenkins and Apache to one instance of CentOS in aws. I have connected Jenkins with github but I am not able to access the application through url as it shows the following error.
You should add your website content to the directory /var/www/html/.
I need to copy files from jenkins directory to the mentioned one can you please help me how to copy app so that I can use it on browser.

How to add a second web app with jetty alongside with geoserver?

I deployed the Platform Independent Binary of GeoServer on ubuntu. To launch geoserver, I would just run this script /usr/share/geoserver/bin/startup.sh
So no jetty is actually installed. Geoserver web app can be accessbile via http://localhost:8080/geoserver/web
I wonder how I can configure a second web app which takes this path http://localhost:8080/upload/index.html
Ideally, I would like python and perhaps PHP are supported.
Any tips is appreciated. Thanks.
You can add any other war files to geoserver_dir/webaps/ and Jetty will unpack and run them like any other servlet.
I have no idea how you would add python and PHP to that set up. Maybe you would be better off looking at running tomcat and apache and using the GeoServer war file there.

ClassNotFoundError even though class is included in lib/ext folder in Jetty 9.2.2

Just want to ask about my problem. I am trying to setup a jetty server and included my own webapp. I put the web application in the webapp folder of jetty server. I also included the necessary libraries needed by the web application in lib/ext folder of jetty, it is not included in the war file. when i run the jetty server and access the webapp, i get the 'NoClassDefFoundError'.
I run the jetty server using the 'java -jar start.jar'. I am also sure that the jar file which contains the class that causes the error is in the classpath.
Did i miss something?
Thank you.

Deploying Django in Apache server

I finished my project in the development server and now I worked it using Apache in the localhost. The project worked good. Now, I got an apache sever. can you please clarify some of my doubts;
1. Need to upload the Django installation files, mod_wsgi and any other files to the server?
2. Can I maintain the same folder directory as I did with the local host Apache?
3. what is httpd.conf, and where can I find it in my server?
I am using Linux ubuntu OS, Python 2.7, Django 1.6 and my server got its first level of directories like:
.cpanel, .htpasswords, cpmove.psql, etc, logs, mail, public_ftp, ssl, tmp, www, access-logs and some more .conf and other type files.
Among above directories, I can't open the www folder.
Please suggest any tutorial or some other way to resolve things. It will be very helpful for me and my team.
Thanks in advance

Find the jetty home directory from inside a java web application when running as a linux service

I have a jetty 9 installed on CentOS in /srv/jetty, and I have a webapp deployed inside jetty.
When I start jetty with java -jar start.jar & then inside the web application I can do this:
File base = new File(".");
System.out.println("Base Dir: " + base.getAbsolutePath());
And it returns me the correct directory of the jetty installation.
But then I add jetty as a linux service, to run with a user called jetty, and start with service jetty start then calling the above code, will allways give me back the home directory of the user, who is running jetty in this case /home/jetty/ or if I run as root then /root/
How can I set up jetty to find the correct directory? I tried with jetty.home in the config files, but nothing seems to work.
You have a few things to worry about.
The noteworthy paths for a WebApp on Jetty:
ServletContext Real Path
Jetty Home
Jetty Base (starting in Jetty 9.1)
ServletContext Real Path
All WebApps that are deployed and started, will occupy either a work directory, or a temp directory (on the whim of the container). The servlet spec mandates that this path should be discoverable via the ServletContext for that webapp. You can find out where your WebApp is, by calling ServletContext.getRealPath("/")
See my prior answer for 5 different ways you can configure this work/temp directory:
https://stackoverflow.com/a/19232771/775715
Jetty Home
By default, all Jetty Distribution instances will have a System Property called jetty.home that will be the path to the Jetty Home location on disk. This is to be assumed to be where the Jetty Binaries and Distribution configurations are found.
Jetty Base
Starting in Jetty 9.1, there is also a mandatory System Property called jetty.base that is where your specific instance of jetty's configuration + libraries + webapps are housed. This is often a different directory than jetty.home.
This separation of binaries vs configuration is a core concept of Jetty 9.1, adopting a clear separation will making upgrading the Jetty binaries easy.
See http://www.eclipse.org/jetty/documentation/current/startup-base-and-home.html
I thing I have found the easy answer:
usermod -m -d /srv/jetty jetty
As it was advised in many places on the internet I created a user jetty to run the jetty service. So whatever I did -even if I set JETTY_LOGS- the log files allways ended up in the users home directory. By modifying the jetty users home directory the File(".") and the logs all end up where I wanted to