Enterprise web programming

Modules ENTWA (Level 6) and APSW (Level 7)

Solving CDI-API problems

Some users have reported that Java EE projects would not compile and run on their machines. This included both people with their own laptops and people using the lab computers. I have now got to the bottom of the problem, which is related to Glassfish version 4.1. (I discovered that I was still running 4.0 on my laptop, and that does not have the problem. When I upgraded to 4.1, I began to have the problem.)

The solution is to add an additional jar file to the project. (This applies to any Java EE web project that uses managed beans, so you may have to do it for all your other projects too.) The file you need to add is actually included in Glassfish 4.1 but does not seem to be activated properly. In my installation I found it at C:\Program Files\glassfish-4.1\glassfish\modules\cdi-api.jar. Alternatively you can download it from http://search.maven.org/remotecontent?filepath=javax/enterprise/cdi-api/1.2/cdi-api-1.2.jar

To add the file to your project, right click the Libraries tree of your project and select "Add JAR/Folder...". Select the file. I recommend you select "Copy to libraries folder" on the right side of the dialog box, though it will work whichever option you choose.

 

Last updated by Prof Jim Briggs of the School of Computing at the University of Portsmouth

 
The enterprise web programming modules include some material that was formerly part of the WEB1P and WEB2P units.