eclipse-basyx / basyx-java-examples Goto Github PK
View Code? Open in Web Editor NEWjava-examples
License: MIT License
java-examples
License: MIT License
Dear developers,
At first, I'd like to thank you for developing this great ecosystem.
I've checked out the provided docker-compose.yaml example and it worked like a charm.
After I changed the default settings of aas.source=aasx/01_Festo.aasx to empty and aasxUpload to Enabled. (I've tried to define these values with environment variables and propoerty files as well.) The docker-compose was restarted.
For uploading an example aasx file, I used the following command:
curl.exe --verbose --request POST --form "someKey=@14_Siemens.aasx" http://localhost:4001/aasServer/shells/aasx
After executing the command above, the uploaded content can be found on page http://localhost:4001/aasServer/shells, but the registry is not able to detect this change somehow, so http://localhost:4000/registry/api/v1/registry page remains empty, and the GUI page cannot retrieve data from the registry to display the uploaded data structure.
Interestingly, if I set up the infrastructure with MQTT, MongoDB (c.f. attached file aas.zip), starting docker-compose, upload file with curl and after restarting aas-server and aas-registry makes the previuosly uploaded aasx file visible in the registry, so in the GUI as well.
>>>>$ docker-compose up -d mosquitto mongo mongo-express aas_gui
[+] Running 5/5
⠿ Network industry_4_0_default Created 0.8s
⠿ Container mongo_express Started 3.0s
⠿ Container mosquitto Started 3.7s
⠿ Container aas_gui Started 2.6s
⠿ Container mongodb Started 2.5s
>>>>$ docker-compose up -d registry aas_server
[+] Running 2/2
⠿ Container aas_registry Started 2.0s
⠿ Container aas_server Started 1.7s
>>>>$ curl --verbose --request POST \
--form "someKey=@aas_samples/14_Siemens.aasx" \
http://localhost:4001/aasServer/shells/aasx
>>>>$ docker-compose stop registry aas_server
[+] Running 2/2
⠿ Container aas_server Stopped 10.8s
⠿ Container aas_registry Stopped 10.6s
>>>>$ docker-compose up -d registry aas_server
[+] Running 2/2
⠿ Container aas_server Started 1.5s
⠿ Container aas_registry Started
So, it seems aas-server or aas-register checks the database only at initialization or I've misconfigured something so aas-register is not informed about the changes.
Could you give me some hint, what could be the problem here?
Thank you for your help in advance!
Best regards,
Daniel
Dear Team,
Thank you, Nice Work.
The basyx.examples.deviceintegration example throws blow error while running(on ubuntu 22.04 ) "docker compose up", any help please. Thank You.
ubuntu@ubuntu-ros:~/Desktop/basyx-java-examples/basyx.examples.deviceintegration/src/main/resources$ docker compose up
[+] Running 5/0
⠿ Container registry-device-integration Running 0.0s
⠿ Container aasGui-device-integration Running 0.0s
⠿ Container resources-mqtt-1 Running 0.0s
⠿ Container asset-device-integration Running 0.0s
⠿ Container aas-device-integration Created 0.0s
Attaching to aas-device-integration, aasGui-device-integration, asset-device-integration, databridge-device-integration, registry-device-integration, resources-mqtt-1
resources-mqtt-1 | 1675955916: New connection from 127.0.0.1:47640 on port 1884.
resources-mqtt-1 | 1675955916: New client connected from 127.0.0.1:47640 as probe (p2, c1, k60).
resources-mqtt-1 | 1675955916: Client probe disconnected.
aas-device-integration | wait-for-it.sh: waiting for registry:4000 without a timeout
aas-device-integration | wait-for-it.sh: registry:4000 is available after 0 seconds
aas-device-integration | 15:18:37.091 [main] INFO org.eclipse.basyx.components.aas.executable.AASServerExecutable - Starting BaSyx AASServer component...
aas-device-integration | 15:18:37.107 [main] ERROR org.eclipse.basyx.components.configuration.BaSyxConfiguration - Configuration file not found: '/usr/share/config/context.properties'
aas-device-integration | java.io.FileNotFoundException: /usr/share/config/context.properties (No such file or directory)
aas-device-integration | at java.base/java.io.FileInputStream.open0(Native Method)
aas-device-integration | at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
aas-device-integration | at java.base/java.io.FileInputStream.(FileInputStream.java:157)
aas-device-integration | at java.base/java.io.FileInputStream.(FileInputStream.java:112)
aas-device-integration | at org.eclipse.basyx.components.configuration.BaSyxConfiguration.loadFromFile(BaSyxConfiguration.java:73)
aas-device-integration | at org.eclipse.basyx.components.configuration.BaSyxConfiguration.loadFileOrDefaultResource(BaSyxConfiguration.java:101)
aas-device-integration | at org.eclipse.basyx.components.configuration.BaSyxContextConfiguration.loadFromDefaultSource(BaSyxContextConfiguration.java:140)
aas-device-integration | at org.eclipse.basyx.components.aas.executable.AASServerExecutable.main(AASServerExecutable.java:54)
aas-device-integration | 15:18:37.142 [main] INFO org.eclipse.basyx.components.configuration.BaSyxConfiguration - Environment - contextPath: /aasServer
aas-device-integration | 15:18:37.142 [main] INFO org.eclipse.basyx.components.configuration.BaSyxConfiguration - Environment - contextPort: 4001
aas-device-integration | 15:18:37.142 [main] INFO org.eclipse.basyx.components.configuration.BaSyxConfiguration - Environment - accessControlAllowOrigin: *
aas-device-integration | 15:18:37.151 [main] ERROR org.eclipse.basyx.components.configuration.BaSyxConfiguration - Configuration file not found: '/usr/share/config/aas.properties'
aas-device-integration | java.io.FileNotFoundException: /usr/share/config/aas.properties (No such file or directory)
aas-device-integration | at java.base/java.io.FileInputStream.open0(Native Method)
aas-device-integration | at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
aas-device-integration | at java.base/java.io.FileInputStream.(FileInputStream.java:157)
aas-device-integration | at java.base/java.io.FileInputStream.(FileInputStream.java:112)
aas-device-integration | at org.eclipse.basyx.components.configuration.BaSyxConfiguration.loadFromFile(BaSyxConfiguration.java:73)
aas-device-integration | at org.eclipse.basyx.components.configuration.BaSyxConfiguration.loadFileOrDefaultResource(BaSyxConfiguration.java:101)
aas-device-integration | at org.eclipse.basyx.components.aas.configuration.BaSyxAASServerConfiguration.loadFromDefaultSource(BaSyxAASServerConfiguration.java:186)
aas-device-integration | at org.eclipse.basyx.components.aas.executable.AASServerExecutable.main(AASServerExecutable.java:58)
aas-device-integration | 15:18:37.152 [main] INFO org.eclipse.basyx.components.configuration.BaSyxConfiguration - Environment - registry.path: http://registry:4000/registry/
aas-device-integration | 15:18:37.153 [main] INFO org.eclipse.basyx.components.configuration.BaSyxConfiguration - Environment - aas.backend: InMemory
aas-device-integration | 15:18:37.154 [main] INFO org.eclipse.basyx.components.configuration.BaSyxConfiguration - Environment - aas.source: /usr/share/config/Heater_AAS.aasx
aas-device-integration | 15:18:37.212 [main] INFO org.eclipse.basyx.components.aas.AASServerComponent - Create the server...
aas-device-integration | 15:18:37.213 [main] INFO org.eclipse.basyx.components.aas.AASServerComponent - Registry loaded at "http://registry:4000/registry/"
aas-device-integration | 15:18:37.460 [main] INFO org.eclipse.basyx.components.aas.AASServerComponent - Loading aas from aasx "/usr/share/config/Heater_AAS.aasx"
aas-device-integration | 15:18:38.162 [main] WARN org.eclipse.basyx.submodel.factory.xml.converters.qualifier.qualifiable.QualifiableXMLConverter - Creating element {aas:type=delegatedTo , aas:valueType={}, aas:value=http://host.docker.internal:8082/heater/targetTemperature/last} without mandatory valueType!
aas-device-integration | 15:18:38.174 [main] WARN org.eclipse.basyx.submodel.factory.xml.converters.qualifier.qualifiable.QualifiableXMLConverter - Creating element {aas:type=invocationDelegation, aas:valueType={}, aas:value=http://host.docker.internal:8082/heater/setTargetTemperature/invoke} without mandatory valueType!
aas-device-integration | 15:18:38.187 [main] DEBUG org.eclipse.basyx.aas.bundle.AASBundleFactory - Found Submodel temperatureSensor for AAS heater
aas-device-integration | 15:18:38.189 [main] DEBUG org.eclipse.basyx.aas.bundle.AASBundleFactory - Found Submodel heaterControl for AAS heater
registry-device-integration | 15:18:39.934 [http-nio-4000-exec-5] DEBUG org.eclipse.basyx.vab.protocol.http.server.VABHTTPInterface - Exception in HTTP-GET. Response-code: 404
registry-device-integration | org.eclipse.basyx.vab.exception.provider.ResourceNotFoundException: Could not look up descriptor for AAS heaterAAS since it does not exist
registry-device-integration | at org.eclipse.basyx.aas.registration.memory.AASRegistry.lookupAAS(AASRegistry.java:76)
registry-device-integration | at org.eclipse.basyx.aas.registration.restapi.AASRegistryModelProvider.getAASDescriptor(AASRegistryModelProvider.java:243)
registry-device-integration | at org.eclipse.basyx.aas.registration.restapi.AASRegistryModelProvider.getValue(AASRegistryModelProvider.java:202)
registry-device-integration | at org.eclipse.basyx.vab.coder.json.provider.JSONProvider.processBaSysGet(JSONProvider.java:191)
registry-device-integration | at org.eclipse.basyx.vab.protocol.http.server.VABHTTPInterface.doGet(VABHTTPInterface.java:130)
registry-device-integration | at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
registry-device-integration | at org.eclipse.basyx.vab.protocol.http.server.BasysHTTPServlet.service(BasysHTTPServlet.java:75)
registry-device-integration | at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
registry-device-integration | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
registry-device-integration | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
registry-device-integration | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
registry-device-integration | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
registry-device-integration | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
registry-device-integration | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
registry-device-integration | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
registry-device-integration | at org.apache.catalina.valves.HealthCheckValve.invoke(HealthCheckValve.java:102)
registry-device-integration | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
registry-device-integration | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
registry-device-integration | at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
registry-device-integration | at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
registry-device-integration | at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
registry-device-integration | at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
registry-device-integration | at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
registry-device-integration | at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
registry-device-integration | at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
registry-device-integration | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
registry-device-integration | at java.base/java.lang.Thread.run(Thread.java:829)
aas-device-integration | 15:18:40.076 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
aas-device-integration | 15:18:40.083 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
aas-device-integration | 15:18:40.084 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 11
aas-device-integration | 15:18:40.090 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
aas-device-integration | 15:18:40.091 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
aas-device-integration | 15:18:40.093 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.storeFence: available
aas-device-integration | 15:18:40.094 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
aas-device-integration | 15:18:40.096 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: unavailable: Reflective setAccessible(true) disabled
aas-device-integration | 15:18:40.098 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
aas-device-integration | 15:18:40.101 [main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable: class io.netty.util.internal.PlatformDependent0$7 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @7c7a06ec
aas-device-integration | 15:18:40.103 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.(long, int): unavailable
aas-device-integration | 15:18:40.104 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
aas-device-integration | 15:18:40.134 [main] DEBUG io.netty.util.internal.PlatformDependent - maxDirectMemory: 1946157056 bytes (maybe)
aas-device-integration | 15:18:40.135 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /tmp (java.io.tmpdir)
aas-device-integration | 15:18:40.135 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
aas-device-integration | 15:18:40.138 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: -1 bytes
aas-device-integration | 15:18:40.139 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
aas-device-integration | 15:18:40.142 [main] DEBUG io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
aas-device-integration | 15:18:40.142 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
aas-device-integration | Exception in thread "main" org.eclipse.basyx.vab.exception.provider.ResourceNotFoundException: [HTTP GET] Failed to request http://host.docker.internal:8082 with mediatype application/json;charset=UTF-8
aas-device-integration | at org.eclipse.basyx.vab.protocol.http.server.ExceptionToHTTPCodeMapper.mapToException(ExceptionToHTTPCodeMapper.java:82)
aas-device-integration | at org.eclipse.basyx.vab.protocol.http.connector.HTTPConnector.handleProcessingException(HTTPConnector.java:314)
aas-device-integration | at org.eclipse.basyx.vab.protocol.http.connector.HTTPConnector.httpGet(HTTPConnector.java:211)
aas-device-integration | at org.eclipse.basyx.vab.protocol.http.connector.HTTPConnector.getValue(HTTPConnector.java:78)
aas-device-integration | at org.eclipse.basyx.vab.coder.json.connector.JSONConnector.getValue(JSONConnector.java:105)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.PropertyDelegationManager.getPropertyValue(PropertyDelegationManager.java:139)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.PropertyDelegationManager.lambda$5(PropertyDelegationManager.java:131)
aas-device-integration | at org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.AASLambdaPropertyHelper.setLambdaValue(AASLambdaPropertyHelper.java:52)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.PropertyDelegationManager.configureDelegationProperty(PropertyDelegationManager.java:131)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.PropertyDelegationManager.handleProperty(PropertyDelegationManager.java:125)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.PropertyDelegationManager.handleSubmodelElement(PropertyDelegationManager.java:83)
aas-device-integration | at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
aas-device-integration | at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
aas-device-integration | at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
aas-device-integration | at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
aas-device-integration | at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
aas-device-integration | at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
aas-device-integration | at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
aas-device-integration | at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
aas-device-integration | at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
aas-device-integration | at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.PropertyDelegationManager.handleSubmodel(PropertyDelegationManager.java:72)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.DelegatingSubmodelAPI.handleSubmodel(DelegatingSubmodelAPI.java:122)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.DelegatingSubmodelAPI.(DelegatingSubmodelAPI.java:54)
aas-device-integration | at org.eclipse.basyx.extensions.submodel.delegation.DelegatingDecoratingSubmodelAPIFactory.getSubmodelAPI(DelegatingDecoratingSubmodelAPIFactory.java:47)
aas-device-integration | at org.eclipse.basyx.submodel.restapi.api.ISubmodelAPIFactory.create(ISubmodelAPIFactory.java:47)
aas-device-integration | at org.eclipse.basyx.submodel.aggregator.SubmodelAggregator.updateSubmodel(SubmodelAggregator.java:104)
aas-device-integration | at org.eclipse.basyx.submodel.aggregator.SubmodelAggregator.createSubmodel(SubmodelAggregator.java:99)
aas-device-integration | at org.eclipse.basyx.aas.restapi.MultiSubmodelProvider.createSubmodel(MultiSubmodelProvider.java:239)
aas-device-integration | at org.eclipse.basyx.aas.restapi.MultiSubmodelProvider.setValue(MultiSubmodelProvider.java:366)
aas-device-integration | at org.eclipse.basyx.aas.bundle.AASBundleHelper.integrate(AASBundleHelper.java:102)
aas-device-integration | at org.eclipse.basyx.components.aas.AASServerComponent.createAggregatorServlet(AASServerComponent.java:530)
aas-device-integration | at org.eclipse.basyx.components.aas.AASServerComponent.startComponent(AASServerComponent.java:248)
aas-device-integration | at org.eclipse.basyx.components.aas.executable.AASServerExecutable.main(AASServerExecutable.java:67)
dependency failed to start: container for service "aas" exited (1)
Hello, I am really despaired with upload aasx.
I did fetch and pull of my source codes, so it should be up-to-date.
I am using HelloWorldServer.java
I just modified the main:
public static void main(String[] args) throws IOException {
File currentDirFile = new File(".");
String helper = currentDirFile.getAbsolutePath();
startMqttBroker();
startAASRegistry();
startAASServer();
// Create Manager - This manager is used to interact with an AAS server
ConnectedAssetAdministrationShellManager manager = new ConnectedAssetAdministrationShellManager(new AASRegistryProxy(REGISTRYPATH));
// Create AAS and push it to server
/*
* rupr 08-JUL-23 - do not create an AAS programmatically
Asset asset = new Asset("ovenAsset", new CustomId("eclipse.basyx.asset.oven"), AssetKind.INSTANCE);
AssetAdministrationShell shell = new AssetAdministrationShell("oven", OVENAASID, asset);
// The manager uploads the AAS and registers it in the Registry server
manager.createAAS(shell, AASSERVERPATH);
// Create submodel
Submodel documentationSubmodel = new Submodel("documentationSm", DOCUSMID);
// - Create property
Property maxTemp = new Property(MAXTEMPID, 1000);
// Add the property to the Submodel
documentationSubmodel.addSubmodelElement(maxTemp);
// - Push the Submodel to the AAS server
manager.createSubmodel(shell.getIdentification(), documentationSubmodel);*/
}
I use PostMan to upload the aasx:
I try to get AASs, but with no result:
What I am doing wrong?
Originally posted by @STUBA-rupr in #63 (comment)
Opening the AAS of the given example does not work. Results in "CORS header ‘Access-Control-Allow-Origin’ missing".
Managed to solve it by adding "- basyxcontext_accesscontrolalloworigin=http://localhost:8080" to the environment of aas
I've been playing around with some examples of the OTS components using docker-compose.
Now I'm having trouble to get an example with MongoDB as backend to run.
I could not find an appropriate example in the repository, is there any?
Could you please provide me a working example of a docker-compose file starting the AAS-Server (and the AAS-Registry) with MongoDB as backend?
Thank You!
It would be great to have docker-compose examples how to use the new components based on AAS v3 spec. Especially with the new UI that was recently released.
Dear developers,
thank you hard work!
I would like to use the official IDTA submodel templates in my project. (https://industrialdigitaltwin.org/en/content-hub/submodels)
The admin-shell-io of IDTA also contains the corresponding aasx files of these submodel templates. These aasx files are created using the AASX Package Explorer. However, I would like to use the Basyx SDK to create and deploy AAS and its submodels.
I am wondering if there are also aasx files for these templates that are created using the Basyx Java SDK.
Are aasx files from AASX Package Explorer compatible with Basyx SDK?
Best regards,
Mehmet
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.