Jump to content

.WAR file deployed, but I want to run it in root-folder


vukosyst

Recommended Posts

Hi there,

 

Thanks for moving my account to Tommy and enabling Java! I uploaded a ROOT.war file through cPanel and then deployed it, but apparently I had to ask you to do this, because I want this deployment to run in the root-folder of Tomcat (tomcat/webapps, which I have no access to).

 

Could you move the contents of the tomcat/webapps/ROOT folder up one level, as I think this makes the servlet run on http://inschrijven-vukamerorkest.heliohost.org/ is that correct?

 

Is it possible to run Java servlets in the public_html directory, so that we don't have to upload .WAR files after each change of the webapp, but only those files that changed?

 

Thanks, Martijn

 

 

Link to comment
Share on other sites

You're on a multi-user server which means that each servlet must run in a subdirectory to keep them separate from each other. If everyone tried to run their application in the root folder you would get conflicts and files like index.jsp would get written and overwritten constantly. If you need to run your application in the root folder we recommend getting a VPS so that you'll be the only person using the whole server so there will be no conflicts. https://www.heliohost.org/partners/vps

Link to comment
Share on other sites

Ah, I see. The fact that I can't run a servlet in root is pretty logical, indeed!

 

I now deployed to /web and the resulting servlet has references to /[username]_[foldername], which, in our case, is /vukosyst_web instead of just /web. This causes the servlet to misbehave, as the vukosyst_web folder does not exist, at least not on our host/domain. Do you have any idea how to solve this?

 

Then, there's another thing that I don't (yet) understand: if Tomcat runs as a different user, is there any way I can make a full backup of my Java web app? Will a full backup from cPanel include the webapps folder? If so, sorry for not trying that earlier...

 

Thanks again, keep up the good work!

 

Martijn

Link to comment
Share on other sites

The reason we append your username to your .war file before it's deployed is because otherwise we would have conflicts. Say one user deployed test.war and a second user then also deployed test.war the first one would be overwritten and suddenly user1.heliohost.org/test/ would change to someone else's site. To prevent this we append the username to the front of the file. test.war becomes user1_test.war or user2_test.war depending on who deploys it. Sometimes this name change causes issues within the .war file when it's hard coded to only work with one name. To get around this issue we recommend writing your .war so it will work with any name, but if that isn't possible for you just simply name it vukosyst_web.war yourself. If your .war file already has your username and an underscore in front it won't be added again.

 

When you create a full backup anything in /home/vukosyst/ will be backed up as well. That is the directory that .war files are uploaded to prior to deployment.

  • Like 1
Link to comment
Share on other sites

I understand what you describe. It's somewhat different than on our previous host: RHcloud/OpenShift v2.

 

So I did what you suggested: I renamed the war file to vukosyst_web.war and deployed, but after deploying, cPanel still tells me the deployment location is /web and the wrong references are still there...

 

It's great that the entire /home/vukosyst/ folder will be backed up, but we use a SQLite db in our servlet which is our most important object to backup as it changes over time. Will the .war file be updated accordingly? My simple knowledge tells me it won't, but I hope you prove me wrong.

 

Sorry for keeping you busy! As soon as our webapp is fully operational, you won't hear from me again, I promise :)

 

Thanks, Martijn

Link to comment
Share on other sites

I manually edited the deploy.conf file. As long as you don't change the name of the .war file it won't overwrite my manual changes. If you do need to change the name just deploy it and then let me know and I can make the edit again.

 

Yes, tomcat should be able to find files in /home/vukosyst/ but you'll need to have your permissions just right. Tomcat runs as a user named nobody which isn't in the group vukosyst, so you'll need to allow read and write for other. I don't think you need the execute flag for sqlite databases. Let us know if you need help with permissions. Most people find sqlite to be too much of a pain to set up so they switch to mysql which is much easier.

Link to comment
Share on other sites

Thanks Krydos! We tried to connect to our SQLite DB in /home/vukosyst (the db file received CHMOD 0666), but the webapp now gives a 500 error. Is the relative location /home/vukosyst/[dbname].db correct or did we perhaps make a mistake there?

 

As we now have a (sort of) drag-and-droppable webapp that requires minimal configuration, we prefer to keep the solution with the SQLite DB. If it's not possible to connect to it from the web app, is it possible for you to - on request - copy the db file to a folder that we can reach as we cannot reach it within the tomcat web-inf folder?

Edited by vukosyst
Link to comment
Share on other sites

I just tested your database as the tomcat user and it should be able to read/write to the file. Are you specifying the full path to the database in your servlet? /home/vukosyst/<removed>.db

Edited by Krydos
removed database name
Link to comment
Share on other sites

Nevermind, we had an error in our code. I'm able to read/write to the db-file, indeed. Could you please remove/edit your previous post as others now also know the db-name and have access to it through Tomcat?

 

Thanks for all the support. we're up and running now! Next episode: configuring a cron job that sends the db to an e-mail address once a week...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...