Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubmodelRepository using MongoDB instead of basyx.backend = InMemory #96

Closed
kzoltner opened this issue Oct 2, 2023 · 1 comment · Fixed by #102
Closed

SubmodelRepository using MongoDB instead of basyx.backend = InMemory #96

kzoltner opened this issue Oct 2, 2023 · 1 comment · Fixed by #102

Comments

@kzoltner
Copy link

kzoltner commented Oct 2, 2023

I tried running a SubmodelRepository using InMemory configuration.
I used this for application.properties:

server.port=8081

spring.application.name=Submodel Repository
basyx.smrepo.name = sm-repo
basyx.backend = InMemory

management.endpoints.web.base-path=/

and ran this command:

docker run --name=sm-repo -p 8081:8081 -v ./application.properties:/application/application.properties:ro eclipsebasyx/submodel-repository:2.0.0-SNAPSHOT

After startup, a GET request to localhost:8081/health takes very long and return DOWN.

I get this log output:

Loaded property file: file:application.properties
Loaded property file: jar:file:/application/basyxExecutable.jar!/BOOT-INF/classes!/application.properties
  ____           _____              
 |  _ \         / ____|             
 | |_) |  __ _ | (___   _   _ __  __
 |  _ <  / _` | \___ \ | | | |\ \/ /
 | |_) || (_| | ____) || |_| | >  < 
 |____/  \__,_||_____/  \__, |/_/\_\
======================== __/ |======      
Submodel Repository     |___/                  
2.0.0-PREVIEW

2023-10-02 13:59:27.344  INFO 1 --- [           main] o.e.d.b.s.c.SubmodelRepositoryComponent  : Starting SubmodelRepositoryComponent v2.0.0-SNAPSHOT using Java 11.0.19 on 7074c84b832b with PID 1 (/application/basyxExecutable.jar started by nobody in /application)
2023-10-02 13:59:27.347  INFO 1 --- [           main] o.e.d.b.s.c.SubmodelRepositoryComponent  : No active profile set, falling back to 1 default profile: "default"
2023-10-02 13:59:27.891  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
2023-10-02 13:59:27.896  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 2 ms. Found 0 MongoDB repository interfaces.
2023-10-02 13:59:28.158  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2023-10-02 13:59:28.165  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-10-02 13:59:28.165  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.73]
2023-10-02 13:59:28.211  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-10-02 13:59:28.212  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 825 ms
2023-10-02 13:59:28.323  INFO 1 --- [           main] d.b.s.c.SubmodelRepositoryFeaturePrinter : -------------------- Submodel Repository Features: --------------------
2023-10-02 13:59:28.323  INFO 1 --- [           main] d.b.s.c.SubmodelRepositoryFeaturePrinter : ----------------------------------------------------------------- 
2023-10-02 13:59:28.324  INFO 1 --- [           main] .e.d.b.s.c.SubmodelServiceFeaturePrinter : ------------------ Submodel Service Found Features: ------------------ 
2023-10-02 13:59:28.324  INFO 1 --- [           main] .e.d.b.s.c.SubmodelServiceFeaturePrinter : ----------------------------------------------------------------- 
2023-10-02 13:59:29.199  INFO 1 --- [           main] org.mongodb.driver.client                : MongoClient with metadata {"driver": {"name": "mongo-java-driver|sync|spring-boot", "version": "4.6.1"}, "os": {"type": "Linux", "name": "Linux", "architecture": "amd64", "version": "5.15.0-60-generic"}, "platform": "Java/Amazon.com Inc./11.0.19+7-LTS"} created with settings MongoClientSettings{readPreference=primary, writeConcern=WriteConcern{w=null, wTimeout=null ms, journal=null}, retryWrites=true, retryReads=true, readConcern=ReadConcern{level=null}, credential=null, streamFactoryFactory=null, commandListeners=[io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener@4784013e], codecRegistry=ProvidersCodecRegistry{codecProviders=[ValueCodecProvider{}, BsonValueCodecProvider{}, DBRefCodecProvider{}, DBObjectCodecProvider{}, DocumentCodecProvider{}, IterableCodecProvider{}, MapCodecProvider{}, GeoJsonCodecProvider{}, GridFSFileCodecProvider{}, Jsr310CodecProvider{}, JsonObjectCodecProvider{}, BsonCodecProvider{}, EnumCodecProvider{}, com.mongodb.Jep395RecordCodecProvider@6f952d6c]}, clusterSettings={hosts=[localhost:27017], srvServiceName=mongodb, mode=SINGLE, requiredClusterType=UNKNOWN, requiredReplicaSetName='null', serverSelector='null', clusterListeners='[]', serverSelectionTimeout='30000 ms', localThreshold='30000 ms'}, socketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=0, receiveBufferSize=0, sendBufferSize=0}, heartbeatSocketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=10000, receiveBufferSize=0, sendBufferSize=0}, connectionPoolSettings=ConnectionPoolSettings{maxSize=100, minSize=0, maxWaitTimeMS=120000, maxConnectionLifeTimeMS=0, maxConnectionIdleTimeMS=0, maintenanceInitialDelayMS=0, maintenanceFrequencyMS=60000, connectionPoolListeners=[io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener@5965844d], maxConnecting=2}, serverSettings=ServerSettings{heartbeatFrequencyMS=10000, minHeartbeatFrequencyMS=500, serverListeners='[]', serverMonitorListeners='[]'}, sslSettings=SslSettings{enabled=false, invalidHostNameAllowed=false, context=null}, applicationName='null', compressorList=[], uuidRepresentation=JAVA_LEGACY, serverApi=null, autoEncryptionSettings=null, contextProvider=null}
2023-10-02 13:59:29.201  INFO 1 --- [localhost:27017] org.mongodb.driver.cluster               : Exception in monitor thread while connecting to server localhost:27017

com.mongodb.MongoSocketOpenException: Exception opening socket
        at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-4.6.1.jar!/:na]
        at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:180) ~[mongodb-driver-core-4.6.1.jar!/:na]
        at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:193) ~[mongodb-driver-core-4.6.1.jar!/:na]
        at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:157) ~[mongodb-driver-core-4.6.1.jar!/:na]
        at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]
        at java.base/java.net.Socket.connect(Socket.java:609) ~[na:na]
        at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:107) ~[mongodb-driver-core-4.6.1.jar!/:na]
        at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-4.6.1.jar!/:na]
        at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-4.6.1.jar!/:na]
        ... 4 common frames omitted

2023-10-02 13:59:29.380  INFO 1 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 1 endpoint(s) beneath base path ''
2023-10-02 13:59:29.405  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2023-10-02 13:59:29.417  INFO 1 --- [           main] o.e.d.b.s.c.SubmodelRepositoryComponent  : Started SubmodelRepositoryComponent in 2.356 seconds (JVM running for 2.638)

Seems like MongoDB is used and fails.

@FrankSchnicke
Copy link
Contributor

Thanks for pointing this out. We missed excluding some auto-configuration from the Submodel Repository. It is fixed now and the SNAPSHOT image is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants