I don't know if this is the right one to post to, correct me and I will switch!
I am using java with eclipse photon with Apache tomcat 9. I am making a application that will be connected to server (local host or make a local host on the pc) and then I will be able to send things to this local host node to store on a document. I was woundering 2 questions before I embark on this adventure that I haven't found the answer to.
Number 1: I want to use websockets, and I have tried to find an API from tomcat website but can't find it. I have looked at bunches of API's, there is a lot of free ones, but they are confusing me a bit. There is the javaEE websocket, then their is also a tomcat version (although I'm having a problem finding that now lol), but I just want it to use localhost. In all the tutorials I have watched they use javaEE (expected), but now I don't know if tomcat and websockets work in anything other then javaEE.
number 2: My application relies on there being a local host on the machine it is running on. If I configure tomcat, and have my Server file in my project explorer for eclipse and have that inside my project folder that contains the scripts etc, when I finish and compile my application on installation for the user, I am assuming I will have to create a local server on the users machine on installation; but I was woundering(hoping) that is it simpler, and the local server folder (that I saved within the compiled file that the user will download) that contains the local server configuration will be carried over to the users version when they download. I am woundering this because of setting up ports etc.
Any wisdom or tutorials please link!
For number1 you can implement pure websocket for java with helping of this https://www.baeldung.com/java-websockets.
For number2 I suggest you two options:
Use an embedded version of tomcat then you can create a jar file and give it to your users to run it in their localhosts.
Write a ant task that when users run, your project files and resources copy to tomcat.
Related
I am a 2 months olds developer in Java Web development (New Job). I want to check for a way to setup local development with IDE & able to debug/work with remote web server.
The current practise in my company is access the web server with sftp (WinSCP), edit file with any text editor, and upload back to linux web server, then either compile the java file & restart in webserver or refresh the content after uploaded the jsp file.
The company is currently using SVN for version control, the web server can be Oracle iPlanet Web server or Apache Tomcat server.
I had go through Eclipse Remote Debugging but I cannot tell which project should I create at the beginning.
I tried to start with normal Java project, but unable to connect with the server.
Do forgive me if I asked this question in wrong section/wrong forum or maybe this seem pretty basic for you, and do point out which action I did wrongly and I supposed to find out more info/knowledge before proceed. Please do not use Intellij IDEA IDE (PAID IDE) as reference, due to currently is just my own idea to suggest a change from current development process in company, with no financial back up.
For database, I am totally satisfy with using Oracle SQL Developer to connect and develop.
Thanks for reading this.
I need to state up front that I am not a Java developer. So it is fair to assume that I know very little about the tooling etc. that Java dev's will be naturally familiar with.
So, I have created a Jersey web api (2.25.1) on my home server running Windows 2012. It serves data to a Xamarin application. I need to deploy this to a Linux server (Ubuntu) on AWS which my friend spun up.
At the moment, the only access I have is via SSH (Putty).
Tomcat (and Glassfish) have been installed on the Linux machine.
How do I go about deploying that application to that AWS server?
The official Jersey documentation seems to be MIA, and my Googling efforts don't yield much. There's a lot of SO questions with a similar title to this one. But I have not found any of the answers (and in many cases, questions) helpful to my cause.
Cheers
I assume that you are using maven to create your jersey web app .
Upon build you will get a *.war file .Copy the same to tomcat/webapps folder .
Start your tomcat then.
To take your file there on remote use winscp tool with your ssh credentials.
After some time of research I didn't find a complete answer to this. My scenario is as follow:
1 Windows client with Eclipse.
1 Debian server with Tomcat 8.
The idea is to use the remote Tomcat server in the Windows machine to avoiding install the local Tomcat plugin on it, and deploy the projects directly to the remote server vía Eclipse. Is this possible?
As the information I've read, I'm afraid that the local Tomcat server is mandatory in order to get access to de Java Servlets API (package javax.servlet.*). I have a project in Eclipse without any Tomcat (remote nor local) and this package is not available so can't compile.
So, there is a way to achieve what I want? I'm a bit lost in this, so may I have some misleading concepts and simply this is not possible for some good reason :).
Thank you in advance.
I'm trying to create a web project that is able to communicate with Amazon RDS. I know how to make a localhost project connect to a RDS with JDBC.
However, the problem is that I never tried to deploy my project (so that, for example someone can type somePage.com, and go to my webpage).
I have an Amazon EC2 instance, and I've already written a simple hello world jsp page. I am able to compile it and run the Eclipse Web Dynamic Project using the installed Apache Tomcat Server, and then typing localhost:8080/somePage then I can see my hello world popping up.
However, how do I deploy my project on this EC2 instance? I'm using Windows Server 2012 edition.
My whole idea is that once I have one AMI image all setup, then I can just use autoscale to scale my webpage with that AMI image.
Can anyone point me to the right direction?
Follow the steps below:
Setup Apache Tomcat on your Amazon EC2 instance.
Usually all you have to do is download the current version, unzip it, and start it by running apache-tomcat-folder\bin\startup.bat. (You can also donwload an installer and set it up as windows service. Check this link for more details).
Make sure you test it before continuing (open its address on a browser, something like http://yourinstaceaddress.com:8080/).
Export your web application .war file
In Eclipse, right click on a Web project and select Export. Then select WAR file in the Export window and then select Next. Choose the project, the .war file name and folder to export. More detailed explanation can be found here and here (with pictures).
Deploy the .war file to your Tomcat Server
The, by far, simplest way to do this is to place your .war (say myapp.war) file in your apache-tomcat-folder\webapps\ folder.
There are other ways, like via Tomcat Manager. But they can be tricky and, as a new user, you should avoid them. (Don't worry: the simple method is ok for production deployment).
Test your web app
Visit the url: say your .war's name was myapp.war. You should visit http://yourinstaceaddress.com:8080/myapp
That's it. If you ever edit the app, repeat steps 2-4 (but delete the webapps\myapp\ folder created before executing step 3).
Boxfuse does exactly what you want.
For you Java web application you literally only have to execute:
boxfuse create my-tomcat-app -apptype=load-balanced
boxfuse scale my-tomcat-app -capacity=1-16:t2-micro:cpu25-75
boxfuse run my-tomcat-app-1.0.war -env=prod
This will
Configure your application to use an ELB
Set it to autoscale between 1 and 16 t2.micro instances based on CPU usage (scale in at 25% and below, scale out at 75% and above)
Create AMI containg Tomcat and your application ready to boot
Create an ELB
Create a security group with the correct ports
Create an auto-scaling group
Launch your instance(s)
Any subsequent update will be done as a zero downtime blue/green deployment.
For your domain, you can simply map your samepage.com DNS record to the CNAME of the ELB.
More info: https://boxfuse.com/blog/auto-scaling
This is my first post on stackoverflow, so please excuse me if my question is stupid, in the wrong tags, not specific enough and just tell me how to improve my post ! I usually find all the answers I need going through the previously asked questions - and thank a lot the stack overflow community for this ! -, but not this time !
So, I'm student and I'm currently developping a java2EE web application to help a compagny managing its moulds stocks. I used struts2 framework to develop the application (which is called MMS) and it runs nicely on my personnal environment which is :
OS : windows7, 64 bits, service pack 1
Application Server : Apache Tomcat 7.0.27 to make MMS run on localhost
Database server : Wampserver2.2d to store the database of MMS
Java : Java JRE7 (jre_7u4-windows-x64)
IDE : Eclipse Java EE indigo sr2
Now I need to deploy my application on my employer's server. They gave me an access through the microsoft remote desktop tool to a windows 2003 server whose configurations are :
Microsoft windows server 2003 entreprise edition
Service Pack 2
My question is simple : how do I go from an application running well on my own environment to an application running on their server and accessible to their employees within their intranet ? Surprisingly enough I did not find any tutorial explaining how to do this. The documentation I found so far are the following :
Tomcat documentation : http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html
Microsoft documentation : http://msdn.microsoft.com/en-us/library/aa478983.aspx
Some other documentation explaining some of the logic (could not post the link because I'm a new user !)
My guess is :
First I need to prepare the environment, ie : install java, a servlet application server, and a MySQL server on windows 2003 server. For this I'd be tempted to install java JRE7, tomcat7, and wampserver2.2 on the windows 2003 server they gave me using the same .EXE I used on my PC.
Deploy MMS in the servelet application server : For this I think I could just drop the .WAR of MMS (created with Eclipse) on the webapp folder of tomcat.
Deploy my DB on the MySQL server : For this I'm thinking of exporting my DB from my computer and import it to the server using PHPmyAdmin (and a .SQL file)
Finally change the context.xml of MMS to make it able to communicate with its new DB.
Would this be enough to allow the employees of the societe I'm working for to access the web appication through their web browser (within the intranet of the compagny only) ?
Any anwser telling if I'm going on the write direction, if I forgot anything to do, giving advice, etc. would be truely appreciated :)
Thank you very much in advance !
Here is a generic solution I would suggest. You can simply install the wamp server package and the tomcat for windows. Upload your war file and start up mysql db, apache and tomcat services. Wamp server should come with php, mysql and phpmyadmin for your mysql. If you are good with batch file, you can make a batch file if you want to automate start, stop and restart all services.