Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

A Kao

+ Follow
since Apr 26, 2016
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by A Kao

I am working on the Fundamentals of Java EE Development, Red Hat (JB083x  course) through edX.
I completed chapters 1 and 2 successfully.
For chapters 3, I did:
[INFO] Surefire report directory: /home/ak/Fundamentals_of_Java_EE_Development_Red_Hat/JB083x-lab/labs/stateless-ejb/target/surefire-reports

Apr 26, 2020 11:21:34 AM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.6.Final-redhat-1
Apr 26, 2020 11:21:34 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.6.Final-redhat-1
Apr 26, 2020 11:21:34 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.18.Final-redhat-1
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.579 sec <<< FAILURE!

Results :

Tests in error:
 testHelloEJB( ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.814 s
[INFO] Finished at: 2020-04-26T11:21:35-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project stateless-ejb: There are test failures.
[ERROR] Please refer to /home/ak/Fundamentals_of_Java_EE_Development_Red_Hat/JB083x-lab/labs/stateless-ejb/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[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] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]

The same error occurred for either
EAP-7.3.0 or

I tried changing the pom.xml from

to either

My environment are:

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/ak/maven/apache-maven-3.6.3
Java version: 1.8.0_251, vendor: Oracle Corporation, runtime: /home/ak/jdk/jdk1.8.0_251/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "4.10.0-38-generic", arch: "amd64", family: "unix"
1 month ago

Paul Clapham wrote:

A Kao wrote:Business requirement prevent changing the xsd file.

I'm surprised that you have a business requirement which is so important that it protects the document by making it unusable.

But fine, let's suppose the business managers know what they're doing. Then make a copy of the document and edit it to be usable.

I work for the government.
Changing these business requirements require agreement from all stakeholders, which will take a long time.
That is why I try to figure out a way to change the class name generated from a complex type from schema.
JAXB SCD approach is close, is that any workaround?

Paul Clapham wrote:Seems to me that the easiest way to do that would be to edit those documents and make the appropriate changes. For example where you have

you could change that to

and so on. No?

Business requirement prevent changing the xsd file.
I like to change the class name generated from a complex type from the following schema common.xsd.
"UserType" rename to "User",
"UserWithEffectiveDateType" rename to "UserWithEffectiveDate".
I tried JAXB (v2.2.6) customization with "schema component designator" (SCD).
However, output consists of "UserType" and "User", "UserWithEffectiveDateType" and "UserWithEffectiveDate".
How to fix this problem?






Cay Horstmann wrote:When I first saw the new HTTP client, I had high hopes that it would come with support for REST. At the very least, a JSON content handler. But nooo...I was told that JSON was not a part of the core platform, so that not something they'd sully their hands with. The HTTP client doesn't do forms or file upload either. This is one of the few times that I may end up breaking my own rules and cover a non-core API in Core Java. But I don't think I'll write a whole book on REST.



Does "a whole book" mean 500+ pages?
Your "Java SE8 for the Really Impatient" book is 240 pages.   Will you write a short book on REST for similar page counts in the future?
2 years ago

Cay Horstmann wrote:Hi, it's good feedback that you want HTTP/2 push covered.

Generally, I stick to use cases that (a) aren't bleeding edge and (b) are of interest to application programmers, not system programmers. If in a year or two, application programmers have to worry about this, I'll put it into the book.

I think it's an important skill to eyeball a new feature and gauge whether it has a broad impact. For example, someone who should remain nameless (Simon Ritter) gives presentations about new features in Java 9 that contain such gems as "PKCS12 key stores by default" and "Spin-Wait Hints". These are important features only for the small number of heroes who give us application programmers better-performing libraries and tools. The service that I aim to provide is that I don't put them in my books.

Of course, I am sometimes wrong, so if you feel that I am missing the boat on an important feature, let me know.



I am a Java web services developer.
RESTful Web Services builds upon HTTP, so I am curious how the HTTP/2 (e.g. push) features in Java will affect web services, especially RESTful ones.
Will you write a book about Java web services in the future?
2 years ago
I enjoyed reading your previous Java books.
How complete is your new book Java 9 SE for Impatient HTTP/2 coverage?
I downloaded your source codes.
I see, which is good.
I do not see HTTP/2 Push, ... example.
2 years ago
I downloaded the source codes of the book "Java Web Services - Up and Running" from .
I compiled the chapter 7 source codes successfully to create /home/ak/JavaWebServices-UpandRunning/jwsur2Ch7/ch7/website/service/tcService.war .
Deploying it with this command on wildfly-10.1.0.Final has this error.

{"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"tcService.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"tcService.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"tcService.war\"
   Caused by: org.apache.cxf.service.factory.ServiceConstructionException
   Caused by: org.apache.cxf.service.factory.ServiceConstructionException
   Caused by: org.apache.cxf.BusException: No DestinationFactory was found for the namespace"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"tcService.war\".INSTALL"],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}}}




cxf-rt-bindings-coloc-3.1.6.jar       cxf-rt-security-saml-3.1.6.jar           cxf-tools-java2ws-3.1.6.jar
cxf-rt-bindings-object-3.1.6.jar      cxf-rt-transports-http-3.1.6.jar         cxf-tools-validator-3.1.6.jar
cxf-rt-bindings-soap-3.1.6.jar        cxf-rt-transports-http-hc-3.1.6.jar      cxf-tools-wsdlto-core-3.1.6.jar
cxf-rt-bindings-xml-3.1.6.jar         cxf-rt-transports-jms-3.1.6.jar          cxf-tools-wsdlto-databinding-jaxb-3.1.6.jar
cxf-rt-databinding-aegis-3.1.6.jar    cxf-rt-transports-local-3.1.6.jar        cxf-tools-wsdlto-frontend-jaxws-3.1.6.jar
cxf-rt-databinding-jaxb-3.1.6.jar     cxf-rt-ws-addr-3.1.6.jar                 cxf-xjc-boolean-3.0.5.jar
cxf-rt-features-clustering-3.1.6.jar  cxf-rt-wsdl-3.1.6.jar                    cxf-xjc-bug986-3.0.5.jar
cxf-rt-frontend-jaxws-3.1.6.jar       cxf-rt-ws-mex-3.1.6.jar                  cxf-xjc-dv-3.0.5.jar
cxf-rt-frontend-simple-3.1.6.jar      cxf-rt-ws-policy-3.1.6.jar               cxf-xjc-runtime-3.0.5.jar
cxf-rt-management-3.1.6.jar           cxf-rt-ws-rm-3.1.6.jar                   cxf-xjc-ts-3.0.5.jar
cxf-rt-security-3.1.6-jandex.jar      cxf-services-ws-discovery-api-3.1.6.jar  module.xml
cxf-rt-security-3.1.6.jar             cxf-tools-common-3.1.6.jar

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)

Maven home: /home/ak/maven/apache-maven-3.3.9

Java version: 1.8.0_131, vendor: Oracle Corporation

Java home: /home/ak/jdk/jdk1.8.0_131/jre

Default locale: en_CA, platform encoding: UTF-8

OS name: "linux", version: "4.4.0-21-generic", arch: "i386", family: "unix"
2 years ago

Pierre-Yves Saumont wrote:The default value (for the year) is used by the formatter, not by the parser. You need an additional format string:

I figured out the solution myself too.
3 years ago
Please help to fix the error java.time.format.DateTimeParseException.

Oct 23 is not parsable!
Exception in thread "main" java.time.format.DateTimeParseException: Text 'Oct 23' could not be parsed, unparsed text found at index 0
at java.time.format.DateTimeFormatter.parseResolved0(
at java.time.format.DateTimeFormatter.parse(
at java.time.LocalDate.parse(
at TestDate.main(
3 years ago

Tim Moores wrote:Which SSL/TLS protocols does the server support?


Tim Moores wrote:What are you trying to achieve by setting that property?

I got " Received fatal alert: protocol_version" without setting the property "https.protocols".
Therefore I set the property "https.protocols" but still got the same error.
JDK is 1.7.0.
Setting "https.protocols" to "TLSv1" still got " Received fatal alert: protocol_version".

The Windows 7 DOS console output was as follow:
[write] MD5 and SHA1 hashes:  len = 182
main, WRITE: TLSv1 Handshake, length = 182
[Raw write]: length = 187
[Raw read]: length = 5
0000: 15 03 01 00 02                                     .....
[Raw read]: length = 2
0000: 02 46                                              .F
main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1 ALERT:  fatal, protocol_version
main, called closeSocket()
main, handling exception: Received fatal alert: protocol_version Received fatal alert: protocol_version
****** Content of the URL ********
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at HttpsClient.print_https_cert(
at HttpsClient.testIt(
at HttpsClient.main( Received fatal alert: protocol_version
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at$ Source)
at$ Source)
at Method)
at Source)
at Source)
at Source)
at HttpsClient.print_content(
at HttpsClient.testIt(
at HttpsClient.main(
Caused by: Received fatal alert: protocol_version
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at HttpsClient.print_https_cert(
at HttpsClient.testIt(
... 1 more