I'm using Jenkins for war deployment to my remote server which uses Tomcat 7.
I need my application to be directly installed at dedicated port like this:
http://localhost:8083
instead of usual:
http://localhost:8080/myCoolApp
To achieve this I deploy my war archive as ROOT directly to 'webapp' Tomcat's directory.
Everything works fine, archive is sent and deployed but I get an error from Jenkins:
Just to remind - archive is deployed successfully!
But as a perfectionist I just can't stand a result like this.
Here is my configuration for Jenkins deployment:
Here is Tomcat configuration for my application as a separate service:
<Service name="Jangel">
<Connector port="8083" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443" />
<Engine name="Jangel" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" />
<Host name="localhost" appBase="Jangel" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
So the question is - how should I configure correctly Tomcat&Jenkins?
Or how may I avoid/silence this Jenkins error?
Try this by replacing the context path in your jenkins deployment by / (slash) instead of writing ROOT.
Related
suggest me any idea for running 2 different projects in the same ide like NetBeans but I think I can change my tomcat server port number to run like this but I am not sure can anyone suggest any idea Thanks in advance
I don't know about NetBeans but I can tell about Eclipse. 1. Open each project in a different instance of the IDE. 2. Set the tomcat port for each of them different and run the servers. By this way you can run the both the projects simultaneously. Example. I am running a node server in one eclipse instance with port 8080 and running a tomcat server in another eclipse instance with port 9080. Both of them running perfectly
You just need to learn how to start tomcat on different port(s). as per your project needs. There is no concern with IDEs. You can use any IDE for code. Tomcat itself a server. You can run it by CMD with different instances.
You can configure your tomcat in you server.xml file and put 2 services :
<Service name="app1">
<Connector port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="app1"
unpackWARs="true" autoDeploy="true">
</Host>
</Engine>
</Service>
<Service name="app2">
<Connector port="8082" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="app2"
unpackWARs="true" autoDeploy="true">
</Host>
</Engine>
</Service>
I'm doing some deploy / start / stop tests locally on my computer, and it would be very comfortable to have my webapps deployed (so they can be managed throught the Tomcat manager webapp) but not started right away when Tomcat start.
Is this feasible at all?
Within the documentation I only found how to deploy or not deploy a webapp at all (through the "Host" configuration in server.xml).
This is a portion of my server.xml:
<Host name="host1.localpc" appBase="C:\tools\tomcat\webapps\host1" unpackWARs="true" autoDeploy="true" deployIgnore="^(?!ROOT$).*?$" deployOnStartup="true">
<Context docBase="C:\tools\tomcat\runnable\apache-tomcat-7.0.69\webapps\manager" path="/manager" privileged="true" />
</Host>
<Host name="host2.localpc" appBase="C:\tools\tomcat\webapps\host2" unpackWARs="true" autoDeploy="true" deployIgnore="^(?!ROOT$).*?$" deployOnStartup="true">
<Context docBase="C:\tools\tomcat\runnable\apache-tomcat-7.0.69\webapps\manager" path="/manager" privileged="true" />
</Host>
<Host name="host3.localpc" appBase="C:\tools\tomcat\webapps\host3" unpackWARs="true" autoDeploy="true" deployIgnore="^(?!ROOT$).*?$" deployOnStartup="true">
<Context docBase="C:\tools\tomcat\runnable\apache-tomcat-7.0.69\webapps\manager" path="/manager" privileged="true" />
</Host>
Hostnames are handled throught the Windows HOSTS file.
I'm running Tomcat 7.0.69
Hum... Certainly, as far as I know, any war is automatically started by Tomcat just after being deployed. Still, I'd suggest you to take a look at the Tomcat Client Deployer, a module from which you can get an Ant script to deploy-and-stop your application. To accomplish this, you should:
Download the TCD.
Parametrize the build.xml.
Invoke ant deploy stop to deploy and stop.
Hello I'm trying to deploy .war application from the public_html folder at user homes.
I've added directive to server.xml :
<Listener className="org.apache.catalina.startup.UserConfig"
directoryName="public_html"
userClass="org.apache.catalina.startup.PasswdUserDatabase"/>`
And I try :
http://localhost:8080/~usertest/app
And it return : 404 error
Then I try : http://localhost:8080/~usertest/app.war
It download app.war but it doesn't serve the app.
User home contains folder :
public_html/app.war
So, what is the problem?
I'm using tomcat 7
After many tries, and ask on tomcat mail-list, It's not possible to deploy (and execute) WAR files inside public_html user's homes.
Tomcat haven't this feature, but there is one alternative:
Create one virtual host per user (hostname, or port), where each user deploy war applications, like (server.xml) :
...
<Connector port="8082" ....
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="app_user_a" unpackWARs="true" autoDeploy="true">
...
<Connector port="8083" ....
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="app_user_b" unpackWARs="true" autoDeploy="true">
...
I have deployed web application on tomcat7 and now I am looking forward to update Virtual host to map domain name with my application by updating server.xml.
Is my approach correct?
I am working on ubuntu OS and not sure how to get the context path for my web app. Any help is greatly appreciated.
The context path of your application will be the name of the war file. If you want to override it, you can follow Tomcat's documentation (https://tomcat.apache.org/tomcat-7.0-doc/config/context.html).
Edit the server.xml in the conf folder of the tomcat installation and make the following changes.
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Context path="/yoururl" docBase="YourApp" useHttpOnly="false">
<Manager pathname="" />
</Context>
</Host>
I want to deploy my app to the server, and then I can visit the app like this:
http://10.10.10.10/index.jsp
but not
http://10.10.10.10/bar/index.jsp
so this is my host configuration in server.xml:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context docBase="/home/foo/bar.war" reloadable="false" path=""/>
</Host>
But, after I start up tomcat
sh $CATALINA_HOME/bin/startup.sh
I found that tomcat does not unpack the war file in $CATALINA_HOME/webapps.
then I try to delete all files in $CATALINA_HOME/webapps/ROOT, but it does not matter.
so is there someone come cross this issue before? and how to solve the probelm?
Tomcat 7 does not unpack WAR files from outside the Host's appBase into the appBase.
Tomcat 7 will run your application from the WAR.