NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
David Bender Posted via mailing list.
|
Posted: Wed Aug 19, 2009 7:01 pm Post subject: JSF naming conflict with Entity "Resource" |
|
|
I've hit a snag building my first significant JSF application in Glassfish
(v2 in Netbeans 6.1). An entity in the database for which this application
is being built is named 'resource' and this seems to be confusing JSF or the
JPA EntityManager.
I came across the naming conflict after running the "Entity class from
database" and "JSF from Entity Class" wizards. (Those are handy wizards, by
the way! Thanks to whoever built them.)
In my application, a class named my.package.Resource conflicts with
javax.annotation.Resource
In my Java code, I was able to give my Resource class references fully
qualified names and that seemed to resolve conflicts with the @Resource
annotation, at least for the compiler. But when this runs in Glassfish, I
get this error when I try to call up a page to edit any of my Resources:
exception
javax.servlet.ServletException: #{resource.editSetup}:
java.lang.IllegalArgumentException: Unknown entity bean class: interface
javax.annotation.Resource, please verify that this class has been marked
with the @Entity annotation.
root cause
javax.faces.FacesException: #{resource.editSetup}:
java.lang.IllegalArgumentException: Unknown entity bean class: interface
javax.annotation.Resource, please verify that this class has been marked
with the @Entity annotation.
root cause
javax.faces.el.EvaluationException: java.lang.IllegalArgumentException:
Unknown entity bean class: interface javax.annotation.Resource, please
verify that this class has been marked with the @Entity annotation.
root cause
java.lang.IllegalArgumentException: Unknown entity bean class: interface
javax.annotation.Resource, please verify that this class has been marked
with the @Entity annotation.
My Resource class is marked with the @Resource annotation. And I've tried
using a fully qualified name for the annotation --
@javax.annotation.Resource -- which compiles but doesn't make the
FacesException go away.
I've looked through faces-config.xml and anywhere else I can look but I'm
stumped. I see that JSF or JPA or SOT (Some Other Thing) is confusing my
Resource with the Resource annotation, but where is that happening and how
to I correct it?
Any help would be appreciated.
Dave |
|
| Back to top |
|
 |
David Bender Posted via mailing list.
|
Posted: Mon Aug 24, 2009 4:07 pm Post subject: JSF naming conflict with Entity "Resource" |
|
|
I solved this.
The solution was to specify the fully qualified class name in the first
parameter of the EntityManager.find(Class, Object) method. So:
em.find(package.name.Resource.class, id);
not, the default
em.find(Resource.class, id);
Maybe the wizard can be adjusted to fully qualify class names if they could
create a naming issue.
Dave (talking to himself, again)
-----Original Message-----
From: nbusers-return-142430-dbender=address-removed
[mailto:nbusers-return-142430-dbender=address-removed] On Behalf Of
David Bender
Sent: Wednesday, August 19, 2009 2:02 PM
To: address-removed
Subject: [nbusers] JSF naming conflict with Entity "Resource"
I've hit a snag building my first significant JSF application in Glassfish
(v2 in Netbeans 6.1). An entity in the database for which this application
is being built is named 'resource' and this seems to be confusing JSF or the
JPA EntityManager.
I came across the naming conflict after running the "Entity class from
database" and "JSF from Entity Class" wizards. (Those are handy wizards, by
the way! Thanks to whoever built them.)
In my application, a class named my.package.Resource conflicts with
javax.annotation.Resource
In my Java code, I was able to give my Resource class references fully
qualified names and that seemed to resolve conflicts with the @Resource
annotation, at least for the compiler. But when this runs in Glassfish, I
get this error when I try to call up a page to edit any of my Resources:
exception
javax.servlet.ServletException: #{resource.editSetup}:
java.lang.IllegalArgumentException: Unknown entity bean class: interface
javax.annotation.Resource, please verify that this class has been marked
with the @Entity annotation.
root cause
javax.faces.FacesException: #{resource.editSetup}:
java.lang.IllegalArgumentException: Unknown entity bean class: interface
javax.annotation.Resource, please verify that this class has been marked
with the @Entity annotation.
root cause
javax.faces.el.EvaluationException: java.lang.IllegalArgumentException:
Unknown entity bean class: interface javax.annotation.Resource, please
verify that this class has been marked with the @Entity annotation.
root cause
java.lang.IllegalArgumentException: Unknown entity bean class: interface
javax.annotation.Resource, please verify that this class has been marked
with the @Entity annotation.
My Resource class is marked with the @Resource annotation. And I've tried
using a fully qualified name for the annotation --
@javax.annotation.Resource -- which compiles but doesn't make the
FacesException go away.
I've looked through faces-config.xml and anywhere else I can look but I'm
stumped. I see that JSF or JPA or SOT (Some Other Thing) is confusing my
Resource with the Resource annotation, but where is that happening and how
to I correct it?
Any help would be appreciated.
Dave |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|