4
respostas

Erro ao abrir "Jetty" após inicia-lo com sucesso!

Meu arquivo pom.xml:

    <build>
        <finalName>lojaweb</finalName>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.3.7.v20160115</version>
            </plugin>
        </plugins>
    </build>

index.jsp

<html>
<body>
<h2>Hello World!</h2>
</body>
</html>

Quando inicio usando: mvn jetty:run

[INFO] <<< jetty-maven-plugin:9.3.7.v20160115:run (default-cli) < test-compile @ lojaweb <<<
[INFO] 
[INFO] 
[INFO] --- jetty-maven-plugin:9.3.7.v20160115:run (default-cli) @ lojaweb ---
[INFO] Configuring Jetty for project: lojaweb Maven Webapp
[INFO] webAppSourceDirectory not set. Trying src/main/webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = /home/cefs1984/workspace/lojaweb/target/classes
[INFO] Logging initialized @6421ms
[INFO] Context path = /
[INFO] Tmp directory = /home/cefs1984/workspace/lojaweb/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:///home/cefs1984/workspace/lojaweb/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = /home/cefs1984/workspace/lojaweb/src/main/webapp
[INFO] jetty-9.3.7.v20160115
[INFO] Started o.e.j.m.p.JettyWebAppContext@2def7a7a{/,file:///home/cefs1984/workspace/lojaweb/src/main/webapp/,AVAILABLE}{file:///home/cefs1984/workspace/lojaweb/src/main/webapp/}
[INFO] Started ServerConnector@35f3a22c{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
[INFO] Started @7580ms
[INFO] Started Jetty Server

Quando acesso o navegador: localhost:8080

HTTP ERROR 500

Problem accessing /. Reason:

    Server Error

Caused by:

javax.servlet.ServletException: org.apache.jasper.JasperException: Unable to compile class for JSP:
4 respostas

Bom dia Carlos, pode mandar a stack inteira do erro por favor? e todo seu pom.xml

Stack inteira (mvn jetty:run):

~/workspace/lojaweb$ mvn jetty:run
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building lojaweb Maven Webapp 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> jetty-maven-plugin:9.3.7.v20160115:run (default-cli) > test-compile @ lojaweb >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ lojaweb ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ lojaweb ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ lojaweb ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/cefs1984/workspace/lojaweb/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ lojaweb ---
[INFO] No sources to compile
[INFO] 
[INFO] <<< jetty-maven-plugin:9.3.7.v20160115:run (default-cli) < test-compile @ lojaweb <<<
[INFO] 
[INFO] 
[INFO] --- jetty-maven-plugin:9.3.7.v20160115:run (default-cli) @ lojaweb ---
[INFO] Logging initialized @2919ms
[INFO] Configuring Jetty for project: lojaweb Maven Webapp
[INFO] webAppSourceDirectory not set. Trying src/main/webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = /home/cefs1984/workspace/lojaweb/target/classes
[INFO] Context path = /loja
[INFO] Tmp directory = /home/cefs1984/workspace/lojaweb/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:///home/cefs1984/workspace/lojaweb/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = /home/cefs1984/workspace/lojaweb/src/main/webapp
[INFO] jetty-9.3.7.v20160115
[INFO] Started o.e.j.m.p.JettyWebAppContext@4110765e{/loja,file:///home/cefs1984/workspace/lojaweb/src/main/webapp/,AVAILABLE}{file:///home/cefs1984/workspace/lojaweb/src/main/webapp/}
[INFO] Started ServerConnector@280d4882{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
[INFO] Started @3563ms
[INFO] Started Jetty Server

OBS: Quando acesso: (localhost:8080/loja/contato), tudo funciona normalmente! Stack de erro após acessar:(localhost:8080/loja/), só da erro no index.jsp:

ERRO CONSOLE:

https://pastebin.com/raw/Cv4Xy5wV

ERRO NAVEGADOR:

https://pastebin.com/raw/K6qwe0Uc

ARQUIVO: 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>
      <properties>
        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>
      </properties>    
    <groupId>br.com.alura.maven</groupId>
    <artifactId>lojaweb</artifactId>
    <packaging>war</packaging>
    <version>1.0.0-SNAPSHOT</version>
    <name>lojaweb Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>br.com.caelum.stella</groupId>
            <artifactId>caelum-stella-core</artifactId>
            <version>2.1.2</version>
        </dependency>    

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>        

    </dependencies>
    <build>
        <finalName>lojaweb</finalName>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.3.7.v20160115</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                        <webApp>
                            <contextPath>/loja</contextPath>
                        </webApp>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Acrescenta a dependencia de jsp pra ver se para esse erro

Amigo, eu assisti a aula 6 do curso de maven, começou a funcionar a página index.jsp quando excluí executei a parte do curso que era necessário excluir do eclipse o 1º projeto "produtos" e incluí-lo no repositório local para ser utilizado como dependencia no "lojaweb". Parecia conflito ou cache, não manjo muito de java, então fica difícil opinar!

Obrigado e abraços!