Thursday 27 April 2017

Errata - Java EE Module 1, Chapter 6

We've recently been made aware of a small issue which affects chapter 6 (the CDI chapter) of Java EE with Wildfly, Module 1. You might experience this issue if you're using some versions of Java 8 to create your project - we're aware it is a problem in Java 8.60 and above.

In the video we talk about the different ways to tell JavaEE which implementation of a particular interface should be injected at runtime, when multiple implementations exist in your project. We first demonstrate the @Default and @Alternative annotations, then we look at specifying the required implementation in beans.xml, and finally we discuss qualifiers, which allow us to specify a different implementation in one specific area of our code.

In the video, we end up with all 3 methods in our project in use at the same time, and this worked fine at the time of recording. However we have found that when you then add in your own custom annotations (such as @ProductionDao - the example we use in the video) the deployment might fail. It appears that there is a bug in Java 8 which means that you can't use custom annotations together with beans.xml.

So you are fine to use @Default and custom annotations together, but not beans.xml and custom annotations. As most users will agree that using @Default and @Alternative are much easier than editing the xml file, this probably won't cause much difficulty in practice, but if you are getting a message that the build has failed, this will be why. If you're following along with the chapter, simply remove beans.xml from your project, and you will be able to continue with no further issues.


  1. Hay I am trying to start the wildfly-10.1.0 in windows 10 but I can't. I face this problem "Calling "C:\Program Files\wildfly-10.1.0.Final\bin\standalone.conf.bat"
    JAVA_HOME "C:\Program Files\Java\jdk1.7.0_71;C:\Users\wonde12\android-sdks\tools\;C:\Program Files\Java\jdk1.7.0_71;C:\Users\wonde12\android-sdks\tools;C:\Users\wonde12\AppData\Local\Android\sdk\tools;c:\Program Files\Java\jdk1.7.0_21\;C:\Program Files\wildfly-10.1.0.Final\bin" path doesn't exist" , am trying all options, i mean setup environment variable of JBOSS_HOME, change the JAVA_HOME inside standalone.conf.bat file but still the error is coming so I can not follow the video please help me.

  2. Hi Wondyfraw - please can you raise this question via the contact-us page on the Virtual Pair Programmers' website, and then one of our technical team can help you. When you've sent the message, you'll get an automated response by email - you can reply to that response adding any attachments - it might help if you can send a screenshot as it's difficult to work through that error message when it's typed in... it looks like it might be either JAVA_HOME or PATH that are not right?

  3. It could be mentioned that @Alternative annotation must be removed from EmployeeDataAccessTesting together with bean.xml

  4. Hi Matt,

    Sorry for contacting you via your Blog - I tried to find contact details on your web page, but couldn't get through, so I hope this is okay. My name's Riddhi Phatnani, and I work as the Licensing Editor for Packt Publishing ( We're currently looking to expand our video content and are exploring licensing video courses from experienced instructors such as yourself. I've seen your courses on Udemy that I think would do really well on our platform and our partner platforms and channels.
    At Packt we have a substantial reach to a huge number of developers through our book publishing, and we are currently expanding that through video. We think we can also expand your own reach to your audience, leveraging Packt's brand and excellent direct marketing knowledge, increasing your profile and your income. Not only can Packt offer more ways to reach customers for you, but also something like 80% of developers are estimated to be people in a B2B and corporate learning situation, and we have a global reach to people in these environments, as well as our core retail. We'd be looking at a non-exclusive license, so all of your content could still thrive on your existing platforms including Udemy, etc., and we’d be looking at a flat revenue share with you taking 50%.
    Let me know if that's something that you'd like to discuss further. My email address is

    Riddhi Phatnani

  5. Hi Matt,

    Hope you've had got a chance to think about our partnership. Let me know what do you think. Are there any clarifications I can help with?

    Riddhi P.
    Licensing Editor

  6. By reading this article, many things have piled up in my mind which made me to think about it. You have put some high quality and valuable information here that any reader would love to read. I sincerely share many of your views in this article.
    SAP training in Kolkata
    SAP course in kolkata