Activiti + Spring Boot + Gradle build hangs while gradle clean test - java

I am having an issue with executing gradle clean test command.
My application is using activiti for workflow.
Git url: https://github.com/sanelib/eBOSS/tree/merge-before-dev
Branch: "merge-before-dev" is having more tests for activiti worflow process. But it execute only 6 of 12 integration tests from "core" module. If I use #Ignore to any random 6 tests then it success for rest 6. I have put some console out to debug and found it hangs on starting activiti process.
This source has also included database schema in /scripts folder. Let me know if you miss any required file for testing in your environment.
Can anybody look into this and give me solution?

I got also result: 23 tests completed, 14 failed :core:test FAILED
Than I randomly picked one of your tests and it failed in isolation also. It doesn't seem to be concurrency problem.
Root cause seem to be this:
2016-02-05 20:56:16.556 WARN 16072 --- [ main] o.h.e.jdbc.internal.JdbcServicesImpl : HHH000342: Could not obtain connection to query metadata : Cannot create PoolableConnectionFactory (Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
Place break-point on this line in Hibernate.
So it does seem to be connection problem.

Related

Chaincode Container Unable to Start Routing in Hyperledger Fabric

I'm actually trying to develop an hyperledger network composed by 11 peers belongs to the same organization (the only org in the network). For the deploy I'm following the hyperledger tutorial skeleton (v2.2) rewriting scripts from the fabric-samples repository for our purposes.
Deploy is essentially completed except for the chaincode (I'm using java version of basic-transfer chaincode for testing), scripts passes every of the following steps:
Packaging chaincode
Installing chaincode for each peer
Query installed chaincode (succesfull for each peer)
ApproveForMyOrg by authorized peer
Check commit readiness (succesfull for each peer)
Commit chaincode
Query Commited Chaincode (succesfull for each peer)
At the end of these steps are supposed to be some containers representing chaincode deployed for eache peer. Containers are created but I found each of them exited with status 1.
Inspecting logs inside crashed containers I've found the following error:
Thread[main,5,main] 12:58:44:717 SEVERE org.hyperledger.fabric.contract.ContractRouter startRouting Unable to start routing
org.hyperledger.fabric.contract.ContractRuntimeException: Unable to start routing
at org.hyperledger.fabric.contract.ContractRouter.startRouting(ContractRouter.java:99)
at org.hyperledger.fabric.contract.ContractRouter.main(ContractRouter.java:174)
Exception in thread "main" org.hyperledger.fabric.contract.ContractRuntimeException: Unable to start routing
at org.hyperledger.fabric.contract.ContractRouter.startRouting(ContractRouter.java:99)
at org.hyperledger.fabric.contract.ContractRouter.main(ContractRouter.java:174)
furthermore inspecting log inside the commiter peer container I've found this warning:
2022-07-19 12:58:44.924 UTC [lifecycle] Work -> WARN 07b could not launch chaincode 'basic_1.0:bbab0f02e28d4564deb06801011c79a705a33755dc6f25d6e2ae8dd39b51a09f': chaincode registration failed: container exited with 1
At this point I cannot invoke deployed chaincode for this reason.

Unsupported partitioner with Amazon Keyspaces (for Apache Cassandra)

I have a Java Spring app and I'm using Amazon Keyspaces (for Apache Cassandra). I'm using the sigv4 plugin , (version 4.0.2), the cassandra java-driver-core (version 4.4.0) and have followed the official documentation on how to connect my java app with MCS. The app connects just fine but I'm getting a weird warning at start up:
WARN 1 --- [ s0-admin-0] .o.d.i.c.m.t.DefaultTokenFactoryRegistry : [s0] Unsupported partitioner 'com.amazonaws.cassandra.DefaultPartitioner', token map will be empty.
Everything looks good but after a few minutes that warning comes back and my queries start to fail. This is how the logs look after a few minutes:
WARN 1 --- [ s0-admin-0] .o.d.i.c.m.t.DefaultTokenFactoryRegistry : [s0] Unsupported partitioner 'com.amazonaws.cassandra.DefaultPartitioner', token map will be empty.
WARN 1 --- [ s0-io-1] c.d.o.d.i.c.m.SchemaAgreementChecker : [s0] Unknown peer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, excluding from schema agreement check
WARN 1 --- [ s0-io-0] c.d.o.d.i.c.control.ControlConnection : [s0] Unexpected error while refreshing schema after a successful reconnection, keeping previous version (CompletionException: com.datastax.oss.driver.api.core.connection.ClosedConnectionException: Channel was force-closed)
WARN 1 --- [ s0-io-1] c.d.o.d.i.c.m.DefaultTopologyMonitor : [s0] Control node ec2-x-xx-xxx-xx.us-east-2.compute.amazonaws.com/x.xx.xxx.xxx:xxxx has an entry for itself in system.peers: this entry will be ignored. This is likely due to a misconfiguration; please verify your rpc_address configuration in cassandra.yaml on all nodes in your cluster.
I have debugged a little and it looks like that partitioner comes from the actual node metadata, so I don't really know if there's an actual way to fix it.
I've seen there's a similar question asked recently here, but no solution has been posted yet. Any ideas? Thanks so much in advance
These are all warnings and not errors. Your connection should work just fine. They are logged due to how Amazon Keyspaces is slightly different from an actual Cassandra cluster. Try setting these to get rid of the noise:
datastax-java-driver.advanced {
metadata {
schema.enabled = false
token-map.enabled = false
}
connection.warn-on-init-error = false
}
Problem the same with me.
The above problems encountered when using a Spring boot version 2.3.x
Because is a Spring boot version 2.3.x
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra-reactive</artifactId>
</dependency>
OR
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency>
When creating a Maven / Gradle will get "datastax-java-driver-core 4.6.1" and I think this is another reason that Amazon Keyspaces are not supported.
Okay, Clear.....
Back to the subject of AWS library aws-sigv4-auth-cassandra-java-driver-plugin 4.0.2
When creating a Maven / Gradle will get "datastax-java-driver-core 4.4.0"
Now I am starting to see that Amazon Keyspaces
Maybe not supported "datastax-java-driver-core" with version greater than 4.4.0
Okay, it's been very long.
If you want Application Spring Boot 2 to work
You try following the solutions follows.
look at pom.xml
remove aws-sigv4-auth-cassandra-java-driver-plugin
downgrade Spring boot version 2.3.x to 2.2.9
add dependency below,
spring-boot-starter-data-cassandra-reactive
OR
spring-boot-starter-data-cassandra
create Amazon digital certificate and download
If you used InteljiJ IDEA Edit Configurations
Goto Edit Configurations -> next VM Options add below,
-Djavax.net.ssl.trustStore=path_to_file/cassandra_truststore.jks
-Djavax.net.ssl.trustStorePassword=my_password
Reference: https://docs.aws.amazon.com/keyspaces/latest/devguide/using_java_driver.html
application-dev.yml add config below,
spring:
data:
cassandra:
contact-points:
- "cassandra.ap-southeast-1.amazonaws.com"
port: 9142
ssl: true
username: "cassandra-username"
password: "cassandra-password"
keyspace-name: keyspace-name
request:
consistency: local_quorum
Run Test Program
Pass.
Work for me.
Tech Stack
Spring Boot WebFlux 2.2.9.RELEASE
Cassandra Reactive
JDK 13
Cassandra Database with Amazon Keyspaces
Maven 3.6.3
Have fun with programming.

Why some VPN clients break Java debugging and how to work around the issue?

I am using IntelliJ to develop a Scala project.
Due to client-server architecture of the system, my integration tests have to be run with the following settings in build.sbt:
fork in IntegrationTest := true
javaOptions in (IntegrationTest) ++= Seq("-Djdk.logging.allowStackWalkSearch=true", "-XX:PermSize=256M", "-XX:MaxPermSize=512M", "-Xmx1024m")
// for attaching with debugger to the processes under test
javaOptions in (IntegrationTest) += "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
Normally everything works fine - tests are being run, debugging works.
Sometimes I need to establish a VPN connection to access some resources of my employee company. I'm using Check Point Endpoint Security VPN (that's the officially recommended software of my employee and I'm not sure if anything else would work).
So, if I happen to be connected to the VPN and then run the integration tests, then SBT console starts getting stuck right after:
Listening for transport dt_socket at address: 5005
The exact message is:
Listening for transport dt_socket at address: 5025
[error] Uncaught exception when running tests: java.net.ConnectException: Connection timed out: connect
[trace] Stack trace suppressed: run last project/it:test for the full output.
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
When I run last project/it:test (I have to reload SBT console first because it has stuck in (busy) > state) I see this:
[debug] javaOptions: List(-Djdk.logging.allowStackWalkSearch=true, -XX:PermSize=256M, -XX:MaxPermSize=512M, -Xmx1024m, -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005)
[debug] Forking tests - parallelism = false
[debug] Create a single-thread test executor
[error] Uncaught exception when running tests: java.net.ConnectException: Connection timed out: connect
Sometimes when I disconnect the VPN and run the tests again, it starts working. But often disconnecting VPN doesn't help and I have to reboot my computer.
I have tried some less dramatic solutions - restarting IDE, killing all java and javaw processes, looking at netstat results to see anything still using the port 5005, changing the port to 5025 in build.sbt and reloading SBT console... nothing works, only reboot and only until the next time I need to connect to VPN.
That's a nightmare. I don't want to reboot my machine each time after I connect to VPN.
Is there any solution to this? Any Java flags? Any Windows network stack settings? Any VPN settings?

Spring Boot with debug args not close debug port after application stopped

I'm running my Spring Boot application with debug mode enabled. Like:
mvn -P dev spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
I can debug the application after that without any problem. But, after stopped (ctrl + c) and try to start again, I receive this error:
[INFO] Attaching agents: []
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
So, every time that I need to start the application in debug mode after that, I need to kill the process using the port 5005.
I would like to know why the port 5005 is still opened after stop the application.
I'm using Cygwin64 on Windows 10, Maven 3.5.2, Java 8 and Spring Boot 1.5.9.RELEASE.
Thanks!
This is not a problem of Spring Boot, but a problem of non-cygwin applications running in cygwin. And your application is not only leaving port 5005 open, it just keeps running in the background, having port 8080 also opened, but as on a restart the debug port is first opened, this is what you see in the error message.
This was discussed in a SpringBoot issue back in 2014 https://github.com/spring-projects/spring-boot/issues/773. I cite from this issue (the link in the citation dates from 2006):
Anyone still following this bug, this isn't a Spring Boot bug at all. It's a known problem with non-Cygwin programs (Java in this case) running on pty-based terminals.
See this link for a full explanation why this can't be fixed: http://cygwin.com/ml/cygwin/2006-12/msg00151.html
So you can basically use one of the following approaches:
use the native windows terminal and setup your java and maven environment for that
run your maven command from within an IDE which can handle this - you might use this for debugging as well
add the Spring Actuator to your app and use the /shutdown endpoint to stop your application

Getting ScreenRenderException while running OfBiz

I am new to OfBiz.while running it in eclipse...I got the following in eclipse console...
Httpd started on port: 9989
Sessiond started on port: 9990
2014-02-04 12:57:37,538 (main) [ BeanShellContainer.java:100:INFO ] Started BeanShell telnet service on 9989, 9990
2014-02-04 12:57:37,538 (main) [ BeanShellContainer.java:101:INFO ] NOTICE: BeanShell service ports are not secure. Please protect the ports
2014-02-04 12:57:45,824 (org.ofbiz.service.jms.JmsListenerFactory#6ec213ad) [ JmsListenerFactory.java:75 :INFO ] JMS Listener Factory Thread Finished; All listeners connected.
after this I am trying to open url https://localhost:8080/webtools as mentioned in the tutorial but i am experiencing the following error message in the browser
:ERROR MESSAGE:
org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.IllegalArgumentException: Template location is empty (Template location is empty)
Help me to fix this...Thank You
That error usually happens when you run the ant build without any additional command and then execute the application
>ant
You can install the demo or a new installation, to install the demo run:
>ant load-demo
OR to install the new one run:
>ant run-install
if you need to clean before a new installation run:
>ant clean-all
With the information and templates loaded the application should work now, run from eclipse or with the command
startofbiz
Hope it helps
Regards

Categories