3
respostas

Erro ao ao baixar e configurar o Jetty pelo maven


C:\Users\klermann\Desktop\AplicacaoFinanceira\contas>mvn jetty:run
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for br.com.augebit:contas:war:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.eclipse.jetty:jetty-maven-plugin is missing. @ line 176, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building contas Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:9.4.3.v20170317:run (default-cli) > test-compile @ contas >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ contas ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ contas ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ contas ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\klermann\Desktop\AplicacaoFinanceira\contas\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ contas ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< jetty-maven-plugin:9.4.3.v20170317:run (default-cli) < test-compile @ contas <<<
[INFO]
[INFO] --- jetty-maven-plugin:9.4.3.v20170317:run (default-cli) @ contas ---
[INFO] Configuring Jetty for project: contas Maven Webapp
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = C:\Users\klermann\Desktop\AplicacaoFinanceira\contas\target\classes
[INFO] Logging initialized @3945ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] Context path = /
[INFO] Tmp directory = C:\Users\klermann\Desktop\AplicacaoFinanceira\contas\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:///C:/Users/klermann/Desktop/AplicacaoFinanceira/contas/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = C:\Users\klermann\Desktop\AplicacaoFinanceira\contas\src\main\webapp
[INFO] jetty-9.4.3.v20170317
[INFO] Scanning elapsed time=3356ms
[INFO] 2 Spring WebApplicationInitializers detected on classpath
18:55:21.057 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletConfigInitParams] PropertySource with lowest search precedence
18:55:21.064 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletContextInitParams] PropertySource with lowest search precedence
18:55:21.081 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [jndiProperties] PropertySource with lowest search precedence
18:55:21.081 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
18:55:21.085 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
18:55:21.085 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
[INFO] Started ServerConnector@101ca8da{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
[INFO] Jetty server exiting.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.478 s
[INFO] Finished at: 2017-03-28T18:55:25-03:00
[INFO] Final Memory: 28M/439M
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/C:/MavenJava/apache-maven-3.3.9/lib/aether-api-1.0.2.v20150114.jar
constituent[1]: file:/C:/MavenJava/apache-maven-3.3.9/lib/aether-connector-basic-1.0.2.v20150114.jar
constituent[2]: file:/C:/MavenJava/apache-maven-3.3.9/lib/aether-impl-1.0.2.v20150114.jar
constituent[3]: file:/C:/MavenJava/apache-maven-3.3.9/lib/aether-spi-1.0.2.v20150114.jar
constituent[4]: file:/C:/MavenJava/apache-maven-3.3.9/lib/aether-transport-wagon-1.0.2.v20150114.jar
constituent[5]: file:/C:/MavenJava/apache-maven-3.3.9/lib/aether-util-1.0.2.v20150114.jar
constituent[6]: file:/C:/MavenJava/apache-maven-3.3.9/lib/aopalliance-1.0.jar
constituent[7]: file:/C:/MavenJava/apache-maven-3.3.9/lib/cdi-api-1.0.jar
constituent[8]: file:/C:/MavenJava/apache-maven-3.3.9/lib/commons-cli-1.2.jar
constituent[9]: file:/C:/MavenJava/apache-maven-3.3.9/lib/commons-io-2.2.jar
constituent[10]: file:/C:/MavenJava/apache-maven-3.3.9/lib/commons-lang-2.6.jar
constituent[11]: file:/C:/MavenJava/apache-maven-3.3.9/lib/commons-lang3-3.4.jar
constituent[12]: file:/C:/MavenJava/apache-maven-3.3.9/lib/guava-18.0.jar
constituent[13]: file:/C:/MavenJava/apache-maven-3.3.9/lib/guice-4.0-no_aop.jar
constituent[14]: file:/C:/MavenJava/apache-maven-3.3.9/lib/javax.inject-1.jar
constituent[15]: file:/C:/MavenJava/apache-maven-3.3.9/lib/jsoup-1.7.2.jar
constituent[16]: file:/C:/MavenJava/apache-maven-3.3.9/lib/jsr250-api-1.0.jar
constituent[17]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-aether-provider-3.3.9.jar
constituent[18]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-artifact-3.3.9.jar
constituent[19]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-builder-support-3.3.9.jar
constituent[20]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-compat-3.3.9.jar
constituent[21]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-core-3.3.9.jar
constituent[22]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-embedder-3.3.9.jar
constituent[23]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-model-3.3.9.jar
constituent[24]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-model-builder-3.3.9.jar
constituent[25]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-plugin-api-3.3.9.jar
constituent[26]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-repository-metadata-3.3.9.jar
constituent[27]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-settings-3.3.9.jar
constituent[28]: file:/C:/MavenJava/apache-maven-3.3.9/lib/maven-settings-builder-3.3.9.jar
constituent[29]: file:/C:/MavenJava/apache-maven-3.3.9/lib/org.eclipse.sisu.inject-0.3.2.jar
constituent[30]: file:/C:/MavenJava/apache-maven-3.3.9/lib/org.eclipse.sisu.plexus-0.3.2.jar
constituent[31]: file:/C:/MavenJava/apache-maven-3.3.9/lib/plexus-cipher-1.7.jar
constituent[32]: file:/C:/MavenJava/apache-maven-3.3.9/lib/plexus-component-annotations-1.6.jar
constituent[33]: file:/C:/MavenJava/apache-maven-3.3.9/lib/plexus-interpolation-1.21.jar
constituent[34]: file:/C:/MavenJava/apache-maven-3.3.9/lib/plexus-sec-dispatcher-1.3.jar
constituent[35]: file:/C:/MavenJava/apache-maven-3.3.9/lib/plexus-utils-3.0.22.jar
constituent[36]: file:/C:/MavenJava/apache-maven-3.3.9/lib/slf4j-api-1.7.5.jar
constituent[37]: file:/C:/MavenJava/apache-maven-3.3.9/lib/slf4j-simple-1.7.5.jar
constituent[38]: file:/C:/MavenJava/apache-maven-3.3.9/lib/wagon-file-2.10.jar
constituent[39]: file:/C:/MavenJava/apache-maven-3.3.9/lib/wagon-http-2.10-shaded.jar
constituent[40]: file:/C:/MavenJava/apache-maven-3.3.9/lib/wagon-http-shared-2.10.jar
constituent[41]: file:/C:/MavenJava/apache-maven-3.3.9/lib/wagon-provider-api-2.10.jar
constituent[42]: file:/C:/MavenJava/apache-maven-3.3.9/conf/logging/
---------------------------------------------------
Exception in thread "main" java.util.ServiceConfigurationError: org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
        at org.apache.juli.logging.LogFactory.<init>(LogFactory.java:78)
        at org.apache.juli.logging.LogFactory.<clinit>(LogFactory.java:66)
        at org.apache.tomcat.websocket.server.WsServerContainer.<clinit>(WsServerContainer.java:77)
        at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)
        at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47)
        at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:140)
        at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:63)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:329)
        at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1480)
        at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp(JettyWebAppContext.java:357)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1442)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:799)
        at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:540)
        at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:432)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
        at org.eclipse.jetty.server.Server.start(Server.java:452)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at org.eclipse.jetty.server.Server.doStart(Server.java:419)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:460)
        at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:328)
        at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:170)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
3 respostas

Oi Clerman,

parece que vc está tentando rodar um app Springboot com Jetty, no entanto o Springboot já inclui o Tomcat. E isso traz conflitos entre os JARs.

Tem como colocar aqui o seu pom.xml?

abs, Nico

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>br.com.augebit</groupId>
    <artifactId>contas</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>contas Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>

        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.1</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <version>2.1.1</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.35</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.2.6.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>4.2.6.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aspects</artifactId>
            <version>4.2.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.1.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>1.3.6.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>1.3.6.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <version>1.3.6.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.10.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.0.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>4.1.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.8.Final</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.2.2.Final</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>1.14</version>
        </dependency>

        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20090211</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.0</version>
        </dependency>


        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.6.3</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-hibernate4</artifactId>
            <version>2.5.3</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>contas</finalName>
    </build>
</project>

Oi Clerman,

adicione a tag exclusion na dependencia spring-boot-starter-web, também adicione uma nova dependencia spring-boot-starter-jetty:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
   <!-- nova tag exclusions-->
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<!-- nova dependencia-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

abs