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 127291 - IllegalArgumentException: Type mm.DiscountCodeController cannot be found
Summary: IllegalArgumentException: Type mm.DiscountCodeController cannot be found
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSF (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P2 blocker (vote)
Assignee: Matthew Bohm
URL: http://statistics.netbeans.org/except...
Keywords:
: 127010 130863 130864 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-13 13:23 UTC by Jan Horvath
Modified: 2008-09-18 16:53 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 27042


Attachments
web application zip archive (30.40 KB, application/octet-stream)
2008-02-13 22:33 UTC, Kenneth Ganfield
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Horvath 2008-02-13 13:23:49 UTC
Build: NetBeans IDE Dev (Build 200802120006)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-121
OS: Mac OS X, 10.4.11, i386
User comments: exception when using jsf from entity classes wizard
STACKTRACE: (first 10 lines)
java.lang.IllegalArgumentException: Type mm.DiscountCodeController cannot be found
        at org.netbeans.modules.web.jsf.wizards.JSFClientGenerator$TreeMakerUtils.createType(JSFClientGenerator.java:2697)
        at org.netbeans.modules.web.jsf.wizards.JSFClientGenerator$TreeMakerUtils.createMethod(JSFClientGenerator.java:2633)
        at org.netbeans.modules.web.jsf.wizards.JSFClientGenerator$TreeMakerUtils.addMethod(JSFClientGenerator.java:2605)
        at org.netbeans.modules.web.jsf.wizards.JSFClientGenerator$14.run(JSFClientGenerator.java:1228)
        at org.netbeans.modules.web.jsf.wizards.JSFClientGenerator$14.run(JSFClientGenerator.java:841)
        at org.netbeans.api.java.source.JavaSource.runModificationTask(JavaSource.java:910)
        at org.netbeans.modules.web.jsf.wizards.JSFClientGenerator.generateControllerClass(JSFClientGenerator.java:840)
        at org.netbeans.modules.web.jsf.wizards.JSFClientGenerator.generateJSFPages(JSFClientGenerator.java:220)
        at org.netbeans.modules.web.jsf.wizards.PersistenceClientIterator.instantiate(PersistenceClientIterator.java:114)
        at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:595)
Comment 1 _ potingwu 2008-02-13 16:57:16 UTC
"JSF Pages from Entity Class" wizard issue.
Comment 2 Matthew Bohm 2008-02-13 17:45:20 UTC
Please provide steps and, if possible, the project.
Comment 3 Jan Horvath 2008-02-13 20:17:03 UTC
Just use a different package than entity classes. Ken can you attach your project?
Comment 4 Kenneth Ganfield 2008-02-13 22:31:17 UTC
steps

1. create JSF web project
2. create entity classes from db with wizard and put entity classes in package mm
3. create jsf from entity classes with wizard and enter pp as package name [default is mm]. Click finish.

Clicking finish brings up error dialog.
If you dismiss dialog, clicking Finish brings up another error dialog.
[in this case the IDE actually creates 2 more controllers, eg CustomerController_1.java]
The only thing to do is cancel the wizard.

Wizard creates 2 controllers in package pp even though I clicked Cancel. No converters or web pages are created.

Attaching project

Comment 5 Kenneth Ganfield 2008-02-13 22:33:48 UTC
Created attachment 56642 [details]
web application zip archive
Comment 6 Matthew Bohm 2008-02-13 23:04:11 UTC
*** Issue 127010 has been marked as a duplicate of this issue. ***
Comment 7 Exceptions Reporter 2008-02-25 20:23:59 UTC
This issue has already 5 duplicates 
Comment 8 dheffelfinger 2008-03-09 18:16:05 UTC
There seem to be several issues that are affecting the JSF CRUD wizard, and there seems to be some confusion regarding
the reported issues.

I posted a comment on the NetBean's user list, however I think it would be useful to explain the issues here, as well as
providing steps to reproduce them.

To reproduce the issue (some of the steps might not be relevant to the issue at hand, however I'm providing the exact
steps I followed):

Creating the project:
1. Create a new web application project, using GlassFish V2 as the server and Java EE 5 (I'm using the version of
GlassFish that is included with NB)
2. Not sure if it matters, but I clicked on the "Project Shared With Other Users" checkbox, and left all other fields
with their default values on this step of the new project wizard.
3. Select Java Server Faces as a framework for the project, other fields on this screen left intact.
4. Click Finish

Generating JPA Entities:
1. Right click on the project, select New->Entity Classes from database
2. Select the jdbc/sample data source (included "out of the box" with NetBeans
3. Click "Add All>>", followed by "Next>"
4. Enter "com.mycompany.entity" as the package
5. Click "Create Persistence Unit...", take all defaults and click "Create"
6. Click "Finish"

Up to this point everything is fine, now, on to create the JSF CRUD application:

1. Right click on the project, select "New->JSF Pages from Entity Class"
2. Click "Add All>>", followed by "Next"
3. Enter "jsf" as the value of "JSF Pages Folder"
4. Package defaults to the package used to create the JPA entities (com.mycompany.entity in this case). Change it to
"com.mycompany.managedbeans"
5. Click finish.

Issue number 1: JSF managed beans are placed in a single directory called "com.mycompany.managedbeans", they should be
placed in the following directory structure: "com/mycompany/managedbeans".

After manually creating the correct directory structure and moving the managed beans there, another issue become apparent:

Some of the generated managed beans (all are controllers) are missing imports:
CustomerController.java is missing import com.mycompany.entity.DiscountCode

ProductController.java is missing imports com.mycompany.entity.Manufacturer and com.mycompany.entity.ProductCode

PurchaseOrderController.java is missing imports com.mycompany.entity.Customer and com.mycompany.entity.Product


After moving the JSF managed beans to the correct folder, and adding the missing imports, the project can be built and
executed properly.

ps. I was going through the steps while typing, to make sure I didn't miss anything. In a previous attempt, I was using
com.ensode.managedbeans as the package for the generated JSF managed beans, in that case some (or all, I can't recall
exactly) of the generated managed beans had an incorrect package declaration, it was "com.ensode", where it should have
been "com.ensode.managedbeans", however, when using "com.mycompany.managedbeans" as the package I was unable to
reproduce this particular issue.

I hope that this comments helps the dev team reproduce the issues and come up with a solution.

David R. Heffelfinger
Comment 9 Dan Kolar 2008-03-19 17:46:29 UTC
This should be fixed soon, as scenario is just typical. So increasing priority.
Comment 10 Matthew Bohm 2008-03-20 05:32:38 UTC
Fixed.

C:\dev\nb\src\main>hg out
comparing with https://mbohm:***@hg.netbeans.org/main/
searching for changes
changeset:   74223:4c91693af0be
user:        mbohm@netbeans.org
date:        Wed Mar 19 21:27:46 2008 -0700
summary:     JSF CRUD: 127291 (IllegalArgumentException: Type mm.DiscountCodeCon
troller can), 129163 (JSF Pages from Entity Classes can't be successfuly runned)


changeset:   74437:b42a85497346
tag:         tip
parent:      74223:4c91693af0be
parent:      74436:b2ff9ef3dbe8
user:        mbohm@netbeans.org
date:        Wed Mar 19 21:30:52 2008 -0700
summary:     Automated merge with http://hg.netbeans.org/main/
Comment 11 dheffelfinger 2008-03-22 01:29:55 UTC
I just downloaded the latest nightly, netbeans-trunk-nightly-200803211205-linux.sh and verified that the JSF CRUD
functionality works as expected.

Thanks for taking care of this, I have been looking forward to both using this functionality and "showing it off" to
other developers
Comment 12 Matthew Bohm 2008-03-22 05:56:19 UTC
BTW, one way to show it off is using the database schema I have been using in my development effort, the consulting
agency database. See http://wiki.netbeans.org/JsfCrudGenerator.
Comment 13 Matthew Bohm 2008-03-24 04:51:32 UTC
*** Issue 130863 has been marked as a duplicate of this issue. ***
Comment 14 _ potingwu 2008-03-24 23:42:18 UTC
*** Issue 130864 has been marked as a duplicate of this issue. ***
Comment 15 josin 2008-09-18 16:53:31 UTC
Works fine. V.

Product Version: NetBeans IDE Dev (Build 200809180201)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb)