Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

swagger-samples/java/java-jersey2 does not compile or run #154

Open
@steranka

Description

I'm running with Java 11 (maven 3.5.3) on Windows 10 host and the java-jersey2 example does not compile. I just jumped in to that example as it seemed to be a starting point for me to learn Swagger.

The doc page says to run
mvn package -Dlog4j.configuration=file:./conf/log4j.properties jetty:run

That produces a bunch of errors: Cannot find symbol javax.xml.bind.annotation and other errors.

My request is to have the documentation updated so that the steps compile and run. I know that it might be related to using newer versions of Java and maven so I'll try this with an older version of java to see if that helps. There also might be "spec/interfaces" jar file that I'm missing to support compiling, if so please let me know.

Below are details of my environment

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T14:49:05-05:00)
Maven home: C:\P\apache-maven-3.5.3\bin\..
Java version: 11.0.1, vendor: Oracle Corporation
Java home: C:\PROGRA~1\Java\JDK-11~1.1
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

C:\Play\2018-11\swagger-samples\java\java-jersey2>mvn package -Dlog4j.configuration=file:./conf/log4j.properties jetty:run
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------< io.swagger:swagger-jersey2-sample-app >----------------
[INFO] Building swagger-jersey2-jaxrs-app 1.0.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (enforce-maven) @ swagger-jersey2-sample-app ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (enforce-versions) @ swagger-jersey2-sample-app ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:copy-resources (copy-resources) @ swagger-jersey2-sample-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 11 resources
[INFO]
[INFO] --- scala-maven-plugin:3.1.5:add-source (default) @ swagger-jersey2-sample-app ---
[INFO] Add Source directory: C:\Play\2018-11\swagger-samples\java\java-jersey2\src\main\scala
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ swagger-jersey2-sample-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- download-maven-plugin:1.2.1:wget (swagger-ui) @ swagger-jersey2-sample-app ---
[INFO] Got from cache: C:\Users\user1\.m2\repository\.cache\maven-download-plugin\master.tar.gz
[INFO] Expanding: C:\Play\2018-11\swagger-samples\java\java-jersey2\target\master.tar.gz into C:\Play\2018-11\swagger-samples\java\java-jersey2\target
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ swagger-jersey2-sample-app ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 22 source files to C:\Play\2018-11\swagger-samples\java\java-jersey2\target\classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/util/ApiAuthorizationFilterImpl.java: C:\Play\2018-11\swagger-samples\java\java-jersey2\src\main\java\io\swagger\sample\util\ApiAuthorizationFilterImpl.java uses or overrides a deprecated API.
[WARNING] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/util/ApiAuthorizationFilterImpl.java: Recompile with -Xlint:deprecation for details.
[INFO] 2 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/User.java:[23,2] cannot find symbol
  symbol: class XmlRootElement
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/User.java:[21,1] package javax.xml.bind.annotation does not exist
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/Category.java:[21,2] cannot find symbol
  symbol: class XmlRootElement
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/Category.java:[19,1] package javax.xml.bind.annotation does not exist
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/Pet.java:[26,2] cannot find symbol
  symbol: class XmlRootElement
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/Tag.java:[21,2] cannot find symbol
  symbol: class XmlRootElement
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/Pet.java:[24,1] package javax.xml.bind.annotation does not exist
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/Tag.java:[19,1] package javax.xml.bind.annotation does not exist
[ERROR] /C:/Play/2018-11/swagger-samples/java/java-jersey2/src/main/java/io/swagger/sample/model/Order.java:[25,2] cannot find symbol
  symbol: class XmlRootElement

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions