[JBoss Seam] - Re: Problem outjecting a field
by taprogge
Well, I found the answer, but that raises even further questions...
It turned out, I had different names for my Charge entity and the fields in my session beans. So the field was not correctly outjected and thus overwritten with null when being injected again on the next method call.
After naming the field like the Entity's @Name annotation, everything works fine.
But I am wondering... how then does one go about having two different instances of one Seam component outjected in the same page?
Imagine you have two car entities in a cataloge and want to present them side-by-side on a single page. The corresponding session bean would have to have two variables car1 and car2 that store the entities. How can you get them both outjected if the field must be named like the entity?
Any insights would be very much appreciated.
Regards,
Phil
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972895#3972895
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972895
19 years, 7 months
[JBoss Messaging] - Re: Remote JMS server
by mskonda
I have scoped an MDB with four jars mentioned in the doc and deployed. It complains about ClassNotFoundException on JBossConnectionFactory.
| Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.jms.client.JBossConnectionFactory (no security manager: RMI class loader disabled)
|
The scoped MDB has already has the access to jboss-messaging.jar file in which the JBossConnectionFactory file is present. This concludes me that scoping might have problmes working on JBoss-4.0.3SP1.
I included the jboss-messaging.jar in the lib directory to check whether the class files are picked up. The above CNFE is gone, however, you get another CNFE on JoinPointInfo class:
| java.lang.NoClassDefFoundError: org/jboss/aop/JoinPointInfo
|
This class is part of jboss-aop.jar but again, inspite of being scoped in the ear, it was not found.
So, I think, scoping of ear has issues in SP1
Thanks
Madhu
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972893#3972893
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972893
19 years, 7 months
[JBoss Seam] - Re: PAGE scope DataModel's selection not correct
by Holy Joe
I made a cheap hack in outjectDataModelList() in Component.java that made things work as I expected (for a page-scoped DataModel in a session-scoped bean). I changed this:
| context.set( name, wrapper.wrap(dataModelAnn, list));
|
to this:
| if(existingDataModel != null) {
| ((javax.faces.model.DataModel) existingDataModel).setWrappedData(list);
| } else {
| context.set( name, wrapper.wrap(dataModelAnn, list));
| }
|
I don't understand the bigger picture well enough to know if that is going to hurt me in other ways, though. Will reusing the wrapper cause problems with non-PAGE-scoped DataModels, or perhaps there are other uses of DataModels that will break? Is it always safe to cast to javax.faces.model.DataModel?
Of course, any advice on how to implement my app without using a page-scoped datamodel in a session-scoped bean is welcome, too.
Thanks,
Joe
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972892#3972892
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972892
19 years, 7 months
[JBoss Seam] - Problem outjecting a field
by taprogge
Hi!
I have a problem here which I have been unable to solve...
I have here two statufel Seam session beans. One uses the DataModel and DataModelSelection mechanism to fetch some data rows. The other is used to edit an item from that list.
What I have done is this: I added a getter for the DataModelSelection field to the ListAction bean and a method to the EditAction bean that gets the field from the list action and stores it in it's own variable which is marked for outjection:
| @Stateful
| @Scope(SESSION)
| @Name("listAction")
| public class ListActionBean implements ListAction {
|
| @DataModel
| private List<Charge> chargeList;
|
| @DataModelSelection
| private Charge chargeItem;
|
| @PersistenceContext
| private EntityManager em;
|
| @Factory
| public void getChargeList() {
|
| chargeList = (List<Charge>) em.createQuery("FROM Charge c")
| .getResultList();
| }
|
| public String refreshList() {
| getChargeList();
| return Outcome.REDISPLAY;
| }
|
| public Charge getChargeItem() {
| return chargeItem;
| }
|
| @Remove
| @Destroy
| public void destroy() {
| // nothing to clean up here
| }
| }
|
| @Stateful
| @Conversational(ifNotBegunOutcome = "notbegun")
| @Name("managementAction")
| public class ManagementActionBean implements ManagementAction {
|
| @PersistenceContext
| private EntityManager em;
|
| @In(required = false)
| @Out
| private Charge chargeItem;
|
| @In
| private ChargeListAction chargeListAction;
|
| @In(create = true)
| private Conversation conversation;
|
| @Begin
| public String editCharge() {
| chargeItem = em.merge(chargeListAction.getChargeItem());
| return "chargemanagement.detail";
| }
|
| @End
| public String back() {
| return "chargemanagement.tolist";
| }
|
| @Remove
| @Destroy
| public void destroy() {
| }
| }
|
Now the problem is that chargeItem is not correctly outjected in the ManagementAction Bean. By writing to stout, I have verified that in ManagementAction#editCharge() the variable is correctly initialized with the selected charge from the ListAction.
But neither will a jsp display values from that charge nor will ManagementAction#back() work, complaining thusly:
| Out attribute requires value for component: chargeManagementAction.chargeItem
|
What the heck am I missing here?
Thanks a lot,
Phil
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972890#3972890
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972890
19 years, 7 months