tjwatson / atomos Goto Github PK
View Code? Open in Web Editor NEWAtomos - A Java Module Framework using OSGi Connect
License: Apache License 2.0
Atomos - A Java Module Framework using OSGi Connect
License: Apache License 2.0
With commit ff54056 bundle entry resources no longer require the presence of a substrate_lib/ folder with the original bundle JARs included in the native image. Some updates to the README are needed to start documenting this.
Equinox does not ensure the ConnectContent is opened before calling org.osgi.framework.connect.ConnectContent.getHeaders()
this can result in an IOException out of Atomos on a restart from cache. This is evident if you launch the atomos.examples.jlink
from a cached restart and run the gogo lb
command:
g! lb
gogo: UncheckedIOException: java.io.IOException: Reader is not open.
I opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=559634 to fix this in Equinox.
One of ma long term Issues is to get JavaFx running with OSGi. Maybe there are better ways, but could you provide an easy example with Atomos? Or do you think it is not an good Usecase for Atomos?
Following the build instructions for Build and Substrate two sets of images are create, one through jlink and the other through substrate.
Launching the applications in both cases a gogo shell loads, successfully.
Entering "help" in those shells get me a list of available commands, but with different length.
Jlink
Registered Echo service from activator.
Welcome to Apache Felix Gogo
g! Total time: 312
help
atomos:install
atomos:list
atomos:uninstall
felix:bundlelevel
felix:cd
felix:frameworklevel
felix:headers
felix:help
felix:inspect
felix:install
felix:lb
felix:log
felix:ls
felix:refresh
felix:resolve
felix:start
felix:stop
felix:uninstall
felix:update
felix:which
gogo:cat
gogo:each
gogo:echo
gogo:format
gogo:getopt
gogo:gosh
gogo:grep
gogo:history
gogo:not
gogo:set
gogo:sh
gogo:source
gogo:tac
gogo:telnetd
gogo:type
gogo:until
scr:config
scr:disable
scr:enable
scr:info
scr:list
Substrate
Registered Echo service from activator.
g! Total time: 54
help
atomos:install
atomos:list
atomos:uninstall
felix:bundlelevel
felix:cd
felix:frameworklevel
felix:headers
felix:help
felix:inspect
felix:install
felix:lb
felix:log
felix:ls
felix:refresh
felix:resolve
felix:start
felix:stop
felix:uninstall
felix:update
felix:which
gogo:gosh
gogo:history
gogo:sh
gogo:source
Compared to Substrate output Jlink offers more options
gogo:cat
gogo:each
gogo:echo
gogo:format
gogo:getopt
gogo:grep
gogo:not
gogo:set
gogo:tac
gogo:telnetd
gogo:type
gogo:until
scr:config
scr:disable
scr:enable
scr:info
scr:list
What is the reason for those differences, can anyone explain.
Thx
Hi,
just read some change log of the new Graal version in a medium article (https://medium.com/graalvm/graalvm-19-3-0-dfdb6f4ec8ed). In the last commit you have increased the version of native-image-maven-plugin. The article mentions the following change
Maven Updates
Another very important change in 19.3 is the difference in the Maven coordinates for the GraalVM Native Image related jars. The group id for the artifacts is changed from com.oracle.substratevm to org.graalvm.nativeimage.
<plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>19.3.0</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
Graal Version: graalvm-ce-java11-19.3.1
Result:
g! scr:list
{}
{}
{}
{}
{}
Unfortunately to test out the atomos bundle.index
for substrate the atomos.examples.substrate.equinox
project has some copies of resources from test bundles. These need to be updated now that the test bundles have been refactored. The folder /atomos.examples.substrate.equinox/src/main/resources/atomos
needs to be regenerated for the set of bundles included in the image.
When i first had a look into the test it wasn't easy for me to know what this maven projects in the test-folder are for.
It would be much easier to have it like this.
Is it ok to refactor it?
Is it okay to change to Junit5?
Are there codestyles/formatter rules that should be used?
Interested in automatic test/ github workflows ?
Is org.atomos the final package/domain or just a temporary project?
Hi, first of all its great to see OSGi going AOT. I followed the build instructions for Substrate.
Step 3 throws the following build error saying
Error opening zip file or JAR manifest missing : null
Error occurred during initialization of VM
agent library failed to init: instrument
Are the instructions still valid, I think so, because graal is currently not shipping JDK11, maybe in the upcoming release.
Maybe you saw this error, and give some hint what I do wrong.
Thx!
Step 3 build output
[INFO] --- native-image-maven-plugin:19.2.0.1:native-image (default) @ service.substrate ---
[INFO] ImageClasspath Entry: org.eclipse.platform:org.eclipse.osgi:jar:3.16.0.tjwatson_osgiConnect01:compile (file:///Users/markusgritsch/.m2/repository/org/eclipse/platform/org.eclipse.osgi/3.16.0.tjwatson_osgiConnect01/org.eclipse.osgi-3.16.0.tjwatson_osgiConnect01.jar)
[INFO] ImageClasspath Entry: org.atomos:atomos.framework:jar:0.0.1-SNAPSHOT:compile (file:///Users/markusgritsch/.m2/repository/org/atomos/atomos.framework/0.0.1-SNAPSHOT/atomos.framework-0.0.1-SNAPSHOT.jar)
[INFO] ImageClasspath Entry: org.atomos:service.contract:jar:0.0.1-SNAPSHOT:compile (file:///Users/markusgritsch/.m2/repository/org/atomos/service.contract/0.0.1-SNAPSHOT/service.contract-0.0.1-SNAPSHOT.jar)
[INFO] ImageClasspath Entry: org.atomos:service.impl:jar:0.0.1-SNAPSHOT:compile (file:///Users/markusgritsch/.m2/repository/org/atomos/service.impl/0.0.1-SNAPSHOT/service.impl-0.0.1-SNAPSHOT.jar)
[INFO] ImageClasspath Entry: org.osgi:org.osgi.service.component.annotations:jar:1.4.0:compile (file:///Users/markusgritsch/.m2/repository/org/osgi/org.osgi.service.component.annotations/1.4.0/org.osgi.service.component.annotations-1.4.0.jar)
[INFO] ImageClasspath Entry: org.atomos:service.impl.activator:jar:0.0.1-SNAPSHOT:compile (file:///Users/markusgritsch/.m2/repository/org/atomos/service.impl.activator/0.0.1-SNAPSHOT/service.impl.activator-0.0.1-SNAPSHOT.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.scr:jar:2.1.16:compile (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.scr/2.1.16/org.apache.felix.scr-2.1.16.jar)
[INFO] ImageClasspath Entry: org.codehaus.mojo:animal-sniffer-annotations:jar:1.9:compile (file:///Users/markusgritsch/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.9/animal-sniffer-annotations-1.9.jar)
[INFO] ImageClasspath Entry: org.osgi:osgi.promise:jar:7.0.1:compile (file:///Users/markusgritsch/.m2/repository/org/osgi/osgi.promise/7.0.1/osgi.promise-7.0.1.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.gogo.command:jar:1.1.0:compile (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.gogo.command/1.1.0/org.apache.felix.gogo.command-1.1.0.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.gogo.runtime:jar:1.1.2:compile (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.gogo.runtime/1.1.2/org.apache.felix.gogo.runtime-1.1.2.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.gogo.shell:jar:1.1.2:runtime (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.gogo.shell/1.1.2/org.apache.felix.gogo.shell-1.1.2.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.http.jetty:jar:3.1.0.substrate:compile (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.http.jetty/3.1.0.substrate/org.apache.felix.http.jetty-3.1.0.substrate.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.http.api:jar:3.0.0:compile (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.http.api/3.0.0/org.apache.felix.http.api-3.0.0.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.http.whiteboard:jar:3.0.0:compile (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.http.whiteboard/3.0.0/org.apache.felix.http.whiteboard-3.0.0.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.webconsole:jar:all:4.3.16:compile (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.webconsole/4.3.16/org.apache.felix.webconsole-4.3.16-all.jar)
[INFO] ImageClasspath Entry: org.apache.felix:org.apache.felix.http.servlet-api:jar:1.1.2:compile (file:///Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.http.servlet-api/1.1.2/org.apache.felix.http.servlet-api-1.1.2.jar)
[INFO] ImageClasspath Entry: org.apache.tomcat:tomcat-servlet-api:jar:8.0.9:compile (file:///Users/markusgritsch/.m2/repository/org/apache/tomcat/tomcat-servlet-api/8.0.9/tomcat-servlet-api-8.0.9.jar)
[INFO] ImageClasspath Entry: org.osgi:org.osgi.service.cm:jar:1.5.0:compile (file:///Users/markusgritsch/.m2/repository/org/osgi/org.osgi.service.cm/1.5.0/org.osgi.service.cm-1.5.0.jar)
[INFO] ImageClasspath Entry: org.osgi:org.osgi.service.event:jar:1.4.0:compile (file:///Users/markusgritsch/.m2/repository/org/osgi/org.osgi.service.event/1.4.0/org.osgi.service.event-1.4.0.jar)
[INFO] ImageClasspath Entry: org.atomos:service.substrate:jar:0.0.1-SNAPSHOT (file:///Users/markusgritsch/Development/Topics/Graal/OSGi/atomos/atomos.tests/service.substrate/target/service.substrate-0.0.1-SNAPSHOT.jar)
[INFO] WorkingDirectory: /Users/markusgritsch/Development/Topics/Graal/OSGi/atomos/atomos.tests/service.substrate/target
[INFO] ImageClasspath: /Users/markusgritsch/.m2/repository/org/eclipse/platform/org.eclipse.osgi/3.16.0.tjwatson_osgiConnect01/org.eclipse.osgi-3.16.0.tjwatson_osgiConnect01.jar:/Users/markusgritsch/.m2/repository/org/atomos/atomos.framework/0.0.1-SNAPSHOT/atomos.framework-0.0.1-SNAPSHOT.jar:/Users/markusgritsch/.m2/repository/org/atomos/service.contract/0.0.1-SNAPSHOT/service.contract-0.0.1-SNAPSHOT.jar:/Users/markusgritsch/.m2/repository/org/atomos/service.impl/0.0.1-SNAPSHOT/service.impl-0.0.1-SNAPSHOT.jar:/Users/markusgritsch/.m2/repository/org/osgi/org.osgi.service.component.annotations/1.4.0/org.osgi.service.component.annotations-1.4.0.jar:/Users/markusgritsch/.m2/repository/org/atomos/service.impl.activator/0.0.1-SNAPSHOT/service.impl.activator-0.0.1-SNAPSHOT.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.scr/2.1.16/org.apache.felix.scr-2.1.16.jar:/Users/markusgritsch/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.9/animal-sniffer-annotations-1.9.jar:/Users/markusgritsch/.m2/repository/org/osgi/osgi.promise/7.0.1/osgi.promise-7.0.1.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.gogo.command/1.1.0/org.apache.felix.gogo.command-1.1.0.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.gogo.runtime/1.1.2/org.apache.felix.gogo.runtime-1.1.2.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.gogo.shell/1.1.2/org.apache.felix.gogo.shell-1.1.2.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.http.jetty/3.1.0.substrate/org.apache.felix.http.jetty-3.1.0.substrate.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.http.api/3.0.0/org.apache.felix.http.api-3.0.0.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.http.whiteboard/3.0.0/org.apache.felix.http.whiteboard-3.0.0.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.webconsole/4.3.16/org.apache.felix.webconsole-4.3.16-all.jar:/Users/markusgritsch/.m2/repository/org/apache/felix/org.apache.felix.http.servlet-api/1.1.2/org.apache.felix.http.servlet-api-1.1.2.jar:/Users/markusgritsch/.m2/repository/org/apache/tomcat/tomcat-servlet-api/8.0.9/tomcat-servlet-api-8.0.9.jar:/Users/markusgritsch/.m2/repository/org/osgi/org.osgi.service.cm/1.5.0/org.osgi.service.cm-1.5.0.jar:/Users/markusgritsch/.m2/repository/org/osgi/org.osgi.service.event/1.4.0/org.osgi.service.event-1.4.0.jar:/Users/markusgritsch/Development/Topics/Graal/OSGi/atomos/atomos.tests/service.substrate/target/service.substrate-0.0.1-SNAPSHOT.jar
[INFO] BuildArgs: [-Dosgi.connect.substrate=/Users/markusgritsch/Development/Topics/Graal/OSGi/atomos/atomos.tests/service.substrate/target, -H:+ReportUnsupportedElementsAtRuntime, --allow-incomplete-classpath, --no-fallback, -H:ReflectionConfigurationFiles=/Users/markusgritsch/Development/Topics/Graal/OSGi/atomos/atomos.tests/service.substrate/graal_class_config.json, -H:ResourceConfigurationFiles=/Users/markusgritsch/Development/Topics/Graal/OSGi/atomos/atomos.tests/service.substrate/graal_resource_config.json, --initialize-at-build-time=org.eclipse.osgi,org.eclipse.equinox.log,org.atomos.framework,org.osgi.framework,org.osgi.dto,org.osgi.service.condpermadmin,org.osgi.service.log,org.osgi.service.packageadmin,org.osgi.service.permissionadmin,org.osgi.service.resolver,org.osgi.service.startlevel,org.osgi.service.url,org.osgi.util.tracker,org.osgi.resource,org.apache.felix.resolver,javax.servlet, -H:+ReportExceptionStackTraces, -H:+TraceClassInitialization, -H:Class=org.atomos.service.substrate.GogoConsole, -H:Name=atomos]
Error opening zip file or JAR manifest missing : null
Error occurred during initialization of VM
agent library failed to init: instrument
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.478 s
[INFO] Finished at: 2019-10-29T13:27:33+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.oracle.substratevm:native-image-maven-plugin:19.2.0.1:native-image (default) on project service.substrate: Error creating native image:: Image build request failed with exit status 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Some maven plugins would be helpful in conjunction to using the org.graalvm.nativeimage/native-image-maven-plugin when generating a native image with Atomos.
I have the start of such functionality in atomos.substrate.config but this is a bundle that is required to be run within an OSGi framework to assist in generating the necessary configuration for compiling with Graal Substrate.
For example, the following plugins can be considered:
Reflection Configuration: the org.atomos.substrate.config.ReflectConfig
class provides a gogo command reflectConfig
that generates a json config for specifying the required class reflection information for Bundle activators and for OSGi Declarative services. It would be good to have a plugin that can do the same when creating a native image.
Resource Configuration: the org.atomos.substrate.config.ResourceConfig
class provides a gogo command resourceConfig
that generates a json config for specifying the required resource matching patterns to include package resources in a native image. It would be good to have a plugin that can do the same when creating a native image.
Bundle Entry Configuration: the org.atomos.substrate.config.SubstrateService
class provides a gogo command substrateBundles
that can be used to extract the non-package resources used for bundle entry content (for example META-INF/MANIFEST.MF and Declarative Service XML files) into a directory structure that can be used during native image generation to include a index for Atomos to discover the included bundles and their entries. It would be good to have a plugin that can do the same when creating a native image.
some of the pom files uses tabs, some whitespaces and other are mixed. It would be nice to know in which way.
Indent using whitespaces
line width 72
clear all blank lines
format comments (join lines)
Identation size 2
I was able to build atomos and the tests seem to run fine. I switched to Graal 19.2.1 and ran mvn clean package
. Here is the result:
Build on Server(pid: 43989, port: 64230)*
[atomos:43989] classlist: 2,348.92 ms
[atomos:43989] (cap): 2,325.04 ms
[atomos:43989] setup: 3,194.65 ms
[atomos:43989] analysis: 5,234.43 ms
Fatal error: java.lang.reflect.MalformedParameterizedTypeException
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:58)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.(ParameterizedTypeImpl.java:51)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:92)
at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.FieldRepository.getGenericType(FieldRepository.java:85)
at java.lang.reflect.Field.getGenericType(Field.java:247)
at com.oracle.svm.reflect.hosted.ReflectionMetadataFeature.replacer(ReflectionMetadataFeature.java:72)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:532)
at com.oracle.graal.pointsto.ObjectScanner.scanArray(ObjectScanner.java:259)
at com.oracle.graal.pointsto.ObjectScanner.doScan(ObjectScanner.java:349)
at com.oracle.graal.pointsto.ObjectScanner.access$400(ObjectScanner.java:62)
at com.oracle.graal.pointsto.ObjectScanner$3$1.run(ObjectScanner.java:414)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:171)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1
What I would also like is some test against the image to verify it actually works by launching the native image. I have a similar want for the jlink image that gets created by the atomos/atomos.tests/service.image
See #20
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.