[EJB 3.0] - Configuring SFSB maximim size in EJB3
by normanb
Hi,
I created a jboss.xml config file for my SFSB and I really want to restrict the max pool size to something quite small, since potentially they are quite intensive, as a test I created as file as below, but it seems to be ignored and as per standardjboss.xml I can go up to 100!! Is there another way to configure size, or to read the jboss.xml?
| <jboss>
| <enterprise-beans>
| <session>
| <ejb-name>MySessionBean</ejb-name>
| <configuration-name>My Standard Stateful SessionBean</configuration-name>
| </session>
| </enterprise-beans>
| <container-configurations>
| <container-configuration extends="Standard Stateful SessionBean">
| <container-name>My Standard Stateful SessionBean</container-name>
| <!-- make changes to the standard configurations here, e.g. pooling etc. -->
| <container-pool-conf>
| <MaximumSize>3</MaximumSize>
| </container-pool-conf>
| </container-configuration>
| </container-configurations>
| </jboss>
|
Many thanks,
Norman
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032849#4032849
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032849
17Â years, 9Â months
[JBoss Seam] - Seam and Richfaces : Drag and Drop Problem
by davidetaibi
I use sem-gem to generate a new eclipse project (seam setup, seam new-project), then I added a new action testdnd to perform drag and drop operation.
This is the code
import java.util.ArrayList;
| import java.util.List;
|
| import javax.ejb.Stateless;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.log.Log;
| import org.jboss.seam.core.FacesMessages;
| import org.ajax4jsf.dnd.event.DropEvent;
|
| @Stateless
| @Name("testdnd")
| public class TestdndBean implements Testdnd {
|
| @Logger private Log log;
|
| @In FacesMessages facesMessages;
|
| public void testdnd()
| {
| //implement your business logic here
| log.info("testdnd.testdnd() action called");
| facesMessages.add("testdnd");
| }
|
| public void processDrop(DropEvent dropEvent) {
| System.out.println("PROCESSDROP CALLED");
| }
|
| public List getValori(){
| ArrayList al=new ArrayList();
| al.add("a");
| al.add("b");
| al.add("c");
| return al;
| }
| //add additional action methods
|
| }
here the local interface
| import java.util.List;
| import org.ajax4jsf.dnd.event.DropEvent;
| import javax.ejb.Local;
|
| @Local
| public interface Testdnd {
|
| //seam-gen method
| public void testdnd();
|
| public void processDrop(DropEvent dropEvent);
|
| public List getValori();
| }
and here the page that use the bean
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:a="https://ajax4jsf.dev.java.net/ajax"
| template="layout/template.xhtml">
|
| <ui:define name="body">
|
| <h:messages globalOnly="true" styleClass="message"/>
|
| <rich:dragIndicator id="indicator" />
| <h:form id="mapping">
| <div style="float: left; width: 60%;">
| <rich:panel id="feedColumns">
| <f:facet name="header">Your Columns</f:facet>
| <rich:dataTable value="#{testdnd.valori}" var="fm"
| styleClass="datatable" rowClasses="rowOdd,rowEven" style="width: 100%;">
| <h:column>
| <f:facet name="header">Your Column</f:facet>
| </h:column>
| <h:column>
| <f:facet name="header">Example Data(Drag me!)</f:facet>
| <a:outputPanel style="border:1px solid grey;padding:2px;"
| layout="block">
| <rich:dragSupport dragIndicator=":indicator" dragType="column"
| dragValue="#{fm}">
| <rich:dndParam name="label" value="#{fm}" />
| </rich:dragSupport>
| <span style="float: right"><strong>#{fm}</strong></span> <em>#{fm}</em>
| </a:outputPanel>
| </h:column>
| </rich:dataTable>
| </rich:panel>
| </div>
| <div>
| <rich:panel id="cdmFields">
| <f:facet name="header">
| <h:outputText value="CDM Fields" />
| </f:facet>
|
| <rich:dataGrid value="#{testdnd.valori}"
| var="fm" columns="2">
| <h:column>
| <a:outputPanel style="border:1px solid red;padding:2px;" layout="block">
| <rich:dropSupport acceptedTypes="column" dropValue="#{fm}"
| dropListener="#{testdnd.processDrop}" reRender="cdmFields,messages,mappedColumns,feedColumns">
| </rich:dropSupport>
| #{fm}
| </a:outputPanel>
| </h:column>
| </rich:dataGrid>
| </rich:panel>
| </div>
| </h:form>
|
| </ui:define>
|
| </ui:composition>
If I use the method processDrop without the DropEvent parameter all works well, but using the previous code I obtain this error :
| javax.servlet.ServletException: /testdnd.xhtml @63,104 dropListener="#{testdnd.processDrop}": Method not found: TestdndBean.processDrop(org.ajax4jsf.dnd.event.DropEvent)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| 17:46:50,968 ERROR [ExceptionFilter] exception root cause
| javax.faces.el.MethodNotFoundException: /testdnd.xhtml @63,104 dropListener="#{testdnd.processDrop}": Method not found: TestdndBean.processDrop(org.ajax4jsf.dnd.event.DropEvent)
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:71)
| at org.richfaces.component.UIDropSupport.broadcast(UIDropSupport.java:79)
| at org.ajax4jsf.ajax.repeat.UIDataAdaptor.broadcast(UIDataAdaptor.java:1056)
| at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
| at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:156)
| at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:62)
| at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
| at org.ajax4jsf.framework.ajax.AjaxViewRoot.processDecodes(AjaxViewRoot.java:267)
| at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(LifecycleImpl.java:219)
| at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| 17:46:51,078 ERROR [DebugPageHandler] redirecting to debug page
| javax.faces.el.MethodNotFoundException: /testdnd.xhtml @63,104 dropListener="#{testdnd.processDrop}": Method not found: TestdndBean.processDrop(org.ajax4jsf.dnd.event.DropEvent)
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:71)
| at org.richfaces.component.UIDropSupport.broadcast(UIDropSupport.java:79)
| at org.ajax4jsf.ajax.repeat.UIDataAdaptor.broadcast(UIDataAdaptor.java:1056)
| at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
| at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:156)
| at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:62)
| at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
| at org.ajax4jsf.framework.ajax.AjaxViewRoot.processDecodes(AjaxViewRoot.java:267)
| at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(LifecycleImpl.java:219)
| at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
Even if in this simple example the method processDrop don't use the DropEvent parameter I am interested to use it for some check operation.
I have used the latest version of seam from cvs (downloaded today).
Please help me!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032847#4032847
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032847
17Â years, 9Â months
[JBossWS] - Re: WS-Security: keystores and truststores
by jason.greeneï¼ jboss.com
Encryption operates very differently than signature processing. You can relate it to do ssl mutual auth, or pgp.
In order to use encryption you need 2 key pairs (public/private) for each party; in spirit of old school cryptography lets call them bob and alice. In order to send an encrypted message to Alice, Bob must have her public key. He encrypts the message to Alice, using her public key, which she can then decrypt using her private key. Likewise when she replies to the message she uses Bob's public key to encrypt the message, and he uses his private key to decrypt the message.
Now when sending these messages WS-Security needs to know which public key the message was encrypted with. To do this, one mechanism is to send the X509 token of the public cert in the message. However this causes another form of validation to occur. WS-Security requires that all tokens be validated. So therefore Bob and Alice need to trust their own public keys.
Here is the setup
bobs.keystore
---------------
bob - keyPair (public + private key)
alice - trustedCertEntry (just alice's public key)
bobs.truststore
----------------
bob - trustedCertEntry (just bob's public key)
alices.keystore
-----------------
alice - keyPair (public + private key)
bob - trustedCertEntry (just bob's public key)
alices.trustore
----------------
alice - trustedCertEntry (just alice's public key)
Note, this is just for encryption, to enable signing as well you need to also add a trust entry for the other party, since in signature processing it's the public key that is used for decryption.
Let me know if you have any other questions.
-Jason
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032846#4032846
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032846
17Â years, 9Â months
[JBoss Seam] - Bug in explicit conversation id management in SEAM 1.2.1 (ma
by raffaele.camanzo
This problem seems to affect both the current management of the explicit conversation id (@Begin(id=...)) and the future solution (with the declaration in the pages.xml).
Seam 1.2.1 seems to be unable to restore the current state of a conversation in this way:
I made three simple POJOs:
ActionOne.java:
| @Name("actionOne")
| @Scope(ScopeType.CONVERSATION)
| public class ActionOne {
|
| private List<String> starttimes;
| private int counter = 0;
|
| @Create
| public void createit() {
| starttimes = new ArrayList<String>();
| starttimes.add("Executing ActionOne @Create method");
| }
|
| // @Begin I don't know if this is needed or not, anyway, it does not work now both if it is
| // present or not
| public String startConversation() {
| Logger.getLogger(this.getClass()).info("<ACTIONONE> START CONVERSATION METHOD CALLED");
|
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: " + (Conversation.instance().isLongRunning() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> IS THERE A NESTED CONVERSATION: " + (Conversation.instance().isNested() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION ID IS: " + Conversation.instance().getId());
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: " + Conversation.instance().getViewId());
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: " + Conversation.instance().getDescription());
|
| return "one";
| }
|
| @End
| public String endConversation() {
| Logger.getLogger(this.getClass()).info("<ACTIONONE> END CONVERSATION METHOD CALLED");
| return "one";
| }
|
| /**
| * starttimes member Getter
| *
| * @return starttimes member
| */
| public List<String> getStarttimes() {
| return starttimes;
| }
|
| /**
| * starttimes member Setter
| *
| * @param starttimes New value for the starttimes member
| */
| public void setStarttimes(List<String> starttimes) {
| this.starttimes = starttimes;
| }
|
| public String doIt() {
| counter++;
| starttimes.add("ACTIONONE DOIT CALLED " + counter + " TIMES!");
|
|
| Logger.getLogger(this.getClass()).info("<DOIT> IS THERE A LONG RUNNING CONVERSATION: " + (Conversation.instance().isLongRunning() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<DOIT> IS THERE A NESTED CONVERSATION: " + (Conversation.instance().isNested() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION ID IS: " + Conversation.instance().getId());
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION VIEW ID IS: " + Conversation.instance().getViewId());
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION DESCRIPTION IS: " + Conversation.instance().getDescription());
|
| return "one";
| }
| }
|
ActionTwo.java:
| @Name("actionTwo")
| @Scope(ScopeType.CONVERSATION)
| public class ActionTwo {
|
| private List<String> starttimes;
| private int counter = 0;
|
|
| @Create
| public void createit() {
| starttimes = new ArrayList<String>();
| starttimes.add("<ACTIONTWO> Executing ActionTwo @Create method");
| }
|
| @Begin(id="myid2")
| public String startConversation() {
| Logger.getLogger(this.getClass()).info("<ACTIONTWO> START CONVERSATION METHOD CALLED");
|
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: " + (Conversation.instance().isLongRunning() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> IS THERE A NESTED CONVERSATION: " + (Conversation.instance().isNested() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION ID IS: " + Conversation.instance().getId());
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: " + Conversation.instance().getViewId());
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: " + Conversation.instance().getDescription());
|
| return "two";
| }
|
| @End @Remove @Destroy
| public String endConversation() {
| Logger.getLogger(this.getClass()).info("<ACTIONTWO> END CONVERSATION METHOD CALLED");
| return "two";
| }
|
| /**
| * starttimes member Getter
| *
| * @return starttimes member
| */
| public List<String> getStarttimes() {
| return starttimes;
| }
|
| /**
| * starttimes member Setter
| *
| * @param starttimes New value for the starttimes member
| */
| public void setStarttimes(List<String> starttimes) {
| this.starttimes = starttimes;
| }
|
| public String doIt() {
| counter++;
| starttimes.add("ACTIONTWO DOIT CALLED " + counter + " TIMES!");
|
| Logger.getLogger(this.getClass()).info("<DOIT> IS THERE A LONG RUNNING CONVERSATION: " + (Conversation.instance().isLongRunning() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<DOIT> IS THERE A NESTED CONVERSATION: " + (Conversation.instance().isNested() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION ID IS: " + Conversation.instance().getId());
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION VIEW ID IS: " + Conversation.instance().getViewId());
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION DESCRIPTION IS: " + Conversation.instance().getDescription());
|
| return "two";
| }
|
|
| }
|
ActionThree.java:
| @Name("actionThree")
| @Scope(ScopeType.CONVERSATION)
| public class ActionThree {
|
| private List<String> starttimes;
| private int counter = 0;
|
| @Begin
| public String startConversation() {
| Logger.getLogger(this.getClass()).info("<ACTIONTHREE> START CONVERSATION METHOD CALLED");
| starttimes = new ArrayList<String>();
| starttimes.add("Executing ActionThree @Begin method");
|
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> IS THERE A LONG RUNNING CONVERSATION: " + (Conversation.instance().isLongRunning() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> IS THERE A NESTED CONVERSATION: " + (Conversation.instance().isNested() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION ID IS: " + Conversation.instance().getId());
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION VIEW ID IS: " + Conversation.instance().getViewId());
| Logger.getLogger(this.getClass()).info("<START CONVERSATION> LONG RUNNING CONVERSATION DESCRIPTION IS: " + Conversation.instance().getDescription());
|
| return "three";
| }
|
| @End
| public String endConversation() {
| Logger.getLogger(this.getClass()).info("<ACTIONTHREE> END CONVERSATION METHOD CALLED");
| return "three";
| }
|
| /**
| * starttimes member Getter
| *
| * @return starttimes member
| */
| public List<String> getStarttimes() {
| return starttimes;
| }
|
| /**
| * starttimes member Setter
| *
| * @param starttimes New value for the starttimes member
| */
| public void setStarttimes(List<String> starttimes) {
| this.starttimes = starttimes;
| }
|
| public String doIt() {
| counter++;
| starttimes.add("ACTIONTHREE DOIT CALLED " + counter + " TIMES!");
|
| Logger.getLogger(this.getClass()).info("<DOIT> IS THERE A LONG RUNNING CONVERSATION: " + (Conversation.instance().isLongRunning() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<DOIT> IS THERE A NESTED CONVERSATION: " + (Conversation.instance().isNested() ? "YES" : "NO"));
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION ID IS: " + Conversation.instance().getId());
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION VIEW ID IS: " + Conversation.instance().getViewId());
| Logger.getLogger(this.getClass()).info("<DOIT> LONG RUNNING CONVERSATION DESCRIPTION IS: " + Conversation.instance().getDescription());
|
| return "three";
| }
|
|
| }
|
I configured the pages.xml in order to support the next explicit conversation id feature:
pages.xml
| <!DOCTYPE pages PUBLIC
| "-//JBoss/Seam Pages Configuration DTD 1.1//EN"
| "http://jboss.com/products/seam/pages-1.2.dtd">
|
| <pages>
| <conversation name="convOne" parameter-name="aname" parameter-value="#{sessionHandler.seqOne}" />
|
| <page view-id="/actionone.xhtml" conversation="convOne">
| </page>
|
| </pages>
|
the seqOne method simply returns a string with an incremental value postfix.
and added three links to call them all:
| <div id="control">
| <h:form>
| <table>
| <tr>
| <td>
| <h:outputText value="Press the button to call the @Begin action of the actionOne conversation" />
| </td>
| </tr>
| <tr>
| <td>
| <h:commandLink action="#{actionOne.startConversation}" value="Start Conversation with pages conversation definition">
| <s:conversationPropagation type="none" />
| </h:commandLink>
| </td>
| </tr>
| </table>
| </h:form>
| <h:form>
| <table>
| <tr>
| <td>
| <h:outputText value="Press the button to call the @Begin action of the actionTwo conversation" />
| </td>
| </tr>
| <tr>
| <td>
| <h:commandLink action="#{actionTwo.startConversation}" value="Start Conversation with static @Begin(id='myId2')">
| <s:conversationPropagation type="none" />
| </h:commandLink>
| </td>
| </tr>
| </table>
| </h:form>
| <h:form>
| <table>
| <tr>
| <td>
| <h:outputText value="Press the button to call the @Begin action of the actionThree conversation" />
| </td>
| </tr>
| <tr>
| <td>
| <h:commandLink action="#{actionThree.startConversation}" value="Start Conversation with generated id">
| <s:conversationPropagation type="none" />
| </h:commandLink>
| </td>
| </tr>
| </table>
| </h:form>
| </div>
|
disabling conversation propagation in order to avoid to ask for the LRC switch.
the three xhtml pages related to the components are almost identical and trivial:
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:c="http://java.sun.com/jstl/core"
| template="main.xhtml">
|
| <!-- context manager -->
| <ui:define name="actioncontent">
| <h:dataTable value="#{actionThree.starttimes}" var="iter">
| <h:column>
| <h:outputText value="#{iter}" />
| </h:column>
| </h:dataTable>
|
| <h:form>
| <s:link action="#{actionThree.doIt}">
| <h:outputText value="Press me I should run into #{conversation.id} conversation" />
| </s:link>
| </h:form>
| </ui:define>
|
| </ui:composition>
|
Basically what I expect to obtain is this:
Clicking on one of the three links I start a conversation, then, clicking on the doIt link see the list of strings to grow; unfortunately this is true only in the third case (when the id is generated by Seam), both in the first and in the second Seam seems to not bind the component to the conversation, indeed, running test on the component instance two, when I click on the doIt link, I read in the log this print:
| DEBUG [org.jboss.seam.core.Manager] Found conversation id in request parameter: myid2
| DEBUG [org.jboss.seam.core.Manager] Restoring conversation with id: myid2
| DEBUG [org.jboss.seam.jsf.AbstractSeamPhaseListener] After restoring conversation context: ConversationContext(myid2)
|
but the list does not grow, moreover if I create the list of strings in the @Begin method (as I do in the third example) the doIt method fails with a NullPointerException because the list is not present.
That's it. Is this a bug?
Two questions on conversation management:
- Can I expect that if I click say on the second link (the static id.. not correct but to understand) Seam will understand that I'm asking for that conversation and resumes it?
- Is it legal to use the Redirect API knowing the conversation id (regardless generated or explicit) in order to redirect to that conversation?
Both the questions without a LRC in place (s:conversationPropagation type="none")
Regards,
Raffaele Camanzo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032845#4032845
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032845
17Â years, 9Â months
[JBoss Seam] - @Unwrap onto SFSB
by tom_goring
Hi All,
I have 2 'manager component' style beans. One called the 'Accountant' and the other 'User'. The idea is that in the session I store the id of these things and in my managers I get the real objects. Both are ScopeType.CONVERSATION. Both also use SLSB's to make the call to get the data.
The idea is that I want it to be transparent to the application code that these objects are infact reread if they have not been cached in any current conversation.
The User manager is itself a SFSB while the Accountant is a POJO (I'm trying to see the results of both methods).
Now in another SFSB (my action handler) I get some odd results using the above...
My first question is:
1) If I Inject @In(value="User", required=true) I works first time the page is displayed, but second time get get a transaction not open exception. If I change this to @In(value="User", create=true) it works ?
2) If I Inject @In(value='Accountant', create=true) I get a
6:23:48,343 WARN [Contexts] Could not destroy component: accountantCRUDBean
| javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: 5c4o05-8pkcob-ezvcgh2q-1-ezvcx10a-2t
| but apart from that it works ?
Here is my code:
| @Stateful
| @Name(UserComponentNames.User)
| @Scope(ScopeType.CONVERSATION)
| public class UserComponentManagerBean implements UserComponentManager {
|
| @In(value=UserComponentNames.UserId,required=false)
| private Long userId = null;
|
| @EJB
| private UserManagerLocal userManager;
|
| @Logger private Log log;
|
| private User cachedUser=null;
|
| @Create
| public void create() {
| log.info("create");
| }
|
| @Unwrap
| public User getUserComponent() {
| if ( cachedUser!=null ) {
| return cachedUser;
| }
| if ( userId!=null ) {
| cachedUser = userManager.getUser(userId);
| return cachedUser;
| }
| return null;
| }
|
| @Destroy @Remove
| public void destroy() {
| log.info("destroy");
| }
| }
|
| @Name(AccountantComponentNames.Accountant)
| @Scope(ScopeType.CONVERSATION)
| public class AccountantComponentManager {
|
| @In(value=AccountantComponentNames.AccountantId,required=false)
| private Long accountantId = null;
|
| @In(create=true)
| private CompanyManagerLocal companyManagerLocal;
|
| private Accountant cachedAccountant=null;
|
| @Unwrap
| public Accountant getAccountantComponent() {
| if ( cachedAccountant!=null ) {
| return cachedAccountant;
| }
| if ( accountantId!=null ) {
| cachedAccountant = companyManagerLocal.getAccountant(accountantId);
| return cachedAccountant;
| }
| return null;
| }
| }
|
| @Stateful
| @Scope(ScopeType.CONVERSATION)
| @Name("accountantCRUDBean")
| public class AccountantCRUDBean extends StandardCRUDBean<Accountant> implements AccountantCRUD, Serializable {
| private static final long serialVersionUID = 1L;
|
| @In(value=AccountantComponentNames.Accountant, create=true)
| private Accountant userLinkedAccountant=null;
|
| @In(value=UserComponentNames.User, create=true)
| private User user;
|
| @EJB
| private CompanyManagerLocal companyManager=null;
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032840#4032840
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032840
17Â years, 9Â months