Giter Site home page Giter Site logo

manosbatsis / corbeans Goto Github PK

View Code? Open in Web Editor NEW
15.0 6.0 8.0 5.75 MB

Corda integration for Spring Boot applications

Home Page: https://manosbatsis.github.io/corbeans/

License: GNU Lesser General Public License v3.0

Kotlin 89.52% Scala 0.79% Shell 9.69%
spring-boot corda spring-corda corda-webserver-boot corda-node corda-rpc integration-testing corda-framework cordapps corda-enterprise

corbeans's Introduction

corbeans's People

Contributors

gitter-badger avatar manosbatsis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

corbeans's Issues

Add web UI

Provide sample SPA module, possibly Angular 5+

Cannot run integration tests with Corda Enterprise 4.2

Cannot run integration tests with Corda Enterprise 4.2

java.lang.NoSuchMethodError: net.corda.testing.driver.DriverParameters.<init>(ZLjava/nio/file/Path;Lnet/corda/testing/driver/PortAllocation;Lnet/corda/testing/driver/PortAllocation;Ljava/util/Map;ZZZLjava/util/List;Ljava/util/List;Lnet/corda/testing/driver/JmxPolicy;Lnet/corda/core/node/NetworkParameters;Ljava/util/Map;ZLjava/util/Collection;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
        at com.github.manosbatsis.corbeans.test.integration.NodeDriverHelper.withDriverNodes(NodeDriverHelper.kt:200)
        at com.github.manosbatsis.corbeans.test.integration.NodeDriverHelper$startNetworkAsync$1.doResume(NodeDriverHelper.kt:163)
        at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:42)
        at kotlinx.coroutines.experimental.DispatchedTask$DefaultImpls.run(Dispatched.kt:168)
        at kotlinx.coroutines.experimental.DispatchedContinuation.run(Dispatched.kt:13)
        at kotlinx.coroutines.experimental.scheduling.Task.run(Tasks.kt:94)
        at kotlinx.coroutines.experimental.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
        at kotlinx.coroutines.experimental.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
        at kotlinx.coroutines.experimental.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:732)

Hard to compile; no clue on how to make it works

I have a node with Corda OS 4.3 running.
I've built a simple Spring Boot app-server using Spring MVC and it works.

I strived to make it compile (maybe outdated doc), which I accomplished by adding the JitPack repository for reaching GitHub and by using the master-SNAPSHOT version indicator (the last published โ€“ v0.5.0, which is not advertised in the docs โ€“ used Corda 3.3 by inspecting the dependencies).

As soon as I add corbeans, it fails at runtime with the following:

java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.autoconfigure.jms.artemis.ArtemisEmbeddedServerConfiguration] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@2e5d6d97]
		at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358) ~[spring-core-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414) ~[spring-core-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:743) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_202]
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:742) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:681) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:649) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1608) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:526) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:497) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:619) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:611) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1242) ~[spring-context-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:869) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
		at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:857) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
		at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:844) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
		at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:795) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
		at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
		at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
		at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
		at com.loanxchain.demo.DemoArtifactApplicationKt.main(DemoArtifactApplication.kt:14) [classes!/:na]
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_202]
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_202]
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_202]
		at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_202]
		at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [demo-artifact-0.0.1-SNAPSHOT.jar:na]
		at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [demo-artifact-0.0.1-SNAPSHOT.jar:na]
		at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [demo-artifact-0.0.1-SNAPSHOT.jar:na]
		at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [demo-artifact-0.0.1-SNAPSHOT.jar:na]
Caused by: java.lang.NoClassDefFoundError: org/apache/activemq/artemis/jms/server/config/JMSConfiguration
		at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_202]
		at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_202]
		at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_202]
		at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
		... 29 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.artemis.jms.server.config.JMSConfiguration
		at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_202]
		at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_202]
		at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92) ~[demo-artifact-0.0.1-SNAPSHOT.jar:na]
		at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_202]
		... 33 common frames omitted

Steps done:

  1. Add maven(url="https://jitpack.io") as "repository" in build.gradle.kts.
  2. Add implementation("com.github.manosbatsis.corbeans:corbeans-spring-boot-starter:master-SNAPSHOT") as "dependency" in build.gradle.kts.
  3. Add & configure corbeans.nodes.default.[username|password|address] in application.properties.
  4. Add a @Autowired @Qualifier("default") lateinit var service: CordaNodeService property in the Controller.
  5. Provide an endpoint which prints this.service.proxy().nodeInfo().legalIdentities[0].name.commonName.
  6. Build & invoke task bootJar.
  7. Run the jar & watch it fail immediately.

trustStore-related node params are ignored

Hi Manos,

There seems to be a problem with propagating the trustStore-related values from node params in corbeans config to the actual Corda client options.

There is no assignment of those options in NodeParams.Companion#mergeParams

This creates problems when RPC with SSL is used.

Integrate with Actuator

Add a plugin similar to corda's webserver and provide privileged information to Spring;'s Actuator

Support Cordform

Investigate if the main starter and sample webserver can support cordform plumbing as a kind of drop-in replacement to corda's default webserver in nodes

Redundant root JAR artifact

Current gradle/maven plumbing deploys an empty JAR artifact for the root module when it should only be deployed/uploaded as a parent POM.

Provide dynamic RPC ops option

Corbeans registers separate, dedicated LazyNodeRpcConnectionn, and CordaNodeService beans for Node entry in application.properties.

This happens during start-up and is rather pointless since stateless beans on top of an RpcConnectionn pool can be much more flexible and dynamic, whether via endpoint, provider, DB etc.

Also a good usecase for the JPA connection mapping https://manosbatsis.github.io/corbeans/docs/data-rpc.html

Spring MVC

Provide documentation and code samples for vanilla Spring MVC users.

Don't Use mavenLocal()

Don't use mavenLocal() in the build.gradle.

If you are dependent on jars in mavenLocal() then the code won't compile anywhere else.

If you aren't dependent on jars in mavenLocal() then you don't need it in the repositories list.

Ignore IDEA Compile Directories

IDEA puts the compile output in a directory called out in each project/sub-project.

The .gitignore specifies the pattern as /out/ instead of out/ which means that only the top level project dir is ignored and not all the compile directories in the sub-projects.

Can't Compile Project

The project doesn't build on checkout due to published.gradle having references to properties not in the project.

Create defaults for these so the project builds for people even for people that aren't publishing.

./gradlew tasks

FAILURE: Build failed with an exception.

* Where:
Script '/Projects/GitHub/blockchain/corbeans/gradle/published.gradle' line: 23

* What went wrong:
A problem occurred evaluating script.
> Could not get unknown property 'ossrhUsername' for object of type org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

Support seperate JVM/classpath for Corda-Spring integration tests

Not sure about the best way to go on this but more or less

  • Provided local or remote cordapp Gradle module(s)
  • Prepare a Corda network e.g. by using
    • a folder equivalent to a node's cordapps folder + node driver + application.properties for node configs
    • a nodes folder created by deployNodes + node driver or runnodes + optionally application.properties for node config overrides
    • containers e.g. docker(-compose) or testcontainers instead of deployNodes/node driver
  • Create and start/stop the Corda network around Spring Boot integration tests via Gradle plugin/task or JUnit extension/rule whatever

Move to CircleCI

Travis likes multiple threads and port binding less and less over time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.