1

I am trying to deploy a webapplication using maven cargo plugin into tomcat server.

But i am getting the below error when i am running the command mvn cargo:deploy in the command prompt.

[INFO] Failed to deploy [C:\Users\Ramesh\workspace\SimpleSpringMvcExample\target \SimpleSpringMvcExample.war] FAIL - Encountered exception java.io.FileNotFoundException: C:\Program Files\Apa che Software Foundation\Tomcat 6.0\webapps\SimpleSpringMvcExample.war (Access is denied)

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.SimpleSpringMvcExample</groupId>
    <artifactId>SimpleSpringMvcExample</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>SimpleSpringMvcExample Maven Webapp</name>
    <url>http://maven.apache.org</url>

    .....

    <build>
        <finalName>SimpleSpringMvcExample</finalName>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>

                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.tomcat.manager.url>http://localhost:8080/manager</cargo.tomcat.manager.url>
                            <cargo.remote.username>admin</cargo.remote.username>
                            <cargo.remote.password>admin</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>remote</type>
                        <deployables>
                            <deployable>
                                <groupId>com.SimpleSpringMvcExample</groupId>
                                <artifactId>SimpleSpringMvcExample</artifactId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <version>1.0-beta-1</version>
            </plugin>
        </plugins>
    </build>
</project>

tomcat-users.xml

<?xml version='1.0' encoding='cp1252'?>

<tomcat-users>
<user name="admin" password="admin" roles="admin,manager" />
</tomcat-users>

maven settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
  </servers>
  <mirrors>
  </mirrors>
  <profiles>
  </profiles>
</settings>

I think i gave the correct id & password of tomcat admin in the pom.xml But dont know whats wrong?

It was working fine..but suddenly started throwing this error...after i used the maven-tomcat-plugin for one of the sample spring projects..

I dont know if it has anything to do with this...

Please help me in locating the problem..

Thanks in Advance.

1 Answer 1

3

From the error it appears that there is an issue with permissions - maven does not seem to have permission placing the .war file in tomcat's webapps folder.

Are you on Vista/Windows 7 with UAC turned On?

Sign up to request clarification or add additional context in comments.

1 Comment

I googled for UAC an turned it off and now it is working fine..Thanks buddy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.