开发者

Setting up a server for hosting Java EE apps at home

开发者 https://www.devze.com 2023-03-05 00:05 出处:网络
I have an old P4 machine that I\'d like to user for hosting and demoing my Java EE apps. This is not a \"production\" server. People don\'t pay money, businesses don\'t depend on it etc.. it is only t

I have an old P4 machine that I'd like to user for hosting and demoing my Java EE apps. This is not a "production" server. People don't pay money, businesses don't depend on it etc.. it is only to show my projects during interviews to potential employers.

I will be primarily working with

  • Servlets
  • JSPs
  • Struts
  • Spring Framework
  • Hibernate Framework
  • MySQL database

In my dev machine, I usually run my servlets and JSPs in Tomcat, and Spring applications in the server which comes with the spring source toolset. I am so used to pressing the play button in the 开发者_JAVA百科IDE that I really didn't care to know about how the servers will be setup in the production server.

Considering the type of apps I do and the frameworks and technologies I mentioned..

  • What servers should I set up in my demo machine?
  • Where can I learn how to deploy to those servers?

P.S. The machine will be running Windows 7.


You can try to use

  • Tomcat is really already enough for what you're planning to do
  • Glassfish has a superior web administration, and is a real EE container

To deploy an application to a remote server, if you are using Eclipse, you can choose File, Export, WAR file, choose a destination, click finish. This will create a Web application ARchive, that you can then upload to the webapps directory in Tomcat and will be automatically unpacked and deployed.

However, this process can become tedious, because when libraries are included in the WAR file it could weight many megabytes and the upload time can be long.

One thing that I often do when I've to upload frequently a web application under development, is write an ant file that would create a deployment in a temporary folder and then use rsync to upload only modified files to the remote server.


Considering it's just a demo server. You not need to take much hassle. Do the following:

  1. Install Tomcat, MySQL on your demo server.

  2. Whenever you want to deploy, just Remote Desktop to your Windows machine and copy the WAR file or the app directory, replacing the older application.

The app will be accessible at http://ip.of.the.machine:TomcatPort/WAR_OR_APP_DIR_NAME e.g. http://192.168.0.29:8080/mydemoapp

This answers your question -- but there is a hint I found in your question that you wanted to show this app to your probable employer... obviously, you can't do it until you make your machine visible to internet.

Couple of ideas:

  1. Easiest is, ask a static IP from your ISP, and directly connect to your machine without any router in between. Set machine's firewall to accept HTTP request at Tomcat port.

  2. Look what no-ip offers, it used to be free in my college days. Hope it still is.

  3. If you have router, you will have to tweak NAT configuration

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号