EricssonResearch / scott-eu

SCOTT – Secure Connected Trustable Things
https://scottproject.eu/uc04-logistics-management-using-collaborative-robots-and-devops-methodologies/
Apache License 2.0
20 stars 8 forks source link

Lyo 4.0 JAX-RS 2.0 migration breaks twins #150

Closed berezovskyi closed 5 years ago

berezovskyi commented 5 years ago

From Portainer logs:

java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;

    at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:120)

    at org.eclipse.lyo.oslc4j.core.OSLC4JUtils.servletUriBuilderFrom(OSLC4JUtils.java:478)

    at org.eclipse.lyo.oslc4j.core.OSLC4JUtils.setServletPath(OSLC4JUtils.java:455)

    at se.ericsson.cf.scott.sandbox.whc.servlet.ServletListener.contextInitialized(ServletListener.java:76)

@jadelkhoury made the migration in https://github.com/OSLC/lyo-adaptor-sample-modelling/commit/60ea9ca9fa63443378ec8393324fa807423d3b90, we should do the same.

berezovskyi commented 5 years ago

Problems caused by TRS Server were fixed by https://github.com/eclipse/lyo.trs-server/pull/26

Problems caused by TRS Client are tracked in https://github.com/eclipse/lyo.trs-client/issues/28

berezovskyi commented 5 years ago

@jadelkhoury I am actually still at loss:

image

I have tried everything I can to clean up the POM and to clean the IDE cache but I still get that nasty error. Here is my deps tree:

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ webapp-whc ---
[INFO] se.ericsson.cf.scott.sandbox:webapp-whc:war:0.0.1-SNAPSHOT
[INFO] +- se.ericsson.cf.scott.sandbox:domain-pddl:jar:0.0.1-SNAPSHOT:compile
[INFO] |  \- org.checkerframework:checker-qual:jar:2.5.2:compile
[INFO] +- se.ericsson.cf.scott.sandbox:lib-common:jar:0.0.1-SNAPSHOT:compile
[INFO] |  \- org.eclipse.paho:org.eclipse.paho.client.mqttv3:jar:1.2.0:compile
[INFO] +- org.eclipse.lyo.trs:trs-server:jar:4.0.0-SNAPSHOT:compile
[INFO] |  +- org.eclipse.lyo:oslc-trs:jar:4.0.0-SNAPSHOT:compile
[INFO] |  \- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.eclipse.lyo.store:store-core:jar:4.0.0-SNAPSHOT:compile
[INFO] |  +- org.eclipse.lyo.core.query:oslc-query:jar:4.0.0-SNAPSHOT:compile
[INFO] |  |  \- org.antlr:antlr-runtime:jar:3.5.2:compile
[INFO] |  +- org.apache.jena:apache-jena-libs:pom:3.6.0:compile
[INFO] |  |  +- org.apache.jena:jena-tdb:jar:3.6.0:compile
[INFO] |  |  |  \- org.apache.jena:jena-arq:jar:3.6.0:compile
[INFO] |  |  |     +- org.apache.jena:jena-core:jar:3.6.0:compile
[INFO] |  |  |     |  +- org.apache.jena:jena-iri:jar:3.6.0:compile
[INFO] |  |  |     |  +- commons-cli:commons-cli:jar:1.4:compile
[INFO] |  |  |     |  \- org.apache.jena:jena-base:jar:3.6.0:compile
[INFO] |  |  |     |     +- org.apache.commons:commons-csv:jar:1.5:compile
[INFO] |  |  |     |     \- com.github.andrewoma.dexx:collection:jar:0.7:compile
[INFO] |  |  |     +- org.apache.jena:jena-shaded-guava:jar:3.6.0:compile
[INFO] |  |  |     +- com.github.jsonld-java:jsonld-java:jar:0.11.1:compile
[INFO] |  |  |     |  +- com.fasterxml.jackson.core:jackson-core:jar:2.9.0:compile
[INFO] |  |  |     |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.0:compile
[INFO] |  |  |     |  |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] |  |  |     |  \- commons-io:commons-io:jar:2.5:compile
[INFO] |  |  |     +- org.apache.httpcomponents:httpclient-cache:jar:4.5.3:compile
[INFO] |  |  |     +- org.apache.thrift:libthrift:jar:0.10.0:compile
[INFO] |  |  |     +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] |  |  |     \- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] |  |  +- org.apache.jena:jena-tdb2:jar:3.6.0:compile
[INFO] |  |  |  \- org.apache.jena:jena-dboe-trans-data:jar:3.6.0:compile
[INFO] |  |  |     +- org.apache.jena:jena-dboe-transaction:jar:3.6.0:compile
[INFO] |  |  |     |  \- org.apache.jena:jena-dboe-base:jar:3.6.0:compile
[INFO] |  |  |     \- org.apache.jena:jena-dboe-index:jar:3.6.0:compile
[INFO] |  |  \- org.apache.jena:jena-rdfconnection:jar:3.6.0:compile
[INFO] |  +- org.apache.jena:jena-querybuilder:jar:3.6.0:compile
[INFO] |  \- xml-apis:xml-apis:jar:1.3.04:compile
[INFO] +- org.eclipse.lyo.oslc4j.core:oslc4j-core:jar:4.0.0-SNAPSHOT:compile
[INFO] |  +- javax.ws.rs:javax.ws.rs-api:jar:2.1:compile
[INFO] |  +- javax.xml.bind:jaxb-api:jar:2.2:compile
[INFO] |  |  +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  \- org.assertj:assertj-core:jar:3.8.0:compile
[INFO] +- org.eclipse.lyo.oslc4j.core:oslc4j-jena-provider:jar:4.0.0-SNAPSHOT:compile
[INFO] |  \- xerces:xercesImpl:jar:2.8.0:compile
[INFO] +- org.eclipse.lyo.oslc4j.core:oslc4j-json4j-provider:jar:4.0.0-SNAPSHOT:compile
[INFO] |  \- org.apache.wink:wink-json4j:jar:1.2.1-incubating:compile
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.4.9:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.5:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.25:runtime
[INFO] +- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] +- com.google.guava:guava:jar:23.0:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
[INFO] |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.27:compile
[INFO] |  +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.27:compile
[INFO] |  |  \- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b42:compile
[INFO] |  +- org.glassfish.jersey.core:jersey-common:jar:2.27:compile
[INFO] |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] |  \- org.glassfish.jersey.core:jersey-server:jar:2.27:compile
[INFO] |     +- org.glassfish.jersey.core:jersey-client:jar:2.27:compile
[INFO] |     +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.27:compile
[INFO] |     \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.glassfish.jersey.inject:jersey-hk2:jar:2.27:compile
[INFO] |  \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b42:compile
[INFO] |     +- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42:compile
[INFO] |     +- org.glassfish.hk2:hk2-api:jar:2.5.0-b42:compile
[INFO] |     |  \- javax.inject:javax.inject:jar:1:compile
[INFO] |     +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b42:compile
[INFO] |     \- org.javassist:javassist:jar:3.22.0-CR2:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] +- javax.servlet:jstl:jar:1.2:provided
[INFO] +- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.3.20:compile
[INFO] |  +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.3.20:compile
[INFO] |  |  +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.3.20:compile
[INFO] |  |  \- org.jetbrains:annotations:jar:13.0:compile
[INFO] |  \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.3.20:compile
[INFO] \- junit:junit:jar:4.12:test
[INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test
berezovskyi commented 5 years ago

@jadelkhoury sorry for the false alarm. Seems like I had broken deps under my M2 folder. Switching to Jersey 2.26 or 2.28 removed warnings.

berezovskyi commented 5 years ago

But I have a question regarding the base URI, @jadelkhoury:

How are we supposed to produce this URI even before the context initialisation event? I load the URI from the web.xml.

You just hardcoded it in the Application class: https://github.com/OSLC/lyo-adaptor-sample-modelling/commit/60ea9ca9fa63443378ec8393324fa807423d3b90#diff-f0ffe2c6bda92d771257d76c3525c75bR129

berezovskyi commented 5 years ago

Another question @jadelkhoury:

The fix for the client (https://github.com/OSLC/lyo-adaptor-sample-modelling/commit/60ea9ca9fa63443378ec8393324fa807423d3b90#diff-24dbf31a056f8a216e75f5090c86a92fR45) does not work. Your patch never got merged; @jamsden's client is in master but not deployed on Maven.