Same app can't send http request by docker compose - spring-boot

Spring boot
retrofit 2
docker
in my docker-compose file:
version: "3"
services:
server:
image: asubscriber/eshop:1.0.1
build: .
ports:
- 8090:8090
Run my app (Spring boot) from console like this:
java -jar build/libs/eshop-1.0.1.jar eshop-1.0.1.jar
Run success. And success to http request. Here log:
[INFO ] 2020-03-14 21:41:09.480 [OkHttp http://localhost:8091/...] OkHttpClient - --> POST http://localhost:8091/api/v1/notifyEmail?emailTo=a_subscriber%40mail.ru&action=order_update&orderId=38 http/1.1
[INFO ] 2020-03-14 21:41:09.480 [OkHttp http://localhost:8091/...] OkHttpClient - Content-Length: 0
[INFO ] 2020-03-14 21:41:09.480 [OkHttp http://localhost:8091/...] OkHttpClient -
[INFO ] 2020-03-14 21:41:09.481 [OkHttp http://localhost:8091/...] OkHttpClient -
[INFO ] 2020-03-14 21:41:09.481 [OkHttp http://localhost:8091/...] OkHttpClient - --> END POST (0-byte body)
[INFO ] 2020-03-14 21:41:12.732 [OkHttp http://localhost:8091/...] OkHttpClient - <-- 200 http://localhost:8091/api/v1/notifyEmail?emailTo=a_subscriber%40mail.ru&action=order_update&orderId=38 (3250ms)
[INFO ] 2020-03-14 21:41:12.732 [OkHttp http://localhost:8091/...] OkHttpClient - Content-Type: application/json
[INFO ] 2020-03-14 21:41:12.732 [OkHttp http://localhost:8091/...] OkHttpClient - Transfer-Encoding: chunked
[INFO ] 2020-03-14 21:41:12.732 [OkHttp http://localhost:8091/...] OkHttpClient - Date: Sat, 14 Mar 2020 19:41:12 GMT
[INFO ] 2020-03-14 21:41:12.733 [OkHttp http://localhost:8091/...] OkHttpClient - Keep-Alive: timeout=60
[INFO ] 2020-03-14 21:41:12.733 [OkHttp http://localhost:8091/...] OkHttpClient - Connection: keep-alive
[INFO ] 2020-03-14 21:41:12.734 [OkHttp http://localhost:8091/...] OkHttpClient -
[INFO ] 2020-03-14 21:41:12.734 [OkHttp http://localhost:8091/...] OkHttpClient - {"code":0,"message":"Success"}
Nice. It's work fine. Success send POST http request.
Now I run SAME MY app by docker compose
docker-compose up
Success run app.
But if I want to create http request I get error:
Failed to connect to localhost/127.0.0.1:8091
server_1 | [INFO ] 2020-03-14 19:37:29.526 [OkHttp http://localhost:8091/...] OkHttpClient - --> POST http://localhost:8091/api/v1/notifyEmail?emailTo=a_subscriber%40mail.ru&action=order_update&orderId=4 http/1.1
server_1 | [INFO ] 2020-03-14 19:37:29.527 [OkHttp http://localhost:8091/...] OkHttpClient - Content-Length: 0
server_1 | [INFO ] 2020-03-14 19:37:29.527 [OkHttp http://localhost:8091/...] OkHttpClient -
server_1 | [INFO ] 2020-03-14 19:37:29.527 [OkHttp http://localhost:8091/...] OkHttpClient -
server_1 | [INFO ] 2020-03-14 19:37:29.527 [OkHttp http://localhost:8091/...] OkHttpClient - --> END POST (0-byte body)
server_1 | [DEBUG] 2020-03-14 19:37:29.529 [http-nio-8090-exec-5] SQL - select user0_.id as id1_3_, user0_.active as active2_3_, user0_.created as created3_3_, user0_.password as password4_3_, user0_.updated as updated5_3_, user0_.username as username6_3_ from usr user0_ where user0_.username=?
server_1 | [DEBUG] 2020-03-14 19:37:29.530 [http-nio-8090-exec-5] SQL - select roles0_.user_id as user_id1_2_0_, roles0_.role as role2_2_0_ from user_roles roles0_ where roles0_.user_id=?
server_1 | [DEBUG] 2020-03-14 19:37:29.530 [http-nio-8090-exec-5] SQL - select orders0_.user_id as user_id7_1_0_, orders0_.id as id1_1_0_, orders0_.id as id1_1_1_, orders0_.category_id as category6_1_1_, orders0_.created as created2_1_1_, orders0_.description as descript3_1_1_, orders0_.name as name4_1_1_, orders0_.updated as updated5_1_1_, orders0_.user_id as user_id7_1_1_ from orders orders0_ where orders0_.user_id=?
server_1 | [DEBUG] 2020-03-14 19:37:29.531 [http-nio-8090-exec-5] SQL - select orders0_.id as id1_1_, orders0_.category_id as category6_1_, orders0_.created as created2_1_, orders0_.description as descript3_1_, orders0_.name as name4_1_, orders0_.updated as updated5_1_, orders0_.user_id as user_id7_1_ from orders orders0_ where orders0_.user_id=?
server_1 | [DEBUG] 2020-03-14 19:37:29.536 [http-nio-8090-exec-5] SQL - select category0_.id as id1_0_0_, category0_.created as created2_0_0_, category0_.description as descript3_0_0_, category0_.name as name4_0_0_, category0_.updated as updated5_0_0_, orders1_.id as id1_1_1_, orders1_.category_id as category6_1_1_, orders1_.created as created2_1_1_, orders1_.description as descript3_1_1_, orders1_.name as name4_1_1_, orders1_.updated as updated5_1_1_, orders1_.user_id as user_id7_1_1_, user2_.id as id1_3_2_, user2_.active as active2_3_2_, user2_.created as created3_3_2_, user2_.password as password4_3_2_, user2_.updated as updated5_3_2_, user2_.username as username6_3_2_, roles3_.user_id as user_id1_2_3_, roles3_.role as role2_2_3_ from category category0_ left outer join orders orders1_ on category0_.id=orders1_.category_id left outer join usr user2_ on orders1_.user_id=user2_.id left outer join user_roles roles3_ on user2_.id=roles3_.user_id where category0_.id=?
server_1 | [INFO ] 2020-03-14 19:37:29.538 [OkHttp http://localhost:8091/...] OkHttpClient - <-- HTTP FAILED: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8091
server_1 | [ERROR] 2020-03-14 19:37:29.539 [OkHttp http://localhost:8091/...] DefaultRestClientCallback - onFailure: Error: Failed to connect to localhost/127.0.0.1:8091
server_1 | java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8091
server_1 | at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:265) ~[okhttp-3.14.4.jar!/:?]
server_1 | at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183) ~[okhttp-3.14.4.jar!/:?]
server_1 | at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224) ~[okhttp-3.14.4.jar!/:?]
server_1 | at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108) ~[okhttp-3.14.4.jar!/:?]
Why same app not work from docker?

add this to your service in docker-compose file (only the network part)
version: "3"
services:
server:
image: asubscriber/eshop:1.0.1
build:
context: .
network_mode: "host"
expose:
- 9080
This is an answer to just make it works, it's better to read this, as Sergei Petunin mentiond in the comments above.

Related

Spring boot admin console in Istio

We are running spring boot admin console inside Istio and trying to connect to pods with actuator end points. When SBAC tries to connect to a pod, it gives 502. We checked the logs and it sounds that SBAC is duplicating the IP address in the request URL
boot-admin-console 2023-01-12 19:26:54.480 DEBUG 1 --- [or-http-epoll-3] r.n.http.client.HttpClientOperations
: [db6578e5-10, L:/172.30.208.27:34026 - R:172.30.198.29/172.30.198.29:8080] Received response (auto-read:false) : RE
SPONSE(decodeResult: success, version: HTTP/1.1)
spring-boot-admin-console HTTP/1.1 200 OK
spring-boot-admin-console x-content-type-options:
spring-boot-admin-console x-xss-protection:
spring-boot-admin-console cache-control:
spring-boot-admin-console pragma:
spring-boot-admin-console expires:
spring-boot-admin-console x-frame-options:
spring-boot-admin-console content-type:
spring-boot-admin-console date:
spring-boot-admin-console x-envoy-upstream-service-time:
spring-boot-admin-console server:
spring-boot-admin-console transfer-encoding:
spring-boot-admin-console 2023-01-12 19:26:54.480 DEBUG 1 --- [or-http-epoll-3] r.n.r.DefaultPooledConnectionProvider
: [db6578e5-10, L:/172.30.208.27:34026 - R:172.30.198.29/172.30.198.29:8080] onStateChange(GET{uri=/actuator/health,
connection=PooledConnection{channel=[id: 0xdb6578e5, L:/172.30.208.27:34026 - R:172.30.198.29/172.30.198.29:8080]}}, [r
esponse_received])
Any ideas?
We have the headless service for the target service to allow connectivity between SBAC and the application pod. I curled the target pod actuator endpoint from the sbac pod and it is accessible but from the UI is giving 502

Error in accessing authserver from resource server with auth server as eureka client

Hi I have a implemented oauth2 service in springboot. Auth-server and resource servers are enabled with eureka client they have successfully registered to eureka server as well. URI for auth-server in resource server is configured this way
security:
oauth2:
resource:
token-info-uri: http://auth-server/oauth/check_token
Now auth-server in the above URI is the app name of authserver. I am expecting resource server should contact auth server using token-info-uri after it gets url resolved from eureka server. But with this setup I am getting an error nested exception is java.net.UnknownHostException: auth-server
I modified my configuration to this
security:
oauth2:
resource:
prefer-token-info: false
service-id: auth-server
token-info-uri: http://${security.oauth2.resource.service-id}/oauth/check_token
loadBalanced: true
but I am getting response
{
"error": "invalid_token",
"error_description": "e2f95093-085c-4b59-90a5-c89fb5d1eccb"
}
When I debug I have this log
asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.048 INFO 1 --- [nio-6001-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 21 ms
asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.086 DEBUG 1 --- [nio-6001-exec-2] o.s.b.a.s.o.r.UserInfoTokenServices : Getting user info from: null
asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.109 DEBUG 1 --- [nio-6001-exec-2] org.springframework.web.HttpLogging : HTTP GET
asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.117 DEBUG 1 --- [nio-6001-exec-2] org.springframework.web.HttpLogging : Accept=[application/json, application/*+json]
asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.119 WARN 1 --- [nio-6001-exec-2] o.s.b.a.s.o.r.UserInfoTokenServices : Could not fetch user details: class java.lang.IllegalStateException, Request URI does not contain a valid hostname:
asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.120 DEBUG 1 --- [nio-6001-exec-2] o.s.b.a.s.o.r.UserInfoTokenServices : userinfo returned error: Could not fetch user details
asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.127 DEBUG 1 --- [nio-6001-exec-2] o.s.b.a.audit.listener.AuditListener : AuditEvent [timestamp=2019-11-16T17:52:08.125Z, principal=access-token, type=AUTHENTICATION_FAILURE, data={type=org.springframework.security.authentication.BadCredentialsException, message=e2f95093-085c-4b59-90a5-c89fb5d1eccb}]
Basically URI is picked up is what I see
you cannot use just name in property files. it should be
security:
oauth2:
resource:
service-id: {Service ID as at eureka server registered}
token-info-uri: http://${security.oauth2.resource.service-id}/oauth/check_token
loadBalanced=true
prefer-token-info=false
P.S I just typed by hand. make sure keep proper spaces
In the error log presented by Darshu, there is the following message:" asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.120 DEBUG 1 --- [nio-6001-exec-2] o.s.b.a.s.o.r.UserInfoTokenServices : userinfo returned error: Could not fetch user details".
The prefer-token-info must be set true to determine that token-info-uri is preferred over user-info-uri.
security:
oauth2:
resource:
prefer-token-info: true
See more in https://docs.spring.io/spring-security-oauth2-boot/docs/2.0.0.RC2/reference/htmlsingle/#boot-features-security-oauth2-resource-server

Configure GremlinServer to JanusGraph with HBase and Elasticsearch

Can't create instance of GremlinServer with HBase and Elasticsearch.
When i run shell script: bin/gremlin-server.sh config/gremlin.yaml. I get exception:
Exception in thread "main" java.lang.IllegalStateException: java.lang.NoSuchMethodException: org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin.build()
Gremlin-server logs
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/user/janusgraph/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/user/janusgraph/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
0 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer -
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
135 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Configuring Gremlin Server from config/gremlin.yaml
211 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
557 [main] INFO org.janusgraph.diskstorage.hbase.HBaseCompatLoader - Instantiated HBase compatibility layer supporting runtime HBase version 1.2.6: org.janusgraph.diskstorage.hbase.HBaseCompat1_0
835 [main] INFO org.janusgraph.diskstorage.hbase.HBaseStoreManager - HBase configuration: setting zookeeper.znode.parent=/hbase-unsecure
836 [main] INFO org.janusgraph.diskstorage.hbase.HBaseStoreManager - Copied host list from root.storage.hostname to hbase.zookeeper.quorum: main.local,data1.local,data2.local
836 [main] INFO org.janusgraph.diskstorage.hbase.HBaseStoreManager - Copied Zookeeper Port from root.storage.port to hbase.zookeeper.property.clientPort: 2181
866 [main] WARN org.apache.hadoop.util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
1214 [main] INFO org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper - Process identifier=hconnection-0x1e44b638 connecting to ZooKeeper ensemble=main.local:2181,data1.local:2181,data2.local:2181
1220 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
1220 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:host.name=main.local
1220 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:java.version=1.8.0_212
1220 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:java.vendor=Oracle Corporation
1220 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre
1221 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:java.class.path=/home/user/janusgraph/conf/gremlin-server:/home/user/janusgraph/lib/slf4j-log4j12-
// Here hanusgraph download very many dependencies
1256 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
1256 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:java.io.tmpdir=/tmp
1256 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:java.compiler=<NA>
1256 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:os.name=Linux
1256 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:os.arch=amd64
1256 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:os.version=3.10.0-862.el7.x86_64
1256 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:user.name=user
1257 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:user.home=/home/user
1257 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Client environment:user.dir=/home/user/janusgraph
1257 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Initiating client connection, connectString=main.local:2181,data1.local:2181,data2.local:2181 sessionTimeout=90000 watcher=hconnection-0x1e44b6380x0, quorum=main.local:2181,data1.local:2181,data2.local:2181, baseZNode=/hbase-unsecure
1274 [main-SendThread(data2.local:2181)] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ClientCnxn - Opening socket connection to server data2.local/xxx.xxx.xxx.xxx:2181. Will not attempt to authenticate using SASL (unknown error)
1394 [main-SendThread(data2.local:2181)] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ClientCnxn - Socket connection established to data2.local/xxx.xxx.xxx.xxx, initiating session
1537 [main-SendThread(data2.local:2181)] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ClientCnxn - Session establishment complete on server data2.local/xxx.xxx.xxx.xxx:2181, sessionid = 0x26b266353e50014, negotiated timeout = 60000
3996 [main] INFO org.janusgraph.core.util.ReflectiveConfigOptionLoader - Loaded and initialized config classes: 13 OK out of 13 attempts in PT0.631S
4103 [main] INFO org.reflections.Reflections - Reflections took 60 ms to scan 2 urls, producing 0 keys and 0 values
4400 [main] WARN org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration - Local setting cache.db-cache-time=180000 (Type: GLOBAL_OFFLINE) is overridden by globally managed value (10000). Use the ManagementSystem interface instead of the local configuration to control this setting.
4453 [main] WARN org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration - Local setting cache.db-cache-clean-wait=20 (Type: GLOBAL_OFFLINE) is overridden by globally managed value (50). Use the ManagementSystem interface instead of the local configuration to control this setting.
4473 [main] INFO org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation - Closing master protocol: MasterService
4474 [main] INFO org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation - Closing zookeeper sessionid=0x26b266353e50014
4485 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Session: 0x26b266353e50014 closed
4485 [main-EventThread] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ClientCnxn - EventThread shut down
4500 [main] INFO org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration - Generated unique-instance-id=c0a8873843641-main-local1
4530 [main] INFO org.janusgraph.diskstorage.hbase.HBaseStoreManager - HBase configuration: setting zookeeper.znode.parent=/hbase-unsecure
4530 [main] INFO org.janusgraph.diskstorage.hbase.HBaseStoreManager - Copied host list from root.storage.hostname to hbase.zookeeper.quorum: main.local,data1.local,data2.local
4531 [main] INFO org.janusgraph.diskstorage.hbase.HBaseStoreManager - Copied Zookeeper Port from root.storage.port to hbase.zookeeper.property.clientPort: 2181
4532 [main] INFO org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper - Process identifier=hconnection-0x5bb3d42d connecting to ZooKeeper ensemble=main.local:2181,data1.local:2181,data2.local:2181
4532 [main] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ZooKeeper - Initiating client connection, connectString=main.local:2181,data1.local:2181,data2.local:2181 sessionTimeout=90000 watcher=hconnection-0x5bb3d42d0x0, quorum=main.local:2181,data1.local:2181,data2.local:2181, baseZNode=/hbase-unsecure
4534 [main-SendThread(main.local:2181)] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ClientCnxn - Opening socket connection to server main.local/xxx.xxx.xxx.xxx:2181. Will not attempt to authenticate using SASL (unknown error)
4534 [main-SendThread(main.local:2181)] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ClientCnxn - Socket connection established to main.local/xxx.xxx.xxx.xxx:2181, initiating session
4611 [main-SendThread(main.local:2181)] INFO org.apache.hadoop.hbase.shaded.org.apache.zookeeper.ClientCnxn - Session establishment complete on server main.local/xxx.xxx.xxx.xxx:2181, sessionid = 0x36b266353fd0021, negotiated timeout = 60000
4616 [main] INFO org.janusgraph.diskstorage.Backend - Configuring index [search]
5781 [main] INFO org.janusgraph.diskstorage.Backend - Initiated backend operations thread pool of size 16
6322 [main] INFO org.janusgraph.diskstorage.Backend - Configuring total store cache size: 186687592
7555 [main] INFO org.janusgraph.graphdb.database.IndexSerializer - Hashing index keys
7925 [main] INFO org.janusgraph.diskstorage.log.kcvs.KCVSLog - Loaded unidentified ReadMarker start time 2019-06-13T09:54:08.929Z into org.janusgraph.diskstorage.log.kcvs.KCVSLog$MessagePuller#656d10a4
7927 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Graph [graph] was successfully configured via [config/db.properties].
7927 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized Gremlin thread pool. Threads in pool named with pattern gremlin-*
Exception in thread "main" java.lang.IllegalStateException: java.lang.NoSuchMethodException: org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin.build()
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.initializeGremlinScriptEngineManager(GremlinExecutor.java:522)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.<init>(GremlinExecutor.java:126)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.<init>(GremlinExecutor.java:83)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor$Builder.create(GremlinExecutor.java:813)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:169)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:89)
at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:110)
at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:363)
Caused by: java.lang.NoSuchMethodException: org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin.build()
at java.lang.Class.getMethod(Class.java:1786)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.initializeGremlinScriptEngineManager(GremlinExecutor.java:492)
... 7 more
Graph configuration:
storage.backend=hbase
storage.hostname=main.local,data1.local,data2.local
storage.port=2181
storage.hbase.ext.zookeeper.znode.parent=/hbase-unsecure
cache.db-cache=true
cache.db-cache-clean-wait=20
cache.db-cache-time=180000
cache.db-cache-size=0.5
index.search.backend=elasticsearch
index.search.hostname=xxx.xxx.xxx.xxx
index.search.port=9200
index.search.elasticsearch.client-only=false
gremlin.graph=org.janusgraph.core.JanusGraphFactory
host=0.0.0.0
Gremlin-server configuration
host: localhost
port: 8182
channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
graphs: { graph: config/db.properties }
scriptEngines: {
gremlin-groovy: {
plugins: {
org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { classImports: [java.lang.Math], methodImports: [java.lang.Math#*] },
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { files: [scripts/janusgraph.groovy] }
}
}
}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] } }
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true } }
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] } }
metrics: {
slf4jReporter: {enabled: true, interval: 180000}
}
What do I need to do to server start without error?

Getting error:`Sending HTTP error code 404: Failed to read stream:null`

We are using Jenkins for Maven builds and JFrog artifactory to store our artifacts.
Jfrog Artifactory version - 5.0.0
Jenkins version - 2.7
The issue we are facing is many times our Jenkins build gets failed due to below error:
Content-Length: 70410552
2017-12-18 18:46:02,286 [ajp-nio-8019-exec-3] [WARN ] (o.a.w.s.RepoFilter :222) - Sending HTTP error code 404: Failed to read stream: null
2017-12-18 18:46:04,388 [ajp-nio-8019-exec-8] [INFO ] (o.a.e.UploadServiceImpl:516) - Deploy to 'libs-snapshot-local:com/aaaaaa/inventory-service/1.0.8-SNAPSHOT/inventory-service-1.0.8-20171218.114602-2.pom' Content-Length: 10080
2017-12-18 18:46:04,455 [ajp-nio-8019-exec-12] [INFO ] (o.a.e.UploadServiceImpl:319) - Deploy to 'libs-snapshot-local:com/aaaaaa/inventory-service/1.0.8-SNAPSHOT/inventory-service-1.0.8-20171218.114602-2.pom.sha1' Content-Length: 40
2017-12-18 18:46:04,462 [ajp-nio-8019-exec-15] [INFO ] (o.a.e.UploadServiceImpl:319) - Deploy to 'libs-snapshot-local:com/aaaaaa/inventory-service/1.0.8-SNAPSHOT/inventory-service-1.0.8-20171218.114602-2.pom.md5' Content-Length: 32
2017-12-18 18:47:39,021 [ajp-nio-8019-exec-10] [INFO ] (o.a.e.UploadServiceImpl:516) - Deploy to 'libs-snapshot-local:com/aaaaaa/inventory-service/1.0.8-SNAPSHOT/inventory-service-1.0.8-20171218.114738-3.jar' Content-Length: 70410552
2017-12-18 18:47:39,022 [ajp-nio-8019-exec-10] [WARN ] (o.a.w.s.RepoFilter :222) - Sending HTTP error code 404: Failed to read stream: null
2017-12-18 18:47:41,374 [ajp-nio-8019-exec-5] [INFO ] (o.a.e.UploadServiceImpl:516) - Deploy to 'libs-snapshot-local:com/aaaaaa/inventory-service/1.0.8-SNAPSHOT/inventory-service-1.0.8-20171218.114738-3.pom' Content-Length: 10080
2017-12-18 18:47:41,392 [ajp-nio-8019-exec-2] [INFO ] (o.a.e.UploadServiceImpl:319) - Deploy to 'libs-snapshot-local:com/aaaaaa/inventory-service/1.0.8-SNAPSHOT/inventory-service-1.0.8-20171218.114738-3.pom.sha1' Content-Length: 40
2017-12-18 18:47:41,397 [ajp-nio-8019-exec-3] [INFO ] (o.a.e.UploadServiceImpl:319) - Deploy to 'libs-snapshot-local:com/aaaaaa/inventory-service/1.0.8-SNAPSHOT/inventory-service-1.0.8-20171218.114738-3.pom.md5' Content-Length: 32
2017-12-18 18:49:07,275 [ajp-nio-8019-exec-14] [INFO ] (o.a.e.UploadServiceImpl:516) - Deploy to 'libs-snapshot-local:com/aaaaaa/bbbb/1.0.30-SNAPSHOT/bbbb-1.0.30-20171218.114907-6.jar' Content-Length: 76484245
2017-12-18 18:49:07,276 [ajp-nio-8019-exec-14] [WARN ] (o.a.w.s.RepoFilter :222) - Sending HTTP error code 404: Failed to read stream: null
2017-12-18 18:49:09,431 [ajp-nio-8019-exec-9] [INFO ] (o.a.e.UploadServiceImpl:516) - Deploy to 'libs-snapshot-local:com/aaaaaa/bbbb/1.0.30-SNAPSHOT/bbbb-1.0.30-20171218.114907-6.pom' Content-Length: 10870
2017-12-18 18:49:09,451 [ajp-nio-8019-exec-7] [INFO ] (o.a.e.UploadServiceImpl:319) - Deploy to 'libs-snapshot-local:com/aaaaaa/bbbb/1.0.30-SNAPSHOT/bbbb-1.0.30-20171218.114907-6.pom.sha1' Content-Length: 40
Any help would be much appreciated.
EDIT:
This was the first line in the artifacroty.log found:
2017-12-18 18:46:02,285 [ajp-nio-8019-exec-3] [INFO ] (o.a.e.UploadServiceImpl:516) - Deploy to 'libs-snapshot-local:com/halodoc/inventory-service/1.0.8-SNAPSHOT/inventory-service-1.0.8-20171218.114602-2.jar' Content-Length: 70410552
Request Log
20171218184602|1|REQUEST|X.X.X.X|non_authenticated_user|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml|HTTP/1.1|401|0
20171218184602|4|REQUEST|X.X.X.X|jenkins|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|778
20171218184602|1|REQUEST|X.X.X.X|jenkins|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20171218184602|3|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/service-1.0.8-20171218.114602-2.jar|HTTP/1.1|404|70410552
20171218184604|64|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/service-1.0.8-20171218.114602-2.pom|HTTP/1.1|201|10080
20171218184604|4|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/service-1.0.8-20171218.114602-2.pom.sha1|HTTP/1.1|201|40
20171218184604|2|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/service-1.0.8-20171218.114602-2.pom.md5|HTTP/1.1|201|32
20171218184738|0|REQUEST|X.X.X.X|non_authenticated_user|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml|HTTP/1.1|401|0
20171218184738|3|REQUEST|X.X.X.X|jenkins|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|778
20171218184739|2|REQUEST|X.X.X.X|jenkins|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20171218184739|3|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/service-1.0.8-20171218.114738-3.jar|HTTP/1.1|404|70410552
20171218184741|15|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/service-1.0.8-20171218.114738-3.pom|HTTP/1.1|201|10080
20171218184741|2|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/service-1.0.8-20171218.114738-3.pom.sha1|HTTP/1.1|201|40
20171218184741|2|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/service-1.0.8-20171218.114738-3.pom.md5|HTTP/1.1|201|32
20171218184907|0|REQUEST|X.X.X.X|non_authenticated_user|GET|/libs-snapshot-local/com/aaaa/bbbbb/1.0.30-SNAPSHOT/maven-metadata.xml|HTTP/1.1|401|0
20171218184907|2|REQUEST|X.X.X.X|jenkins|GET|/libs-snapshot-local/com/aaaa/bbbbb/1.0.30-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|770
20171218184907|1|REQUEST|X.X.X.X|jenkins|GET|/libs-snapshot-local/com/aaaa/bbbbb/1.0.30-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40
20171218184907|2|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/bbbbb/1.0.30-SNAPSHOT/bbbbb-1.0.30-20171218.114907-6.jar|HTTP/1.1|404|76484245
20171218184909|17|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/bbbbb/1.0.30-SNAPSHOT/bbbbb-1.0.30-20171218.114907-6.pom|HTTP/1.1|201|10870
20171218184909|3|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/bbbbb/1.0.30-SNAPSHOT/bbbbb-1.0.30-20171218.114907-6.pom.sha1|HTTP/1.1|201|40
20171218184909|3|REQUEST|X.X.X.X|jenkins|PUT|/libs-snapshot-local/com/aaaa/bbbbb/1.0.30-SNAPSHOT/bbbbb-1.0.30-20171218.114907-6.pom.md5|HTTP/1.1|201|32
20171218184922|0|REQUEST|X.X.X.X|non_authenticated_user|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml|HTTP/1.1|401|0
20171218184922|6|REQUEST|X.X.X.X|user-name|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml|HTTP/1.1|200|778
20171218184923|1|REQUEST|X.X.X.X|user-name|GET|/libs-snapshot-local/com/aaaa/service/1.0.8-SNAPSHOT/maven-metadata.xml.sha1|HTTP/1.1|200|40

Pact Provider #State Test always returning 404

I am able to get a test running for a Spring Boot Project but I'm always getting a 404 on the #State test.
#TargetRequestFilter
public void exampleRequestFilter(HttpRequest request) {
System.out.println(request.toString());
request.addHeader("Authorization", JIMMY_CARTER_TOKEN);
}
#BeforeClass
public static void setupApplication() {
SpringApplication application = new SpringApplication(App.class);
application.setAdditionalProfiles("integration");
application.run("--server.port=9000");
}
#TestTarget
public final HttpTarget target = new HttpTarget("http", "127.0.0.1", 9000);
#State("user id") // Method will be run before testing interactions that require "default" or "no-data" state
public void toUserId() {
System.out.println("Test User Id");
}
What's strange is I can tell it's hitting the right endpoint by printing out the request information and the Authorization header. I put a debug statement in and verified that I can call with the same credentials and endpoint as the test. However the test is always failing with a 404. Is there something I'm missing in my setup?
"request": {
"method": "GET",
"path": "/api/user/XXXXXX"
},
"response": {
"status": 200,
"headers": {
"content-type": "application/vnd.api+json;charset=UTF-8"
},
"body": ...
},
"providerStates": [
{
"name": "user id"
}
]
}
You can see what requests are being made by enabling debug logging with the Apache HTTP Client and the pact-jvm libraries. For Apache HTTP Client, please refer to https://hc.apache.org/httpcomponents-client-ga/logging.html.
For an example of what the debug logs you are looking for, this is from the example ContractTest from pact-jvm (https://github.com/DiUS/pact-jvm/blob/master/pact-jvm-provider-junit/src/test/java/au/com/dius/pact/provider/junit/ContractTest.java):
13:09:20.012 [Test worker] DEBUG au.com.dius.pact.provider.ProviderClient - Making request for provider au.com.dius.pact.provider.ProviderInfo(http, localhost, 8332, /, myAwesomeService, null, null, au.com.dius.pact.provider.junit.target.HttpTarget$$Lambda$14/771479970#1dec1536, null, null, false, null, changeit, null, true, false, true, null, [], []):
13:09:20.018 [Test worker] DEBUG au.com.dius.pact.provider.ProviderClient - method: GET
path: /data
query: [:]
headers: [:]
matchers: MatchingRules(rules=[:])
generators: Generators(categories={})
body: OptionalBody(state=MISSING, value=null)
13:09:20.475 [Test worker] INFO au.com.dius.pact.provider.junit.ContractTest - exampleRequestFilter called: GET http://localhost:8332/data HTTP/1.1
13:09:20.537 [Test worker] DEBUG org.apache.http.headers - http-outgoing-0 >> GET /data HTTP/1.1
13:09:20.538 [Test worker] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: localhost:8332
13:09:20.538 [Test worker] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
13:09:20.551 [Test worker] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_131)
13:09:20.553 [Test worker] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
13:09:20.553 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 >> "GET /data HTTP/1.1[\r][\n]"
13:09:20.554 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: localhost:8332[\r][\n]"
13:09:20.555 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
13:09:20.558 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_131)[\r][\n]"
13:09:20.559 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
13:09:20.560 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
13:09:20.774 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 204 No Content[\r][\n]"
13:09:20.775 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Sat, 23 Sep 2017 03:09:20 GMT[\r][\n]"
13:09:20.775 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 << "Server: rest-client-driver(1.1.45)[\r][\n]"
13:09:20.779 [Test worker] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
13:09:20.784 [Test worker] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 204 No Content
13:09:20.785 [Test worker] DEBUG org.apache.http.headers - http-outgoing-0 << Date: Sat, 23 Sep 2017 03:09:20 GMT
13:09:20.785 [Test worker] DEBUG org.apache.http.headers - http-outgoing-0 << Server: rest-client-driver(1.1.45)
13:09:20.842 [Test worker] DEBUG au.com.dius.pact.provider.ProviderClient - Received response: HTTP/1.1 204 No Content
13:09:20.867 [Test worker] DEBUG au.com.dius.pact.provider.ProviderClient - Response: [statusCode:204, headers:[Date:Sat, 23 Sep 2017 03:09:20 GMT, Server:rest-client-driver(1.1.45)]]
13:09:21.724 [Test worker] DEBUG au.com.dius.pact.model.Matching$ - Found a matcher for text/plain -> Some((text/plain,au.com.dius.pact.matchers.PlainTextBodyMatcher#29c3e77b))
returns a response which
has status code 204 (OK)
has a matching body (OK)

Resources