[JBoss Seam] - Re: Remote EJBs
by gavin.king@jboss.com
1. At least in CVS it is conceptually possible to have a remote Seam component. (I forget whether a nonbuggy implementation made it into 1.0.1.)
However, this feature requires that the implementation class for the remote bean is in the client classpath, which is not usually the case. (I'm not quite sure what I can do about that one .... I suppose I can support @Name on remote interfaces...?)
Alternatively, you can just call the remote EJB using normal EJB3 mechanisms, inject it using @EJB.
2. You need a dedicated remote interface, annotated @Remote.
3. You need to implement your own exception handling layer for this. Either deal with the exception in client code, or in a servlet filter or web.xml. Unfortunately JSF (amazingly) does not provide any good place to handle these kinds of exceptions :-(
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961074#3961074
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961074
19 years, 9 months
[JBoss Seam] - org.hibernate.LazyInitializationException: Seam or Hibernate
by c_eric_ray
Not sure where to post this so it's on the hibernate forum as well. I'm new to ejb, seam and hibernate so please excuse my ignorance.
I have a simple query that retrieves an entity from the database. Within that object I call a method to get a collection of different entitys.
Like so...
| List<Object> l = entity.getCollection();
|
>From searching google and reading posts I understand that I have a session issue and could fix the problem by using and EAGER strategy. However, I cannot get the eager to work either. I get the same error regardless of what I do.
I'm running the lastest version of JBoss AS and Seam.
Here's the actual code.
|
| @DataModel
| private Set<RemittanceItemEntity> remitItems;
|
| remitItems = packages.getSelectedClosedPackage().getRemittanceItems();
|
| -----------------
|
| Here is the entity bean method with annotations
|
| @OneToMany(mappedBy="remittancePackage")
| public Set<RemittanceItemEntity> getRemittanceItems() {
| return remittanceItems;
| }
|
|
|
Here's the exception...although I'm sure you guys have seent this one before...
| Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.vicor.DistributedCapture.ejb.PackageEntity.remittanceItems, no session or session was closed
| at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
| at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
| at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
| at org.hibernate.collection.PersistentSet.size(PersistentSet.java:114)
| at java.util.ArrayList.<init>(ArrayList.java:133)
| at org.jboss.seam.jsf.SetDataModel.setWrappedData(SetDataModel.java:96)
| at org.jboss.seam.jsf.SetDataModel.<init>(SetDataModel.java:33)
| at org.jboss.seam.databinding.DataModelBinder.wrap(DataModelBinder.java:48)
| at org.jboss.seam.databinding.DataModelBinder.wrap(DataModelBinder.java:19)
| at org.jboss.seam.Component.outjectDataModelList(Component.java:980)
| at org.jboss.seam.Component.outjectDataModels(Component.java:937)
| at org.jboss.seam.Component.outject(Component.java:857)
| at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:41)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
| at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:82)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
| at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
| at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
| at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
| at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
| at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| ... 45 more
|
Thanks.
Eric Ray
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961070#3961070
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961070
19 years, 9 months
[JBoss Seam] - s:link does not work after JBoss restart
by chane
On a results screen I use the s:link tag in a table. The results screen is generated from a SFSB with ScopeType.EVENT. When the user clicks on the <s:link /> action, a new screen opens up from another SFSB with ScopeType.CONVERSATION.
This works great until JBoss is restarted. Once restarted, the view action (below) on an existing results screen returns the results.xhtml screen without any records and does not seem to call the SFSB editor.view that I expected.
Should this work? Or I'm trying to do something not allowed?
Link in results.xhtml
| <h:dataTable value="#{fulfillments}" var="fulfillment">
| <h:column>
| <f:facet name="header">Action</f:facet>
| <s:link value="View" action="#{editor.view}" propagation="none">
| <f:param name="id" value="#{fulfillment.orderID}"/>
| </s:link>
| </h:column>
| </h:datatable>
|
Finder.java
| @Name("finder")
| @Stateful
| @Scope(ScopeType.EVENT)
| @LoggedIn
| public class Finder implements IFinder {
|
| @DataModel
| private List<Fulfillment> fulfillments;
|
| @DataModelSelection
| private Fulfillment selected;
|
| private Fulfillment fulfillment = new Fulfillment();
|
| @Begin(flushMode=FlushModeType.MANUAL)
| public String find(){
| fulfillments = DAFulfillment.find(fulfillment);
| return "found";
| }
|
| @Destroy
| @Remove
| public void destroy(){
| }
|
| public Fulfillment getFulfillment(){
| return fulfillment;
| }
|
| public void setFulfillment(Fulfillment fulfillment){
| this.fulfillment = fulfillment;
| }
| }
|
Editor.java
| @Name("editor")
| @Stateful
| @LoggedIn
| public class Editor extends AbstractEditor implements IEditor{
|
| public Fulfillment fulfill;
|
| @RequestParameter
| protected Long id;
|
| @DataModel
| private List<Item> items;
|
| @DataModelSelection
| private Item item;
|
| @Create
| @Begin
| public void initialize(){
| fulfill = load(Fulfillment.class, id); //does loading in a superclass
| items = new ArrayList<Item>();
| items.addAll(fulfill.getItems());
| }
|
| public String save(){
| persist(fulfill);
| return super.save(); //super method returns "saved";
| }
|
| @End
| public String cancel(){
| em.refresh(fulfill);
| return "cancel";
| }
|
| @End
| public String return(){
| em.refresh(fulfill);
| return "return";
| }
|
| @Destroy
| @Remove
| public void destroy(){
| }
|
| public Fulfillment getFulfill(){
| return fulfill;
| }
|
| public void setFulfill(Fulfillment fulfill){
| this.fulfill = fulfill;
| }
| }
|
Thanks,
Chris....
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961068#3961068
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961068
19 years, 9 months