[JAVAEETUTORIAL-172] 4 examples in Java EE 7 SDK fail because zero-byte length beans.xml files are not zero bytes long Created: 05/Jun/13  Updated: 07/Aug/14  Resolved: 07/Aug/14

Status: Closed
Project: javaeetutorial
Component/s: examples
Affects Version/s: 7.0.1
Fix Version/s: 7.0.5

Type: Bug Priority: Major
Reporter: jendrock Assignee: jendrock
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Any


Attachments: Text File ErrorsInServerLog.txt    

 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.



 Comments   
Comment by jendrock [ 05/Jun/13 ]

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.

Comment by Ian Evans [ 05/Jun/13 ]

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.

Comment by jendrock [ 06/Jun/13 ]

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.

Comment by Ian Evans [ 24/Jun/13 ]

Fixed in 7.0.1-3 update.

Comment by Kim Haase [ 24/Jul/13 ]

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.

Comment by Kim Haase [ 25/Jun/14 ]

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.

Comment by Kim Haase [ 25/Jun/14 ]

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

Comment by Kim Haase [ 07/Aug/14 ]

Fixed for GF 4.1.

Generated at Sun Jul 05 04:33:12 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.