I have created a SOAP service and using tomcat maven plugin for deploying in tomcat server.
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- <contextFile>${basedir}/src/main/webapp/META-INF/context.xml</contextFile> -->
</configuration>
</plugin>
</plugins>
</build>
I am able to start application and able to get wsdl also when using this end point - http://localhost:8080/soapapptest
everything is working, but when I used this endpoint http://localhost:8080 for getting tomcat home page then I got below page.
how I will get the tomcat home page where I can see my deployed war?
After starting application I am getting following logs
The home page is an application that gets deployed to the "ROOT" context. You'll find it in the downloadable Tomcat .tar.gz and .zip files. Unless your pom.xml deploys an application as ROOT, you are supposed to get a 404 response for /.
Related
Normally in Eclipse we run, Tomcat v7.0 Server at localhost
Can we add a tomcat which is located remotely on another IP address?
Currently, I'm running programs in Windows. I need it to be run with tomcat server which is located on another IP address on Linux.
Convert your web project to Maven Project and copy and paste the below code to your pom file.
<project ...>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://yourhost:8080/manager/text</url>
</configuration>
</plugin>
</plugins>
</build>
</project>
Convert your web project to Maven Project and copy and paste the below code to your pom file.
org.apache.tomcat.maventomcat7-maven-plugin2.1http://yourhost:8080/manager/text
Yes the above code is working you need to configure remote ip to url section.
I have a Spring MVC web application and tried running it using Jetty. But whenever I type
mvn jetty: run
I get the proper sequence of events ending in "Jetty Server Started"
But however when I try to open the browser and type in
http:localhost:8080/app
I get Error 404 page Not found
here is my pom.xml jetty part
<plugin>
<!-- This plugin is needed for the servlet example -->
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.2.0.v20101020</version>
<configuration>
<webApp>
<contextPath>/app</contextPath>
</webApp>
</configuration>
</plugin>
my controller is mapped to #RequestMapping("/") and my servlet is also mapped to /. The pom.xml build name is app thus the URL is http://localhost:8080/app
Any help with this would be great.
I have also tried with Jetty v9 and that doesn't work either
Try this it works fine
Edit
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.8</version>
<configuration>
<contextPath>/app</contextPath>
</configuration>
</plugin>
First thing http:localhost:8080/app is wrong it should be http://localhost:8080/app if you give this url then you must have a landing page that you can specify in web.xml
Like this
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
So simply try to access the url http://localhost:8080/app/index.jsp where there must be some index.jsp under the web-content folder
I'm using maven to build a war file for JBOSS AS 7. After a maven deploy, there is 'test.war' in the local repository, and a 'test-2.war' in the remote repository. This is all as expected (2 is the version in the POM).
If I manually deploy the 'test.war', everything works fine. If I deploy 'test-2.war' the deployment fails. If I rename 'test-2.war' to be 'test.war', the deployment works but trying to access it in a browser fails with error:
type Status report
message /test/Test
description The requested resource (/test/Test) is not available.
Since both war files are the result of the same maven build and deploy, why doesn't renaming the -2 version work the same as the first?
Is there a way I can deploy the -2 version without renaming, or what can I do to force the build so that I can rename the -2 version and have it deploy?
I know I can use maven's jboss deploy, but that's not an option in my case. I need the war file from the remote repository for manual deployments.
EDIT: The basic question here is why can't I rename the file {artifactId}-{version}.war to just {artifactId}.war and have it deploy in JBoss AS 7 properly?
You can rename the war like this:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warName>bird.war</warName>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
OR
<build>
<finalName>bird.war</finalName>
. . .
</build>
Take a look here
I have a REST web service which I created previously and deployed in Tomcat7. I wanted to deploy it on Jetty, as advised in a previous question, I made a Maven project and copied my files there and configured the dependencies and I can run Maven install from eclipse successfully.
This is my build part in POM.xml:
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<dependentWarExcludes></dependentWarExcludes>
<webappDirectory>
WebContent
</webappDirectory>
</configuration>
</plugin>
</plugins>
</build>
I followed instructions here to use maven jetty plug-in (I am not sure if this is required). The question here is how can I deploy my maven project in jetty from eclipse so that i can go to http:localhost:8080/myproject for example and see my project working?
EDIT:
The way I used to run the service on Tomcat was by right click on the project and click on Run As -> Run on server (which is configured in eclipse servers)
I am using eclipse Indigo, Maven 3 and jetty 8. Also I used jersey for the web service.
Here, you are mixing two different things:
Run your Web application using a Eclipse server plugin as Tomcat plugin for Eclipse.
Run your Web application using a Maven plugin as Jetty Maven plugin. There are also Maven plugins for Tomcat.
Having said that, take a look to this answer where it is described how to configure Eclipse to run Maven plugins (it could change depending on Eclipse version but idea would be similar)
Edited:
If you just want to run jetty from Maven, just use the following command line:
mvn jetty:run
But, in any case, I recommend that you indicate the Maven jetty plugin version in the pom file (Maven will warn you if you don't).
Edited 2
First, update your jetty maven plugin version:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.0.0.M2</version>
</plugin>
Second. You are working with two plugins, one for building the war file (maven-war-plugin) and another one for running your application on jetty (jetty-maven-plugin). Take in mind that jetty thinks your project has a standard maven project structure, it means, it will look for your web app content in /src/main/webapp but it looks like is not here. In your war plugin configuration, you specify that your web content is in WebContent, so tell jetty plugin that directory is there, as well as you are telling it to war plugin:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.0.0.M2</version>
<configuration>
<webAppSourceDirectory>/WebContent</webAppSourceDirectory>
<webXml>/over/here/web.xml</webXml>
<jettyEnvXml>/src/over/here/jetty-env.xml</jettyEnvXml>
<classesDirectory>/somewhere/else</classesDirectory>
<configuration>
</plugin>
See documentation. Of course, it is better to work with a standard maven project structure so you do not need to tell jetty where things are.
I tried to use cargo-maven2-plugin to automate my WAR module deployment for testing.
I wonder how can I start the tomcat server (pre-installed in my machine) and deploy my war to the started server automatically?
Documentation from Cargo project mentions that cargo:start goal can optionally deploy deployables:
http://cargo.codehaus.org/Maven2+plugin#Maven2plugin-gettingstarted
cargo:start Start a container. That task can optionally install and configure a container; it can also optionally deploy deployables (WAR, EAR, etc.) to it.
However, I have no idea how to enable this option to make it deploy deployables when running cargo:start.
Here is my current pom configuration:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<configuration>
<wait>true</wait>
<container>
<containerId>tomcat6x</containerId>
<home>${tomcat.home}</home>
</container>
<configuration>
<type>standalone</type>
<home>target/tomcat6x</home>
</configuration>
<deployer>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>my-war</artifactId>
<type>war</type>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>my-war</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
When I run "mvn cargo:start", the tomcat server will be started, however, the my-war deployable won't be deployed. And I have to run "mvn cargo:deploy" from another shell to deploy this war.
OK -- There are a few things going on here:
1) You mention that the Tomcat server is pre-installed on the machine, but yet you have the directory specified in your target directory. This is not a good idea as that will get wiped out after a mvn clean.
2) For pre-installed Tomcat you are not setting the type to existing inside the deployer configuration.
3) Where is your context definition? Do you have a context fragment file or are you using a tomcat.xml file inside the WEB-INF directory in the WAR?
Bottom line a combination of configuration errors are holding you back. Post an updated Maven configuration and addition details about the XML context definition and I can help you further.