How does IntelliJ automatically deploy the webapp in tomcat? - java

How does IntelliJ automatically deploy the webapp in tomcat?
Just wondering as after the webapp has been deployed and run, there are no traces of the web app in the tomcat folder. (Not even the servlet classes' files).
Does it create those file and delete straight after execution?
Thanks in advance.

IntelliJ is deploying the exploded WAR which exists in your compilation target directory (for my project, it's target - it could be out for yours, depends on if you're using Maven or some other dependency management application), in the process explained at this Wiki link.
So, the artifact always exists in your target or out directory. If it didn't exist, then Tomcat would pitch a fit.

Related

JAR libraries to TomCat

My servlet application uses JavaMail API and Java Activation Framework (JAF). I do development in IntelliJ IDE. TomCat runs on the same local Windows machine. When I try to run my Servlet from IntelliJ I have error related to fact TomCat not finds mentioned libraries. What is the right place to store libraries for TomCat? Is it possible ask IntelliJ to place required libraries to TomCat ?
Put the jar files in the WEB-INF/lib folder. If there isn't one, create one manually.
This way the jar files are added to the war file that gets created when you build your artifact, and tomcat knows where to find those jars at runtime.

Can I deploy multiple WAR archive files to local Tomcat with IntelliJ IDEA?

I have two applications with two separate WAR artifacts. One is a WAR exploded directory for my front-end Angular app, and one is a WAR archive file for my back-end Spring REST api. I'm currently using IntelliJ IDEA to deploy my front-end to a local Tomcat server and was wondering how, if at all possible, I could configure IntelliJ to run my two artifacts on Tomcat simultaneously. I know I can do this by putting both under Tomcat webapps directory manually, but I was wondering if it was configurable in IntelliJ, and if so, how?
Yes, you should be able to do that.
If you are using Ultimate, you can create a "Local Tomcat" run
configuration in Project1, and go to the "Deployment" tab and drop in
the WAR file for your Project1. Then drop in the WAR file from your
other project (call it Project2) as an External Source. You would
then have both WARs in one run configuration.
This is the answer I found out under this link.

Is there a way to deploy a Maven project with "jar" packaging into Tomcat7?

My project generates a Jar as the output package and uses an external War file, available on our Artifactory, as the Web Application to be deployed on Tomcat (currently using version 7). This War file contains all libs and modules required for the application to run.
I have already packaged and ran those projects outside eclipse on a "vanilla" Tomcat installation. In this scenario, the Jar my project generates is loaded on the context.xml file this way:
<Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="/home/igor/workspace/myapp/myapp-2.4.3.jar"/>
Is there a way I can deploy this project on Tomcat using Eclipse and still be able to debug it? Can I use the Jar generated for this purpose or do I have to deploy the workspace project?
As for the War file, do (or can) I have to add it as an dependency?
Thanks in advance!
EDIT
We actually provide an Web Framework, which is packaged as a war. Other applications that use that framework are exported as jars and loaded into the framework through the context file as cited above.
Your question is confusing probably because of your custom plugin/classloader and deployment which is sort of orthogonal to debugging.
What I recommend is you keep whatever system you have to build/package/deploy and use JVM remote debugging. That is do not use the Eclipse WTP since you seem to have custom steps for deployment but rather build your code deploy & run a separate Tomcat instance and then run the remote debugger in Eclipse.
You will get some hotcode swapping with this method but not as much as something like JRebel.. (which you could use also) it will certainly be better than constantly redeploying.

Jboss Quickstart using Maven (jboss-as:deploy)

I am new to Maven, I am trying to go through the EAP(JBoss) clusterhasingleton quick start guide.
http://www.jboss.org//quickstarts/eap/cluster-ha-singleton/index.html
I can deploy the jar and everything works fine by running
mvn clean install jboss-as:deploy
I need someone to please explain what does "Deploy" mean in Maven/EAP as i have used JBoss 5 and deployment in that version meant copying the jar in deployments folder(i was using ant) where as i can't find the jar file in the deployments folder in EAP although everything is working.
I can see the jars in the local repository in .m2 folder and target folder in the workspace. How does Jboss know that is deployed? and does it look at the local repository and how?
Kind Regards,
Why does it matter?
In any case the maven repo is not relevant. In JBoss 5/6, placing applications in the "deploy" directory would indicate to JBoss that those applications should be deployed.
You can do the same thing in JBossAS 7.x (aka EAP 6) and WildFly 8.x using the "deployments" directory.
It's important to understand that deployments are not in-situ. The actual deployment is stored in a virtual file system. The deployment is written directly to this VFS when you use the maven tool.
The deployment process is much more than just copying WAR and EAR artifacts into the server. For instance, servlets, EJBS, JPA components, CDI components and other managed objects get wired up, validated and perhaps made available in JNDI.

Deploying Eclipse Java Dynamic web project on Apache Tomcat permanently

I have a Java web project in Eclipse which I run through Eclipse on Apache Tomcat.
Is there a way for me to permanently deploy the project on Tomcat such that it runs without having to open Eclipse and rather just starting Tomcat?
If yes, then what steps do I need to follow?
*UPDATE*
If I take the .war file and deploy it on another system will it work? Note that I am using a MySql database in this project. So will transferring the .war file also transfer the database?
You package the project into a war file (since it is a web project) and put that one into the Tomcat's webapps folder. The deployment should then happen automatically, when Tomcat is started.
Generate a WAR file within Eclipse. (Properties->Export->WAR File)
Place this file in the {installation}/webapps folder of Tomcat.
It should deploy now.

Categories

Resources