Question

I have created a rest webservice with jersey. I like to add swagger to my project to create documentation for the rest interface. As an example i downloaded a rest project with swagger. It is a maven project.

I installed maven on ubuntu & installed maven plugin into eclipse,

After a Maven clean, maven install & maven build on the project.
i get a few errors in console:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

In stackoverflow i see that someone has added manually this jar file?
Is it not a job for maven, because the dependency is in the pom?

--------------------------------------

...


2013-12-25 20:32:55.209:INFO:oejs.Server:jetty-8.1.11.v20130520
2013-12-25 20:32:56.168:WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext{/api,file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples/java-jaxrs/target/swagger-java-sample-app_2.9.1-1.3.0-RC1/},file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples/java-jaxrs/target/swagger-java-sample-app_2.9.1-1.3.0-RC1/
java.util.zip.ZipException: invalid entry size (expected 6164 but got 4968 bytes)
    at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:386)
    at java.util.zip.ZipInputStream.read(ZipInputStream.java:156)
    at java.util.jar.JarInputStream.read(JarInputStream.java:195)
    at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:100)
    at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:78)
    at java.util.jar.JarInputStream.getNextEntry(JarInputStream.java:130)
    at java.util.jar.JarInputStream.getNextJarEntry(JarInputStream.java:167)
    at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:162)
    at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:100)
    at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:82)
    at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:84)

.....

INFO] Started Jetty Server
[INFO] 
[INFO] --- maven-failsafe-plugin:2.6:integration-test (default) @ swagger-java-sample-app_2.9.1 ---
[INFO] No tests to run.
[INFO] 
[INFO] --- jetty-maven-plugin:8.1.11.v20130520:stop (stop-jetty) @ swagger-java-sample-app_2.9.1 ---
[INFO] 
[INFO] --- maven-source-plugin:2.1.2:jar-no-fork (attach-sources) @ swagger-java-sample-app_2.9.1 ---
[INFO] 
[INFO] --- maven-javadoc-plugin:2.7:jar (attach-javadocs) @ swagger-java-sample-app_2.9.1 ---
2013-12-25 20:32:56.778:INFO:oejsh.ContextHandler:stopped o.m.j.p.JettyWebAppContext{/api,file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples

....

I get also this errors in Problems tab:


'/home/scorpio/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.1.5/jackson-databind-2.1.5.jar' in project 'swagger-java-sample-app_2.9.1' cannot be read or is not a valid ZIP file    swagger-java-sample-app_2.9.1       Build path  Build Path Problem

maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.  pom.xml /swagger-java-sample-app_2.9.1  line 2  Maven Project Build Lifecycle Mapping Problem

Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.0:add-source (execution: default, phase: initialize) pom.xml /swagger-java-sample-app_2.9.1  line 2  Maven Project Build Lifecycle Mapping Problem

Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.0:testCompile (execution: default, phase: test-compile)  pom.xml /swagger-java-sample-app_2.9.1  line 2  Maven Project Build Lifecycle Mapping Problem

-------

pom file:

<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">
  <parent>
    <groupId>com.wordnik</groupId>
    <artifactId>swagger-project_2.9.1</artifactId>
    <version>1.3.0-RC1</version>
    <relativePath>../..</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.wordnik</groupId>
  <artifactId>swagger-java-sample-app_2.9.1</artifactId>
  <packaging>war</packaging>
  <name>swagger-java-jaxrs-app</name>
  <version>1.3.0-RC1</version>
  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.6</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty-version}</version>
        <configuration>
          <webAppConfig>
            <contextPath>/api</contextPath>
          </webAppConfig>
          <webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
          <webDefaultXml>${project.basedir}/conf/jetty/webdefault.xml</webDefaultXml>
          <stopPort>8079</stopPort>
          <stopKey>stopit</stopKey>
          <connectors>
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
              <port>8002</port>
              <maxIdleTime>60000</maxIdleTime>
              <confidentialPort>8443</confidentialPort>
            </connector>
          </connectors>
        </configuration>
        <executions>
          <execution>
            <id>start-jetty</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <scanIntervalSeconds>0</scanIntervalSeconds>
              <daemon>true</daemon>
            </configuration>
          </execution>
          <execution>
            <id>stop-jetty</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>com.wordnik</groupId>
      <artifactId>swagger-jaxrs_2.9.1</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_2.9.1</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
    </dependency>
  </dependencies>
</project>

Could someone give some extra info so that i can go on?
Thx
Was it helpful?

Solution

There are multiple issues according to your logs

2013-12-25 20:32:56.168:WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext{/api,file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples/java-jaxrs/target/swagger-java-sample-app_2.9.1-1.3.0-RC1/},file:/home/scorpio/Downloads/swagger-core-swagger-project_2.9.1-1.3.0-RC1/samples/java-jaxrs/target/swagger-java-sample-app_2.9.1-1.3.0-RC1/
      java.util.zip.ZipException: invalid entry size (expected 6164 but got 4968 bytes)

This simply means that th ZIP file is invalid/improper. Either it was not creates properly or an inturrupt occured during download. I would recommend deleting the file and re-creating/re-donwloading it

'/home/scorpio/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.1.5/jackson-databind-2.1.5.jar' in project 'swagger-java-sample-app_2.9.1' cannot be read or is not a valid ZIP file    swagger-java-sample-app_2.9.1       Build path  Build Path Problem

Delete this file and re-acquire it

maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.  pom.xml /swagger-java-sample-app_2.9.1  line 2  Maven Project Build Lifecycle Mapping Problem

Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.0:add-source (execution: default, phase: initialize) pom.xml /swagger-java-sample-app_2.9.1  line 2  Maven Project Build Lifecycle Mapping Problem

Plugin execution not covered by lifecycle configuration: net.alchim31.maven:scala-maven-plugin:3.1.0:testCompile (execution: default, phase: test-compile)  pom.xml /swagger-java-sample-app_2.9.1  line 2  Maven Project Build Lifecycle Mapping Problem

All these errors points to one things, the limitation of the m2e eclipse plugin. There are certain plugin goals that are not covered by m2e plugin. THeres nothing much that you can do about it except make sure to verify that the wars are made properly with each build.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top