Bringing a remote tomcat/mySQL server to localhost Mac - java

I have a website someone's developing for me on a VPS (Java, javascript, CSS, HTML) that I would like to run on my Macbook Pro.
He commits the source on Github, which I download with Sourcetree.
I have Tomcat 6 and MySQL running on the Macbook fine.
Can I bring the root folder, the mySQL db and an associated media folder over without creating a .war file to run it on tomcat on localhost by simply setting up the connections properly in datanucleus, or is it much more complicated than that?
Thanks in advance for your thoughts.

I know people who try to develop application directly in die Webapp Folder from Tomcat but that is not the right way.
At your place i'll do this:
clone the application locale on your mac
Use an IDE(eclipse/Netbeans/IntelliJ) to open the project
Build a local war file which you can deploy directly to your $CATALINA_HOME/webapp/
Do not forget the make all required mySQL settings (context.xml) and so on...

Yes, you can. But it is necessary to have compiled webapp.
Simply put root folder contents (your deployed application) to "/webapps/ROOT" and start tomcat by running script in "bin" folder.
Make sure that you properly configured database properties of your application.
If you have only sources - it is not such simple. You have to build war and deploy it. Or ask developer to include "target" directory in git repository and then copy "classes" folder to /webapps/ROOT/"

Related

Update files on a tomcat server, via Eclipse

I've recently found out how to remotely debug my java files on a Tomcat server via eclipse and was wondering something. I am wondering if I could import the same files into Eclipse that are currently housed in the webapps folder on my tomcat server, and instead of having to go to that filepath anytime I need to make a code change with the files in the tomcat server, be able to make them directly in Eclipse which I would be using to debug anyway.
Currently I've tried importing the same project folder from the webapps folder in Tomcat into Eclipse and made a small code change, relaunched my server, but am not seeing the change in my tomcat library.
When importing into Eclipse does it make it's own separate instance of the files, instead of actually being able to import the same exact files as in the tomcat server?
If you double-click the Tomcat server in the 'Servers' view inside Eclipse, you will see a configuration tab "Server Locations".
By default, eclipse doesn't make changes to the tomcat 'webapps' folder, it uses folders under its workspace.
Changing that option to 'Use tomcat installation' will make the changes be visible from the tomcat/webapps folder on your file system.

Deploy a .rar on cloudfoundry using eclipse plugin

I am currently using the cloudfoundry eclipse plugin to deploy my JSP/Servlet web application. My application is now using a Db (Sqlite). However I am having problem deploying the sqlitejdbc.rar to cloudfoundry (all i do to update the application is right click on my application under VMware Cloud-foundry server and select update. But that doesn't seem to work and i get an exception saying that it cant find the rar file.
In my local system i simply paste the sqlitejdb.rar to the lib directory of Tomcat and when i run the webapp locally it works
If you place the sqlitejdbc.rar file into your lib directory (inside your WEB-INF directory) that should get deployed as part of your application into cloudfoundry and become accessible.
You can also try to deploy your app using vmc push to see what errors you get from vmc.
I also recommend looking at the log files on cloudfoundry.com

Installing a game on Tomcat. Newb here

this might be a tall order or it might be ridiculously simple. I wanted to run this game on my website: https://github.com/ajanata/PretendYoureXyzzy
Unfortunately I have no clue how to make something like this work. There didn't seem to be an installation file, so I can only imagine it's painfully obvious to anyone familiar with this sort of thing. I recently ordered a trial of a shared Tomcat server, since I'm assuming that's needed to run all the Java goodies.
If there are any simple instructions I should follow to install this, it would be much appreciated if you could share them!
You need to download the source from the Github link you provided and then download Eclipse - Java EE. You then open Eclipse and choose File->Import->General->Existing Projects Into Workspace and choose the folder you just downloaded. You can then choose Export->Web->WAR file and export the WAR file.
You then download and setup Tomcat as described here (ignore the parts after Tomcat is running and you can access it at http://localhost:8080) and install the WAR as described here.
If you are feeling exceptionally lazy I have built the war here. You just need to drop it into the webapps folder in your Tomcat installation and then restart your server. You can then access it at:
http://localhost:8080/cah.
Hard to say without looking deeper into the project, if they create a .war file somehow, just copy the .war file into [tomcat home]/webapps directory and your application will be deployed. You can then acces it at yourmachine:8080/warname
where warname == the name of the war file without the .war extension.
There appears to be a SQL script with the project as well, not sure if there is some database you might need to setup which could get tricky.

Web Services in Unix. What should be the directory structure

I earlier got to create a simple RESTful webservice on my localhost using Eclipse IDE, Tomcat, and JAX-RS libraries.
I am now trying to move the same on to a different unix server which has Tomcat installed. I am not knowing how to get started as in what is equivalent to creating a "Dynamic Web Project" that I do in Eclipse. Do I need to just create a directory myself with all the sub-directories as created by Eclipse? Should this directory be placed in webapps folder in Tomcat container. Should META-INF and WEB-INF also be created by myself?
Where should I put my Java classes?
Can somebody please clarify this or direct me to any documentation about the same.
You need to package your application in a WAR file.
The Sun Java EE 6 Tutorial has a chapter deciated to packaging.
It's pretty easy to export a web application as a war in Eclipse.
Dynamic Web Project (right click) => Export => Web =>war file =>war export dialog
Creation of web application archive - WAR is the solution for your problem,
but take care about all libraries that you need there.
You can easily extract (unzip) WAR file content
and check your project structure and libraries needed
and they will be in WAR's WEB-INF/lib.
Make sure that both Tomcats are set same way,
make sure your code is all OS friendly (users, file paths, permissions)
Always write some test simple code that will run up on app start,
and check all dependencies and libs, system clock, outside world network communication, so you can trace it in web app console or logger easily.
regards

Redirect classes to a remote location in eclipse

I am using eclipse 3.2 in windows environment. I have deployed the webserver in Solaris environment. I want to redirect the class files to the WEB-INF/ folder of the web server in Solaris. I tried using the RSE plug-in of the eclipse. I could see and access the files using the remote explorer but could not transer / redirect the class files from the package explorer to the webserver location. Is there any way to achieve this?
If you can mount the remote directory as a local drive (which I'm not sure you can do), you can use the FileSync plugin and set it up so that the files are copied from your /bin to the remote dir.
Another option is to use the commercial MyEclipse. Actually, WTP might have an option for remote deployment, of which I'm unaware.
But I would advice against such a thing, if the target server is something more than a development server. Better use a Continuous Integration engine (Hudson), together with maven/ant.

Categories

Resources