Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!

Joseph Hwang

Ranch Hand
+ Follow
since Aug 17, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joseph Hwang

First Below javascript code is to call outside javascript function.



And the next codes are websocket.js file


But throws error like below,



Please inform me how to call the function from the another javascript.
First below codes are my spring RESTful Server controller class.



And the following codes are Ajax Java script with jquery.



The in java script prints below value.



But in restcontroller prints the following value.



I am afraid the generated json value of jquery javascript bring some error. But I hava no idea how to make proper json type value.
Any idea will be deeply appreciated. Thansk.
Hello, I try to produce xml-format data from spring boot restcontroller. Below is my model codes first.



And Below codes are RestConstroller.java



Json format data are successfully returned. But xml-format values are not generated. It throws the following exception.



I add the a few dependencies onto pom.xml like below,



But still throws the same exception. Any idea will be deeply appreciated. Thanks in advance!
Thank you for your reply. I solved this issue by simple modification like below,



I put the input thread start line to the next of output thread line. And It works. ;)
8 months ago
First, Below codes are simple Java socket programming,

==== Server Codes =====


I think the above server application codes work well, It throws no exceptions. But the problem is that the below client socket codes throws "Socket closed Exception" when the client stops.

==== Client Codes ======


The exception is
java.net.SocketException: Socket closed
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.socketRead(Unknown Source)
       at java.net.SocketInputStream.read(Unknown Source)
       at java.net.SocketInputStream.read(Unknown Source)
       at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
       at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
       at sun.nio.cs.StreamDecoder.read(Unknown Source)
       at java.io.InputStreamReader.read(Unknown Source)
       at java.io.BufferedReader.fill(Unknown Source)
       at java.io.BufferedReader.readLine(Unknown Source)
       at java.io.BufferedReader.readLine(Unknown Source)
       at com.aaa.client.InputThread.run(JavaChatClient.java:66)

It seems when the "br.readLine()" line is executed, the the socket of BufferedReader objects br is already closed. So it throws Socket closed Exception.
I'd like to know how to close the BufferedReader br object automatically when the client socket connection is disconnected.
I am totally stuck here. Any advice will be appreciated. Thanks
8 months ago
The problem is solved with this code,



And more, Function is not java.util.function.Function, but org.apache.spark.api.java.function.Function;
Any way, Thank you for your replies!
1 year ago
Thank you for your reply. I am a beginner on lambda expression. Would you inform me of the simple lambda expression for class PutFunction on the 1st codes.
Best regards.
1 year ago
I try to generate java 8 function with using java lambda. Below is the java 8 codes



Then I made the following codes using java lambda,



But the above code throws exception.
Cannot invoke map((<no type> cells) -> {}) on the array type String[]

Your any reply will be deeply appreciated. Best regards.
1 year ago
I am evaluating the Hawkular project of jboss monitoring system with wildfly 10.0.
As you know Hawkular monitoring system uses cassandra nosql db.
So I install and execute cassandra db first and configure the hawkular component into wildfly.(If you want to know the process, I will explain)
After configuration, I run hawkular agent contained wildfly 10.0. But wildfly throws the following exception.



To run hawkular agent contained wildfly, I have to embed org.kawkular.common.cassandra-driver. in wildfly modules.
After googling I found the ref-site http://central.maven.org/maven2/org/hawkular/commons/cassandra-driver-wf-module/0.2.5.Final/
Until now I downloaded the already-built jars and wars and install them. So i have poor knowledge of maven and even more not have enough time to learn maven.
If I am going to wrong direction, please don't hesitate correct my question.
Below is the pom.xml you asked.

2 years ago
First, I made repository folder in maven_home with setting.xml.



And I unzip and move cassandra-driver-core-2.2.0-rc2.jar in a specific folder - C:\test\com\datastax\cassandra\main
Then I execute the following mvn command

> mvn install:install-file -Dfile=C:\test\com\datastax\cassandra\main\cassandra-driver-core-2.2.0-rc2.jar -DgroupId=org.hawkular.commons -DartifactId=cassandra-driver-wf-module -Dversion=0.2.5.Final -Dpackaging=jar

Build is successful. I copy the pom.xml to c:\test and modifled the pom.xml like below



Build is successful but jar file is empty. Build message is shown,



I need your advice desperately. Thanks
2 years ago

Joseph Hwang wrote:First sorry for my poor knowledge.
I just need cassandra-driver-wf-module jar file which is like a kind of jdbc file, like mysql-connector-java-5.1.38-bin.jar of mysql or ojdbc7.jar file of oracle 12c.
I try to add the generated cassandra-driver-wf-module jar file to widfly modules with module.xml. cassandra-driver-core-2.2.0-rc2.jar file throws exception when deployed in wildfly.
Any comments will be appreciated. Thanks in advance.

2 years ago
First sorry for my poor knowledge.
I just need cassandra-driver-wf-module jar file which is like a kind of jdbc file, like mysql-connector-java-5.1.38-bin.jar of mysql or ojdbc7.jar file of oracle 12c.
I try to add the generated cassandra-driver-wf-module jar file to widfly modules with module.xml.
Any comments will be appreciated. Thanks in advance.
2 years ago
Thank you for your reply. As you said I change pom to jar in packaging element. And execute 'mvn compile' and 'mvn package'. But it throws following error.

WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: C:\temp\target\cassandra-driver-wf-module-0.2.5.Final.jar
[INFO]
[INFO] --- maven-assembly-plugin:2.5.4:single (module) @ cassandra-driver-wf-mod
ule ---
[INFO] Reading assembly descriptor: assembly.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.736 s
[INFO] Finished at: 2016-09-09T12:43:47+09:00
[INFO] Final Memory: 14M/35M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.
5.4:single (module) on project cassandra-driver-wf-module: Error reading assembl
ies: Error locating assembly descriptor: assembly.xml
[ERROR]
[ERROR] [1] [INFO] Searching for file location: C:\temp\assembly.xml
[ERROR]
[ERROR] [2] [INFO] File: C:\temp\assembly.xml does not exist.
[ERROR]
[ERROR] [3] [INFO] File: C:\temp\assembly.xml does not exist.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1]

Any advise will be deeply appreciated.
2 years ago
I downloaded cassandra-driver-wf-module-0.2.5.Final.xml file and change the file name to pom.xml
The content is below



I hope this is helpful
2 years ago
I am a newbie to maven.
I try to build cassandra-driver-wf-module.0.2.5.Final.jar with maven. I set configuration with apache-maven-3.3.9 folder in windows 10 and folder path.
I downloaded 2 files from http://central.maven.org/maven2/org/hawkular/commons/cassandra-driver-wf-module/0.2.5.Final/ ,
cassandra-driver-wf-module-0.2.5.Final-module.zip and cassandra-driver-wf-module-0.2.5.Final.xml.
However I don't know how to generate cassandra-driver-wf-module.0.2.5.Final.jar with maven command.
Kindly inform me how to build jar file with maven command.
Best regards.
2 years ago