SpringBoot with embedded Jetty does not unpack the war file - java

I am deploying a war with embedded jetty using SpringBoot. I start it using java -jar .war. The web app run fine, but the war file is not unpacked to any directory. I have tried setting -Djava.io.tmpdir, and even tried customizing JettyEmbeddedServletContainerFactory and setting the tempDir after extracting the WebAppContext out of the Server. My customizer runs and correctly sets the tempDir, but the war is not unpacked at all.
What do I have to do make it unpack the war file ?

Related

Problem with deploying IntelliJ war file build with tomcat

I am using the simple IntelliJ web project with the default configuration.
I don't see any servlet mapping in the web.xml file:
web.xml file
However, when I run the project in IntelliJ it just works fine:
Project
But when I build it as a war file and deploy it with my tomcat server I can't access the hello-servlet.
Why Local IntelliJ tomcat server works even without proper servlet-mapping on the web.xml file and why it does not work on the tomcat server when I copy the war file into webapps directory.

Web Deployment Assembly not used by Tomcat7

My understanding is when running tomcat inside of eclipse, during publishing... eclipse will copy files based on the settings in Web Deployment Assembly to tomcat directory. I added my app to Tomcat 7 thru Server --> "Add or Remove...", when I start tomcat, I don't see any files been copied to /usr/share/tomcat7/wtpwebapps/myapp folder. BTW, I have all the folder structure (folders) under tomcat directory, but missing all the files (like .class, .properties, .xml and ...). This is the error I am getting when start tomcat. BTW, the directory show in the pic is the directory under tomcat. I thought the publishing process copies files from eclipse to tomcat dir? It looks like it's trying to copy files from tomcat dir to somewhere else. What am I missing? My Server path and Deploy path are all correct.
It's a permission thing. Also I recommend install tomcat manually instead of running apt-get.
Either https://askubuntu.com/questions/17223/permissions-problem-when-copying-files-to-usr-share-tomcat6 or http://www.frattv.com/tomcat-can-t-start-from-ide-eclipse-luna-wtp-intellij-idea-in-ubuntu/ will work.

How to get the path of an .ear file in application server?

I use JBoss 7.0 and WebSphere 8.5 application servers to deploy my .ear file which has .wars and EJB .jars.
How to get my .ear file path using Java eg. jboss7.0/standalone/deployments/sample.ear? If needed, I can use a separate Java servlet class.
If you are in a war file you can call ServetContext.getRealPath("/") which will give you the file system path to the war file. The war should be in the ear. This of course assumes that these are expanded as directories and not .war/.ear files (getRealPath only returns a non-null path in the former case).

Compile Netbeans Web app with Java files (for deployment on XAMPP?)

I have NetBeans web application, with HTML, JavaScript, CSS files... and I have some Java files which I manage to call in the web application with DirectWebRemoting.
It is using NetBean's Tomcat.
After "Clean and Build", I get a WAR file in dist/
I put this WAR file into XAMPP/tomcat/webapps directory
Run the application with XAMPP Tomcat, but then the Java files would not work using XAMPP's Tomcat.
Question: How do I compile the build, so that when I put into XAMPP it would work? This is so that everytime I run the application I don't need to turn NetBeans on.
Use the Tomcat Manager application to upload the war file, dropping them directly in the /webapps directory doesn't work for me sometimes too.
Here's a link to know more about using Tomcat Manager Application

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