javaeetutorial
  1. javaeetutorial
  2. JAVAEETUTORIAL-172

4 examples in Java EE 7 SDK fail because zero-byte length beans.xml files are not zero bytes long

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 7.0.1
    • Fix Version/s: 7.0.5
    • Component/s: examples
    • Labels:
      None
    • Environment:

      Any

      Description

      Four beans.xml files that should be zero bytes long were inadvertently modified to 1 KB (contain 2 empty lines) during the bundling process. This causes the examples that contain these files to fail. The four files are:

      1. glassfish4/docs/javaee-tutorial/examples/concurrency/jobs/src/main/webapp/WEB-INF/beans.xml
      2. glassfish4/docs/javaee-tutorial/examples/web/jsonp/jsonpmodel/src/main/webapp/WEB-INF/beans.xml
      3. glassfish4/docs/javaee-tutorial/examples/web/jsonp/jsonpstreaming/src/main/webapp/WEB-INF/beans.xml
      4. glassfish4/docs/javaee-tutorial/examples/web/jsf/checkout-module/src/main/webapp/WEB-INF/beans.xml

      The beans.xml files in the concurrency/jobs, jsonp/jsonpmodel, and jsonp/jsonpstreaming projects can be deleted. The examples will then run as expected.

      The beans.xml file in the jsf/checkout-module must be modified in a text editor. Open the file and add the following content, making sure to add an empty line at the end:

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd">
      </beans>

      The jsf/checkout-module should now run as expected.

        Activity

        Hide
        jendrock added a comment -

        The workaround is to follow the instructions in the description, deleting the beans.xml files in the concurrency/jobs, jsonp/jsonpmodel, and jsonp/jsonpstreaming projects and editing the beans.xml file in the jsf/checkout-module project to add this content followed by a blank line:

        <?xml version="1.0" encoding="UTF-8"?>
        <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd">
        </beans>

        Then, if you following the instructions in the documentation (bundled or online), all four examples should run with Maven/Cargo on the command line or with NetBeans IDE 7.3.1.

        These issues will be fixed in the next tutorial update.

        Show
        jendrock added a comment - The workaround is to follow the instructions in the description, deleting the beans.xml files in the concurrency/jobs, jsonp/jsonpmodel, and jsonp/jsonpstreaming projects and editing the beans.xml file in the jsf/checkout-module project to add this content followed by a blank line: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd "> </beans> Then, if you following the instructions in the documentation (bundled or online), all four examples should run with Maven/Cargo on the command line or with NetBeans IDE 7.3.1. These issues will be fixed in the next tutorial update.
        Hide
        Ian Evans added a comment -

        Eric, could you post the Weld error when you deploy with the 1 byte beans.xml descriptor? I'm sure some people will search for the error string.

        It's also possible that we should file a bug against Weld. An empty file is an empty file, whether there is one carriage return or CF/LF.

        Show
        Ian Evans added a comment - Eric, could you post the Weld error when you deploy with the 1 byte beans.xml descriptor? I'm sure some people will search for the error string. It's also possible that we should file a bug against Weld. An empty file is an empty file, whether there is one carriage return or CF/LF.
        Hide
        jendrock added a comment -

        The following message is displayed when you build the examples with the malformed beans.xml files. (This message is what was seen when the concurrency/jobs example was built.)

        [INFO] — cargo-maven2-plugin:1.4.2:redeploy (deploy) @ jobs —
        [INFO] [DeployerRedeployMojo] Resolved container artifact org.codehaus.cargo:car
        go-core-container-glassfish:jar:1.4.2 for container glassfish4x
        [INFO] [talledLocalContainer] Command deploy failed.
        [INFO] [talledLocalContainer] remote failure: Error occurred during deployment:
        Exception while loading the app : WELD-001202 Error parsing file:/C:/glassfish4/
        glassfish/domains/domain1/applications/jobs/WEB-INF/beans.xml. Please see server
        .log for more details.
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE

        The ErrorsInServerLog.txt attachment provides the more detailed WELD error from the server.log file.

        Show
        jendrock added a comment - The following message is displayed when you build the examples with the malformed beans.xml files. (This message is what was seen when the concurrency/jobs example was built.) [INFO] — cargo-maven2-plugin:1.4.2:redeploy (deploy) @ jobs — [INFO] [DeployerRedeployMojo] Resolved container artifact org.codehaus.cargo:car go-core-container-glassfish:jar:1.4.2 for container glassfish4x [INFO] [talledLocalContainer] Command deploy failed. [INFO] [talledLocalContainer] remote failure: Error occurred during deployment: Exception while loading the app : WELD-001202 Error parsing file:/C:/glassfish4/ glassfish/domains/domain1/applications/jobs/WEB-INF/beans.xml. Please see server .log for more details. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE The ErrorsInServerLog.txt attachment provides the more detailed WELD error from the server.log file.
        Hide
        Ian Evans added a comment -

        Fixed in 7.0.1-3 update.

        Show
        Ian Evans added a comment - Fixed in 7.0.1-3 update.
        Hide
        Kim Haase added a comment -

        The checkout-module example works if I use a CDI 1.0 beans.xml file (java.sun.com namespace) – it runs with no errors or warnings.

        Show
        Kim Haase added a comment - The checkout-module example works if I use a CDI 1.0 beans.xml file (java.sun.com namespace) – it runs with no errors or warnings.
        Hide
        Kim Haase added a comment -

        Same problem exists with simple-flow and checkout-module in 7.0.4 release of tutorial examples. They have a newline in the supposedly empty beans.xml file.

        Show
        Kim Haase added a comment - Same problem exists with simple-flow and checkout-module in 7.0.4 release of tutorial examples. They have a newline in the supposedly empty beans.xml file.
        Hide
        Kim Haase added a comment -

        There is no problem with the two jsonp examples at 7.0.4, because they don't have beans.xml files.

        Show
        Kim Haase added a comment - There is no problem with the two jsonp examples at 7.0.4, because they don't have beans.xml files.
        Hide
        Kim Haase added a comment -

        Fixed for GF 4.1.

        Show
        Kim Haase added a comment - Fixed for GF 4.1.

          People

          • Assignee:
            jendrock
            Reporter:
            jendrock
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: