This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 229577

Summary: Some Java EE 7 sample apps do not work
Product: javaee Reporter: Kenneth Ganfield <kganfield>
Component: SamplesAssignee: Martin Janicek <mjanicek>
Status: VERIFIED FIXED    
Severity: normal CC: jskrivanek, marfous, mmirilovic, pjiricka
Priority: P1    
Version: 7.3.1   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 229720, 229722    
Bug Blocks:    
Attachments: Patch fixing Lean Service ECB sample application

Description Kenneth Ganfield 2013-05-10 12:36:40 UTC
It appears that some of the other Java EE 7 sample apps available in the New Project wizard also do not work out of the box.

Eg, when I try to run the JSON-P JAX-RS Resource sample app I get a 404 not found page in the browser.
Comment 1 Martin Janicek 2013-05-13 07:46:18 UTC
I can take a look at it, but this doesn't sound like a problem with sample integration but samples itself [1].. IMHO we should rather fill an issue to the Glassfish team instead of NetBeans.

[1] https://svn.java.net/svn/glassfish-samples~svn/trunk/ws/javaee7/
Comment 2 Jiri Skrivanek 2013-05-14 14:02:48 UTC
The following examples don't work for me

Bean Validation CDI
JAX-RS JSONP
JobOperator API Batch
JSPExamples
Lean Service ECB Component with Ajax
MailConnector Resource Adapter
Partition Application
Payroll Batch
Servlet Examples
TransactionScoped Annotation CDI

Product Version: NetBeans IDE 7.3.1 (Build 201305122200)
Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 3 Martin Janicek 2013-05-15 09:46:11 UTC
Bean Validation CDI opens incorrect URL:

Actual: http://localhost:8080/BeanValidation
Expected: http://localhost:8080/BeanValidation/ValidationServlet
Comment 4 Martin Janicek 2013-05-15 10:13:50 UTC
To be honest I don't know how to deal with these problems. I can fix this issue by changing the sample code (ValidationServlet needs to use urlPatterns = {"/"} instead of current urlPatterns = {"/ValidationServlet"} to open correct URL).

But if I will be fixing samples this way then the both code (original from the Glassfish repository and ours) won't be synchronized. Not sure if it's a problem or not, Petre?

Other possibility is to file an issue against Glassfish team, but in that case we have to wait for their fix, merge the updated sources into our repository (which isn't trivial because I have been doing quite a few changes in pom configuration) and all this will take much more time (which I don't really think we have with respect to the release date)
Comment 5 Martin Janicek 2013-05-15 10:30:49 UTC
Same problem with JAX-RS JSONP sample. From the sample documentation (docs/index.html there are five different showcases each on a different URL).. I have no idea why they can't provide welcome page with links to those URLs. Again I can either create it by myself or we need to request GF team for similar change.

I'll continue with evaluation, but would be good to have decision about how do we want to fix it.
Comment 6 Petr Jiricka 2013-05-15 11:02:03 UTC
> To be honest I don't know how to deal with these problems.

I would say: 
- Fix it on our side if possible and if the fix is straightforward. (If not, then just remove the sample)
- File the bugs against GlassFish (I guess one bug per one class of problems, and the bug may refer to multiple samples)
- When they fix the bug on their side, do nothing and don't try to merge the fix to our source code; let's just leave it as it is

What do you think? 
Thanks many times for looking into this.
Comment 7 Martin Janicek 2013-05-15 11:38:53 UTC
Agree, sounds reasonable. Thanks
Comment 8 Martin Janicek 2013-05-15 14:17:42 UTC
Bean Validation CDI:
- Fixed in web-main #ce4a48914542

JAX-RS JSONP:
- described in comment 5, I need to spend more time on this one

JobOperator API Batch:
- Fixed in web-main #52acd4d55edb

JSPExamples:
- Will be removed, it's J2EE 1.4 sample anyway

Lean Service ECB Component with Ajax:
- This sample works for me just fine (it wasn't changed for quite some time), there is just an error in the Test class (maybe some problem with JUnit), but it still can be deployed and run

MailConnector Resource Adapter:
- Not sure yet, it might be caused by a problem with Maven integration, need to investigate it further

Partition Application:
- Will be removed, it's missing servlet (!!!) which is referred from web.xml

Payroll Batch:
- Fixed in web-main #77a4fe11b0c4

Servlet Examples:
- Will be removed, it's J2EE 1.4 sample anyway

TransactionScoped Annotation CDI:
- Fixed web-main #aeace99ac815
Comment 9 Quality Engineering 2013-05-16 02:29:10 UTC
Integrated into 'main-golden', will be available in build *201305152300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/52acd4d55edb
User: Martin Janicek <mjanicek@netbeans.org>
Log: #229577 - Some Java EE 7 sample apps do not work - JobOperator API Batch
Comment 10 Martin Janicek 2013-05-16 13:31:35 UTC
JSPExamples:
- Old J2EE 1.4 sample
- Removed in web-main #a616d4360655

Lean Service ECB Component with Ajax:
- I have to discuss this with someone from Jersey team first (the problem is that our Jersey 1.13 which is bundled with NetBeans isn't compatible with Jersey 2.0.3 that is part of the GF4). Thus this sample will either work with GF3 or with GF4, but will not work in both.

MailConnector Resource Adapter:
- It looks that we are missing support for Maven Resource Adapter Archive (rar packaging) in EAR projects --> This will need bigger changes in maven.j2ee module, don't think we should do it for 7.3.1
- Disabled in web-main #d8a50aa9a76e

Partition Application:
- Removed in web-main #848f25a43775

Servlet Examples:
- Old J2EE 1.4 sample
- Removed in web-main #a616d4360655

..JAX-RS JSONP and Lean Service ECB Component with Ajax are still missing, the rest should be either fixed or disabled.


BTW: Because all J2EE 1.4 samples were disabled and web.examples module is not needed anymore, I'm going to delete the whole module for NB 7.4 (created as issue 229847)
Comment 11 Quality Engineering 2013-05-18 02:56:40 UTC
Integrated into 'main-golden', will be available in build *201305172300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/848f25a43775
User: Martin Janicek <mjanicek@netbeans.org>
Log: #229577 - Some Java EE 7 sample apps do not work - Removing Partition Application example
Comment 12 Martin Janicek 2013-05-20 14:59:00 UTC
Created attachment 134647 [details]
Patch fixing Lean Service ECB sample application

With respect to the 7.3.1 release date and after discussion with Marian I'm disabling also JAX-RS JSONP sample (web-main #78019f8f096e)

The last problematic sample is Lean Service ECB Component with Ajax. It can be fixed for GF4 (attaching the patch) but in that case it won't work with GF3. The patch is rewriting the sample code to use GF4/Jersey 2.0 but because the Jersey has a lot of incompatible changes between version 1.x and 2.x the same problem will occur with old version of GF after the fix. 

Do we really want to do this? The sample does not demonstrate anything from Java EE 7, but it will be available on Java EE 7 compliant server only.. not sure if such change makes much sense.
Comment 13 Martin Janicek 2013-05-21 08:12:44 UTC
Ok, I'm suggesting to close this issue as FIXED and continue with HR integration for these two sets of changesets:

1)
Bean validation CDI: ce4a48914542
JobOperator API Batch: 52acd4d55edb
Payroll Batch: 77a4fe11b0c4
TransactionScoped Annotation CDI: aeace99ac815

2)
JSPExamples + Servlet Examples: a616d4360655
MailConnector Resource Adapter: d8a50aa9a76e
Partition Application: 848f25a43775
JAX-RS JSONP: 78019f8f096e, a9675ce79988


First set of changesets contains sample fixes, the second one is just disabling some samples for various reasons (see comments 8, 10, 12 for more details). 

One exception is mentioned LeanServiceECB sample which is still in the code base but does not work with GF4. The fix isn't much straightforward (sample code was rewritten by Jakub Podlesak, so think it is correct but still it's not a simple fix).. if I should choose it seems to me safer to just let it in the current state (running only on GF3).. maybe we could improve sample description with note about it.
So there are basically three options:

1) Let the sample as it is (running on GF3, not running on GF4) + update description saying it is for GF 3 only
2) Update sample code with attached patch (running on GF4, not running on GF3)
3) Disable sample completely and wait for fix of the issue 229898 first

After off-line discussion with PetrJ we are voting for case number one. Jirko, Mariane, could you share your opinion?
Comment 14 Jiri Skrivanek 2013-05-21 09:23:20 UTC
I agree to only update description of LeanServiceECB sample. Otherwise I verified in trunk that all samples mentioned in comment 2 are resolved (removed or fixed).
Comment 15 Martin Janicek 2013-05-21 12:08:14 UTC
Lean Service ECB sample description updated in: web-main #59058e2226bf
--> Closing the issue as FIXED
Comment 16 Martin Janicek 2013-05-21 12:32:49 UTC
CCing to MartinF, may I ask you for the code review one more time ?
These change-sets are the important ones (don't be scared, they are short :))

Fixing change-sets:
web-main #ce4a48914542
web-main #52acd4d55edb
web-main #77a4fe11b0c4
web-main #aeace99ac815

Disabling change-sets:
web-main #a616d4360655 + web-main #0f2456471115 (second revision is fixing empty-layer check test)
web-main #d8a50aa9a76e
web-main #848f25a43775
web-main #78019f8f096e + web-main #a9675ce79988 (first changeset was done by accident, I would rather change this manually in one revision instead of using graft/transplant)
Comment 17 Martin Fousek 2013-05-21 13:52:02 UTC
(In reply to comment #16)
> CCing to MartinF, may I ask you for the code review one more time ?

No problem as many times as will be necessary. ;)

All resulting changes from changesets you placed in comment #16 seem to be fine and safe.
Comment 18 Martin Janicek 2013-05-21 16:04:45 UTC
Thanks, I'm going to transplant the changeset tommorow morning.
Comment 19 Quality Engineering 2013-05-22 02:37:58 UTC
Integrated into 'main-golden', will be available in build *201305212300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/59058e2226bf
User: Martin Janicek <mjanicek@netbeans.org>
Log: #229577 - Updating Lean Service ECB sample description
Comment 20 Martin Janicek 2013-05-22 11:42:10 UTC
Transplanted as:

releases #6ef156985ffd
releases #533cb1172833
releases #823257a428ba
releases #419490fb4ac4

releases #f758b4bc20eb
releases #7e6e45bcb193
releases #4ee3870f15aa
releases #17a7e3119df3
releases #ab5cac3a34c1
Comment 21 Quality Engineering 2013-05-23 00:18:23 UTC
Integrated into 'releases', will be available in build *201305222200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/533cb1172833
User: Martin Janicek <mjanicek@netbeans.org>
Log: #229577 - Some Java EE 7 sample apps do not work - JobOperator API Batch
Comment 22 Jiri Skrivanek 2013-05-23 09:17:50 UTC
Patch 59058e2226bf is not in release73 and for Payroll Batch submitted new bug 230157.
Comment 23 Martin Janicek 2013-05-25 15:21:32 UTC
(In reply to comment #22)
> Patch 59058e2226bf is not in release73

releases #4878de271879

> Payroll Batch submitted new bug 230157.

Weird, there were no changes in the sample code (only the javaee dependency was updated, but that shouldn't result in such failure).. I'll take a look
Comment 24 Quality Engineering 2013-05-26 00:13:10 UTC
Integrated into 'releases', will be available in build *201305252200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/4878de271879
User: Martin Janicek <mjanicek@netbeans.org>
Log: #229577 - Updating Lean Service ECB sample description