Exception when trying to run corda - java

I'm trying to run sample cordapp-example code by cloning from Github repository using:
git clone https://github.com/corda/samples
I followed all the steps as mentioned in the documentation for running the application from IntelliJ.
[ERROR] 14:54:18,832 [main] internal.DriverDSLImpl. - Driver shutting down because of exception [errorCode=1crywct, moreInformationAt=https://errors.corda.net/OS/4.3/1crywct]
java.lang.IllegalStateException: Unable to start notaries. A required port might be bound already.
at net.corda.testing.node.internal.DriverDSLImpl.start(DriverDSLImpl.kt:390) ~[corda-node-driver-4.3.jar:?]
at net.corda.testing.node.internal.DriverDSLImplKt.genericDriver(DriverDSLImpl.kt:1048) ~[corda-node-driver-4.3.jar:?]
at net.corda.testing.driver.Driver.driver(Driver.kt:185) ~[corda-node-driver-4.3.jar:?]
at com.example.test.NodeDriverKt.main(NodeDriver.kt:15) ~[test/:?]
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771) ~[?:1.8.0_231]
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) ~[?:1.8.0_231]
at net.corda.core.internal.concurrent.CordaFutureImpl.get(CordaFutureImpl.kt) ~[corda-core-4.3.jar:?]
at net.corda.core.internal.concurrent.CordaFutureImplKt.get(CordaFutureImpl.kt:172) ~[corda-core-4.3.jar:?]
at net.corda.core.utilities.KotlinUtilsKt.getOrThrow(KotlinUtils.kt:134) ~[corda-core-4.3.jar:?]
at net.corda.testing.node.internal.DriverDSLImpl.start(DriverDSLImpl.kt:379) ~[corda-node-driver-4.3.jar:?]
... 3 more
[WARN] 14:54:19,251 [driver-pool-thread-0] internal.InternalTestUtils. - Been polling address localhost:10040 to bind for 60 seconds...
[INFO] 14:54:57,702 [driver-pool-thread-0] internal.RPCClient. - Startup took 10512 msec
[INFO] 14:54:58,015 [driver-pool-thread-1] internal.DriverDSLImpl. - Node handle is ready. NodeInfo: NodeInfo(addresses=[localhost:10040], legalIdentitiesAndCerts=[O=Notary Service, L=Zurich, C=CH], platformVersion=5, serial=1578902078740), WebAddress: localhost:10043
Process finished with exit code 137 (interrupted by signal 9: SIGKILL)
I see this description:
[ERROR] 14:13:50,501 [main] internal.DriverDSLImpl. - Driver shutting down because of exception [errorCode=1crywct, moreInformationAt=https://errors.corda.net/OS/4.3/1crywct]
Has anyone else seen this before and are there any recommendations to fixing the issue or clues as to how we can debug it further?

From the error message, I'd see this:
"Unable to start notaries. A required port might be bound already"
which means that the port(s) used by notary is being used by other application, or, most likely being used by another running notary.
How to fix?
Open node.conf in your notary folder, and check the ports listed, such as
address : "localhost:10006"
then check the ports usage in you system, either kill the running process or change the port in notary node.conf and run again.
Good luck.

Related

Jacoco instrumentation using tcp server method

I am trying to run integration tests on my java code from remote server, so whenever my tests hit my code server, jacoco records it.
I am new to jacoco, till now i have gather that there is tcp server method which doesnot require any restart.
I have added below line in my /etc/profile.
export JAVA_OPTS="-javaagent:/home/vansh/jacoco/lib/jacocoagent.jar=address=*,port=57026,destfile=/home/vansh/jacoco/jacoco.exec,output=tcpserver"
2)but when i am trying to take dump using below command -
java -jar jacococli.jar dump --address localhost --port 57026 --destfile /home/vansh/jacoco/jacoco-it.exec
ERROR:
[INFO] Connecting to localhost/127.0.0.1:57026.
[WARN] Connection refused (Connection refused).
[INFO] Connecting to localhost/127.0.0.1:57026.
Exception in thread "main" java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
I checked that there is nothing run on port 57026, is my first command javaagent one is correct?
I have done same thing a year ago, In my case I run a TCP_Client jar for collecting the dump with many ways(periodically/with and without resetting previous coverage).
I set JAVA_OPTS as follows,
-javaagent:<file_Path_for_jacoco_agent>/jacocoagent.jar=output=tcpserver,address=*,port=6300
Here is my repo link of tcp client - enter link description here
set fixed arguments to the code or create a jar with this repo
If you are running a jar from this code,
You can run this jar with passing "address" "port" "dump-folder-path" "periodic-time-for-dumping" "resetting-option-with-every-dump" arguments.
example : java -jar ExecutedDataDump.jar "127.0.0.1" "6300" "D:\\server-dumplog\\" "5" "noreset"
You will get get jacoco.exec files with time stamp in every 5 secs time and due to noreset every jacoco.exec is get cumulative report
Hope this will helpful for you.

Problem encountered while remote debugging java application as a service

I followed this SO post:
What are Java command line options to set to allow JVM to be remotely debugged?
and was able to remotely debug my Java app that runs as a windows service through prunsrv / procrun.
When I run the service with option suspend=n, I am able to connect remote debugger through eclipse:
myservice.exe //US//myservice --JvmOptions "-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:8111,server=y,suspend=n"
but when I give option suspend=y, I get the following error:
Commons Daemon procrun failed with exit value: 5 (Failed to start
service)
any idea why suspend=y is resulting in this error. (Unfortunately detailed logs for prunsrv are not generated)

Can't connect to Spark running in Kubernetes from Java

I have installed Kuberenetes (minikube for Windows 10) and added Spark there using helm:
.\helm.exe install --name spark-test stable/spark
Then I exposed Spark master port 7077 using
.\kubectl.exe expose deployment spark-test-master --port=7070 --name=spark-master-ext --type=NodePort
For example, my UI runs on http://<MINIKUBE_IP>:31905/ and spark master is exposed to <MINIKUBE_IP>:32473. In order to check, I do:
.\minikube-windows-amd64.exe service spark-master-ext
But when I do in Java:
SparkConf conf = new SparkConf().setMaster("spark://192.168.1.168:32473").setAppName("Data Extractor");
I've got:
18/03/19 13:57:29 WARN AppClient$ClientEndpoint: Could not connect to 192.168.1.168:32473: akka.remote.EndpointAssociationException: Association failed with [akka.tcp://sparkMaster#192.168.1.168:32473]
18/03/19 13:57:29 WARN ReliableDeliverySupervisor: Association with remote system [akka.tcp://sparkMaster#192.168.1.168:32473] has failed, address is now gated for [5000] ms. Reason: [Association failed with [akka.tcp://sparkMaster#192.168.1.168:32473]] Caused by: [Connection refused: no further information: /192.168.1.168:32473]
18/03/19 13:57:29 WARN AppClient$ClientEndpoint: Failed to connect to master 192.168.1.168:32473
akka.actor.ActorNotFound: Actor not found for: ActorSelection[Anchor(akka.tcp://sparkMaster#192.168.1.168:32473/), Path(/user/Master)]
Any ideas, how to run Java Spark jobs on Spark running in Minikube?
It looks like Helm chart for Spark is really outdated (1.5.1), so I have installed 2.3.0 locally and it runs without any issues. Case closed, sorry :)

Intellij - Debugger not working in maven project

I came across an issue where I am not able to debug a maven sprint boot REST API application in IntelliJ. The application starts up but won't stop at any breakpoint.
Additionally when I stop the debugger I see below lines in the log, but I can see that the java process never terminates and when I start the app the 2nd time it fails because the server port 8080 is still in use.
Disconnected from the target VM, address: '127.0.0.1:53020', transport: 'socket'
Process finished with exit code -1
In the IntelliJ logs at C:\Users\Bernhard.IdeaIC2017.3\system\log I see the following error.
2017-12-15 07:22:30,761 [ 11899] INFO - .server.BuildMessageDispatcher - An existing connection was forcibly closed by the remote host
java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1100)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:372)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at java.lang.Thread.run(Thread.java:745)
You can probably wrap the value of that argument in quotations. The parser that reads the entire command line string is probably choking because of the -D arg within a -D arg.
clean package -Drun.profiles=dev-us-east-1 -Drun.jvmArguments="-Denvironment=dev" -DskipTests spring-boot:run
After some searching I found that the problem is with my Maven Run/Debug configuration in IntelliJ. The command line I use to start the spring boot rest api is
clean package -Drun.profiles=dev-us-east-1 -Drun.jvmArguments=-Denvironment=dev -DskipTests spring-boot:run
It appears that the -Drun.jvmArguments=-Denvironment=dev java command line property is the culprit. When I remove it the break points work again.

Error while starting GoldFish server: Ubuntu 13.10

I consulted here and here but could not get my problem solved.
When I type this on terminal /opt/glassfish4/glassfish/bin/asadmin start, I get the following result:
Remote server does not listen for requests on [localhost:4848]. Is the server up?
Unable to get remote commands.
Closest matching local command(s):
restart-domain
restart-local-instance
start-database
start-domain
start-local-instance
Command start failed.
Similarly, when I type this /opt/glassfish4/glassfish/bin/asadmin --port 5656 start-domain, I get
java.io.IOException: Couldn't get lock for /opt/glassfish4/glassfish/domains/domain1/logs/server.log
at java.util.logging.FileHandler.openFiles(FileHandler.java:389)
at java.util.logging.FileHandler.<init>(FileHandler.java:287)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:98)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:191)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:220)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:117)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:321)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:360)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:298)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
Waiting for domain1 to start .Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:
Launching GlassFish on Felix platform
Exception in thread "main" java.lang.RuntimeException: the domain directory is not writable.
at com.sun.enterprise.glassfish.bootstrap.MainHelper.verifyDomainRoot(MainHelper.java:244)
at com.sun.enterprise.glassfish.bootstrap.MainHelper.findInstanceRoot(MainHelper.java:347)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:78)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Command start-domain failed.
I sense there is something problem in path /opt/glassfish4/glassfish/bin/asadmin. I am working on my first JSF web application and cannot run glassfish server. I am using Netbeans and ubuntu 13.10.
Can anyone show me the way?
Thank you!
The error messages
java.io.IOException: Couldn't get lock for
/opt/glassfish4/glassfish/domains/domain1/logs/server.log
and
Exception in thread "main" java.lang.RuntimeException: the domain
directory is not writable.
indicate that the user account you use to start the server doesn't have write permissions in your Glassfish domain folder.
To solve the problem either change the permissions or start the asadmin command with a user who has sufficient permissions.
If this doesn't solve the problem, there may be another process which has a lock on your server.log file, but I guess you would have noticed that. To make sure you can run
lsof /opt/glassfish4/glassfish/domains/domain1/logs/server.log
to see if any process is using the file.
See also:
Failed to start glassfish server because Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log

Categories

Resources