tomcat deletes exploded webapps - deployment

Each time I shut down Tomcat server, it deletes my exploded webapp. What do I have to do to stop that? It's really inconvenient constantly copying it again under the webapps dir.

This can happen with Tomcat 5 if you have a WAR under your webapps directory. Tomcat has 3 modes of deployment,
Context fragment. A XML file under conf/Catalina/[host]
WAR. A file ended with war in appBase (normally webapps)
Directory. A directory (normally exploded WAR) in appBase
Looks like you are mixing 2 & 3 and Tomcat is confused. If you put war under webapps, Tomcat will explode it automatically. If you want explode it yourself, don't put WAR under webapps and Tomcat should leave your directory alone.
You can also run WAR without exploding it by adding this to your Context,
unpackWAR="false"

I've never seen it do that.
One option would be to place the exploded webapp in a directory outside of the Tomcat install, then add a deployment descriptor referencing it in the conf/Catalina/localhost directory. I typically work that way, and Tomcat has never deleted any files on me!

Related

Jetty deploy war file (Automatic Deployment is not working)

this is my first time deploying a war File to a Jetty Server via SCP+SSH and I'm not able to get it to work.
I made a proper .war file with Eclipse (but I also tested the same things I'm going to mention with a example .war file) and copied the file to the folder /jetty/webapps/ROOT. Now when I restart Jetty and try to get on the server (I tried Serveradress/WarFilename/ aswell) I get to a Directory Path and I'm able to download the war file but nothing else.
I also tried to copy the war file to the webapps folder itself instead of webapps/ROOT. What am I doing wrong?
The directory ${jetty.base}/webapps/ROOT/ is for exploded webapps, or static resource deployments.
If you want to serve your war file, say myapp.war on the root context "/", then copy it to the file ${jetty.base}/webapps/ROOT.war
Note: if you are copying the file into the jetty-distribution/webapps/ you are doing it wrong, go read up on how ${jetty.base} and ${jetty.home} work.

Deploy a War file with Eclipse and Tomcat 6 without a build file

I know there are a bunch of posts on this topic, but I can't seem to figure it out. Here is my setup:
- Eclipse Indigo
- Tomcat 6
- Struts WAR file that I imported into Eclipse from http://www.manning.com/dbrown/SampleApplication.zip
I added the server to Eclipse, and added the project to the server. It runs fine, but I'd like to make some changes to the XML and java files (not the jsp files). I was under the impression that Eclipse takes care of the deployment after I save and restart the server, but I guess this isn't the case. I looked into creating an ant file to do a custom build, but I'm not really sure how to make it since I don't even know how to do a deployment "manually". How would I go about doing a manual deployment? Thanks.
A war file is usually created by exporting it from an IDE like eclipse, netbeans, etc.
While generating a war file there is 2 options,
You can include your java files with it
You can avoid java files from it.
In both the cases class files will be there which are created from java files. Class files will be able to take care of the actions of java class.
If the war file which you down loaded is not having those java files, you will not be able to use it with eclipse, where as it will work fine if you are putting it into tomcat directory for running.
For running a war file manually just put it into tomcat webapps folder and run tomcat.
Then you can access the pages using the url.
http://localhost:8080/yourprojectname/
If you want to check whether the war file contains any java files, after starting the tomcat server it will extract the war file into the same directry, where you can search for java files.
If you want to run the project from eclipse,
import it into eclipse, open index.jsp page
right click-> run as-> run on server
if you have not yet configured the server yet,select the server in the list, specify its installation path, then add projects into server in next step, finish it. then it will load your project.
Please provide little more details so that we can help you better.
manual: copy the war in the tomcat folder then start tomcat.
if you want to use eclipse you need to click redeploy war first by right clickling the deployed war in the servers tab under tomcat.

Jboss not copying xsds to data folder when deploying

Using Jboss 5.0.1.GA, I have an exploded .ear file that's copied to the deploy directory of my server segment, when JBoss starts it doesn't copy some xsds I have in that exploded .ear to the server segment/data directory. Just to iterate, it does copy some of them, just not all.
If I copy the files manually from the exploded .ear to the data directory, then that's fine, but I shouldn't have to do that. Anyone had this problem?

tomcat do not unpack war file

i stopped tomcat
paste myapp.war into webapps folder.
start tomcat
call in browser
http://localhost:8080/myapp/index.jsf
see 404
also tomcat does not generate log files under logs directory.
I am using eclipse to start and stop tomcat, and my tomcat 7 is an unzipped version.
to be sure that my war file runs on server, i remove same project from tomcat in eclipse servers view.
repeating question, but i think my situation is a little different, tomcat does not generate logs.
a note: i generate war file by right click in eclipse-> export war file.
thanks for any idea.
If you are launching tomcat from within Eclipse (using the webtools tomcat server adapter) you will have to make sure you have changed the settings to use the installation directory to launch instead of the default which uses a separate location for loading and deploying webapps. So if you add a war directly into the webapps folder, the server launched from Eclipse server adapter wont have that directly setup in the server.xml configuration.
So you should use the startup.bat/startup.sh in the tomcat/bin folder. If you do, you need to make sure that you don't just copy the .war file into the webapps, but rather unzip the war file into a directory folder called "myapp"

deploy.last in JBoss 5.1 in web configuration?

We have ear that depends on war file.
We use web configuration.
I put war file to <jboss_home>/server/web/deploy directory.
And I put ear file to <jboss_home>/server/web/deploy/deploy.last directory.
But ear starts prior to war.
Why?
I use a similar configuration to what you describe, though I put all the apps I want to deploy first in deploy/myapps and all the ones to deploy afterwards in deploy/myapps.last. This works correctly for me on JBoss 5.1.2.
Although I can't explain why it isn't working for you, I can offer an alternative solution. You can make the EAR declare a dependency on the WAR and JBoss will then ensure the WAR is deployed first.
First, add a file called aliases.txt into the META-INF directory of your WAR. This file should just contain a single line with an arbitrary name / identifier for your WAR. For example, if you have mywebapp.war, your META-INF/aliases.txt file could contain 'mywebapp'. It just needs to be something that won't clash with any other aliases declared by other apps deployed on the same server.
Next, add a jboss-dependency.xml file to the META-INF directory of your EAR, containing the following (subsituting 'mywebapp' for the alias you created above):
<dependency xmlns="urn:jboss:dependency:1.0">
<item whenRequired="Real" dependentState="Create">mywebapp</item>
</dependency>
This should ensure the WAR is deployed before the EAR.
Also, if you try to deploy the EAR without the WAR being present, JBoss will log a clear deployment error message telling you about the missing dependency.