How to add project to tomcat server in intellij - java

I've been able to configure my tomcat server in Intellij and have been able to run the server successfully. However, I can't seem to find where to actually add my project to the server in intellij. I'm used to using eclipse where I would right-click my server and use the "Add and Remove" feature for the server. Is there something similar in intellij?

Firstly, you can find the configuration page of server,
And add a new tomcat server,
and then set the webapp home as you need in the new server,
At last, the new server is the server you need.

Create a web Facet at File - Project Structure
Create an Artifact from this Facet at the same page
Add a tomcat run configuration at Run - Edit configurationes, go to the Deployment tab, add you artifact to Deploy at the server startup

Related

How to deploy a Spring MVC Maven project from Eclipse to an existing Glassfish server

I've got a Spring MVC Maven project written in Eclipse that was verified as working with an Apache Tomcat 7 as the web container.
I am trying to transfer it to my "server" pc where I want to deploy it to the my existing glassfish (4.1) server as the web container.
I am having a very hard time finding a big enough partial answer to get the rest of the way.
I have tried to just export the .war file to the autodeploy folder which resulted in a "deployfailed" file.
I have tried to setup a "new server" using glassfish tools, but I realized that this is creating a new server and the existing server blocks the socket connection.
Eclipse doesn't see to have standard web commands like build, clean or deploy, but I would happily settle for advice on how to tell it to deploy to the existing glassfish server similar to how I was able to with tomcat at my training location.
Check this answer. Then follow the following steps.
Go to the project in the Project Explorer.
Select the web project.
Right click and select "Run As", you will see glashfish. Select it and click run.

Remote app server deployment

I want to deploy WAR package when I build it with Netbeans on remote server.
One solution that I found is to use maven-cargo plugin. Have you tried this plugin with JBoss and WebLogic? But are there other options?
For Weblogic
Netbeans 8.1 allows you to add a remote Weblogic server.
Right click on Servers and select "Add Server" -> "Remote Domain"
For JBoss, Tomcat etc.
I secure copy my war to the remote server on the command line to the auto deploy or webapps directory.
It's quick and easy in my opinion.
(Maven cargo gave me grey hair...)

How to deploy Java project to Tomcat

I have downloaded a sample extjs+mysql+spring web project (link) with a java backend that I'd like to set up locally on my machine. I have installed Tomcat server, and MySQL DB but it's my first time ever with a java-based web application and I have troubles setting it up. Does it require any modifications ? I thought that .jsp files should be included there, but I can only see .java sources. Do I need to build it before it's ready for deployment ? Any help appreciated.
This is an Eclipse project so you'd need to run it from within Eclipse.
Download Eclipse
Open the project in it
Define a Tomcat container in your Servers tab
Drag and drop the project onto the newly defined Tomcat
Run it
if your are using eclipse IDE for development, create a project in eclipse,
run as "run on server" , and set the running server (eg TOMCAT 7).
and thats it,,
make sure, you correctly setup spring project in IDE with all needed jar files .

steps for adapt eclipse dynamic web project to have a site in real server

I wrote a small servlet and jsp project on eclipse and tomcat 5.5, but I don't know with works I do for make that a real site on a real host. Should I war them or I should upload project on host? My host should have which properties? I really don't now how to start?
I would recommend packaging them in a war and deploying it out to the remote tomcat server. Its not a good idea to deploy an unpackaged project directly to the server unless your debugging or testing. Once you have a finished project ready to deploy package it to a war. I typically deploy to server using the tomcat manager page. Just browse for the war, click the upload button and it should start right up. On my local machine this is the url that I use to upload to the server http://localhost:8080/manager. The server itself should have the same properties and settings that you are using in your eclipse workspace, and I would highly recommend that it be the same version as well. The war can also be dropped into a directory on the remote host and Tomcat will load this on startup, this location will vary depending on the host.

Trying to use tomcat with eclipse

I am trying to use tomcat with eclipse. I have installed it all and got the tomcat plugin installed. I have put a .war file in the webapps folder of tomcat and have made sure autodeploy is set to true. The problem I am having is that I can't get tomcat to run this .war file. The tomcat server is started and running as it tells me under the servers tab at the bottom of eclipse. It also shows the name of my .war file under it and says synchronized meaning it at least knows its there. But I can't get it to work at all. Even when I go to the local host page it shows the title of apache tomcat but does not show the file. I want it to show me the .war file. It has the correct xml files and everything in it. Any help is much appreciated.
You may try to check whether the application is deployed or not. You can directly go to the Tomcat directory to see this.
Another possible thing could be, you might be typing the incorrect url.
http://localhost:8080/[your_application]
where 8080 is the port you have specified for tomcat.
You need to let Eclipse publish your web project for you when using the Eclipse Tomcat plugin instead of trying to manually deploy it youself.
The Tomcat plugin for Eclipe supports hot deployment whereby you can change jsp's etc without having to manually redeploy your web application.
If you have a valid web project in eclipse then you can check that it is being deployed by looking at the Server View.
Window, Show View, Other, Server
This window should contain details of your Apache server. (If no server is listed then you'll need to right click on the list and set one up.)
To check that your application is being deployed right click on your server and select Add/Remove projects. Check that your web project is listed. If it is not listed under Configured Project then add it.
If your project does not appear in the list then it probably wasn't setup as a Dynamic Web Project. You can fix this by by right clicking on the project to bring up project properties and then clicking on facets and then enabling Dynamic Web Project.
It is also worth having the Console view visible when starting/stopping Tomcat so that you can see the server output.
Start tomcat from the command line (not eclipse) and see if your webapp shows up. It should if you have indeed created a valid war file. If it doesn't work, check the logs.
You shouldn't be manually deploying the war file if you are using eclipse to launch tomcat. Running tomcat from eclipse does not necessarily use the same default workspace as the standalone tomcat. Check the configurations for the 'server': it may be that the eclipse launched server's webapp folder is empty.
If for some reason your webapp failed to initialize properly (error in the descriptor, an uncaught exception in a context listener, ...) tomcat will unload it and you won't see anything at http://localhost:8080/yourwebapp.
Is it there in the list of applications in tomcat manager?
if you havent done this...then follow the steps...
Go to http://localhost:8080/
Go to Tomcat manager and check if your application is there in the list of deployed applications. Try redeploying or starting the application if running=false. It usually tells you what is wrong when you do that.

Categories