[Resolvido] Tomcat sobe mas não faz deploy da aplicação

Amigos, socorro

  1. Baixei o projeto do git
  2. rodei o mvn clean install e mvn eclipse:eclipse
  3. Tentei adicionar o projeto no tomcat, dentro do eclipse, mas o projeto não aparecia para ser adicionado
  4. cliquei com botao direito no projeto, project facets, e converti o projeto para dynamic module web
  5. adicionei o projeto no tomcat e subi o server
  6. o tomcat subiu sem erro, mas a aplicação não subiu

Observação: curioso que o deploy por fora do eclipse funciona que é uma beleza

1 curtida

Qual tipo de aplicação?

Amigo, uma aplicação web comum utilizando o ecosistema spring rs

Posta o pom.xml, pois, o tomcat precisa estar entre as dependências.
Já tive alguns problemas parecidos, pois o tomcat tem certos problemas com o padrão do maven e acaba não conseguindo fazer as coisas do modo correto.

1 curtida

Opa, segue

<?xml version="1.0"?>

<project
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
        xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <modelVersion>4.0.0</modelVersion>


    <parent>
        <artifactId>projetoX</artifactId>
        <groupId>br.com.projeto</groupId>
        <version>1.0</version>
    </parent>

    <artifactId>projetoXY</artifactId>
    <packaging>war</packaging>
    <name>projetoXY</name>

    <dependencies>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.15</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.15</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.15-beta1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.6.3</version>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-security</artifactId>
            <version>2.1.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.samaxes.filter</groupId>
            <artifactId>cachefilter</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
        </dependency>
        <dependency>
            <groupId>opensymphony</groupId>
            <artifactId>sitemesh</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
        </dependency>
        <dependency>
            <groupId>br.com.caelum</groupId>
            <artifactId>vraptor</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javassist</groupId>
                    <artifactId>javassist</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>br.com.caelum</groupId>
            <artifactId>iogi</artifactId>
        </dependency>
        <dependency>
            <groupId>net.vidageek</groupId>
            <artifactId>mirror</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream-hibernate</artifactId>
            <version>1.4.3</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
        </dependency>
        <dependency>
            <artifactId>dom4j</artifactId>
            <groupId>dom4j</groupId>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.imgscalr</groupId>
            <artifactId>imgscalr-lib</artifactId>
            <version>4.2</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
        </dependency>
        <dependency>
            <groupId>com.lowagie</groupId>
            <artifactId>itext</artifactId>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.barbecue</groupId>
            <artifactId>barbecue</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-hibernate4</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.9</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml</groupId>
            <artifactId>jackson-module-hibernate</artifactId>
            <version>1.9.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>jackson-mapper-asl</artifactId>
                    <groupId>org.codehaus.jackson</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-csv</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.lightcouch</groupId>
            <artifactId>lightcouch</artifactId>
        </dependency>
        <dependency>
            <groupId>br.com.jcomputacao</groupId>
            <artifactId>nfexml</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${org.springframework.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${org.springframework.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${org.springframework.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-acl</artifactId>
            <version>${org.springframework.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${org.springframework.security.version}</version>
        </dependency>
        <dependency>
            <groupId>org.ektorp</groupId>
            <artifactId>org.ektorp.spring</artifactId>
        </dependency>




        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.7</version>
            <exclusions>
                <exclusion>
                    <groupId>jsr173_api</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.7.0</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.7.0</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.7.0</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.7.0</version>
        </dependency>

    </dependencies>

    <build>

        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>reports/*.jrxml</exclude>
                </excludes>
            </resource>
        </resources>

        <finalName>projetoXY</finalName>

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

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>classeMain</mainClass>
                    <classpathScope>test</classpathScope>
                    <!-- <commandlineArgs>cleanData</commandlineArgs> -->
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.codehaus.mojo</groupId>
                                        <artifactId>jasperreports-maven-plugin</artifactId>
                                        <versionRange>[1.0-beta-2,)</versionRange>
                                        <goals>
                                            <goal>compile-reports</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
         

        <profile>
    
            <id>qa4</id>
            <properties>
                <jndi-name>java:comp/env/jdbc/projetoXY</jndi-name>
                <dataSourceURL>jdbc:mysql://ip:porta/projetoXY</dataSourceURL>
                <dataSourceUsername>usuario</dataSourceUsername>
                <dataSourcePassword>senha</dataSourcePassword>
                <testDataSourceURL>jdbc:mysql://ip:porta/projetoXYTest</testDataSourceURL>
                <testDataSourceUsername>usuario</testDataSourceUsername>
                <testDataSourcePassword>senha</testDataSourcePassword>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.1</version>
                        <configuration>
                            <source>1.7</source>
                            <target>1.7</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>jasperreports-maven-plugin</artifactId>
                        <configuration>
                            <outputDirectory>${project.build.directory}/classes/reports</outputDirectory>
                            <sourceDirectory>src/main/resources/reports</sourceDirectory>

                            <server>tomcat-server</server>
                            <url>http://localhost:8080/manager/text</url>
                        </configuration>
                        <version>1.0-beta-2</version>
                        <executions>
                            <execution>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>compile-reports</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>net.sf.jasperreports</groupId>
                                <artifactId>jasperreports</artifactId>
                                <version>5.0.0</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>tomcat-maven-plugin</artifactId>
                        <version>1.1</version>
                        <configuration>
                            <server>tomcat-server-qa</server>
                            <url>http://10.10.50.195:8080/manager/text</url>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>

Quais frameworks esse projeto está usando?

Então, trata-se de uma aplicação utiliza alguns modulos do ecosistema spring tais como: core, mvc, security; Além desses, há o jpa, vraptor e jquery. Eu consegui fazer funcionar, após ter tentando importar para eclipse informando a opção: “existent maven project”; Antes, eu importava o projeto pelo “from git project”.

O maven possui uma estrutura específica de diretórios, que é diferente do padrão do eclipse. O exemplo mais claro é onde cada um armazena arquivos da parte web em si, o maven usa o /main/webapp e o eclipse não.
O que ocorria, o container não encontrava o web.xml e se perdia nisso.

Eu desconheci isso, muito obrigado por me explicar rsrs

Agradeço também a todos que me ajudaram ao longo deste topico.

Para ficar mais claro:
Eclipse:
jstl_lib

Maven:
maveneclipse3