[JBoss Seam] - Strange behaviour of Seam Mail when sending unsynchonized as
by MSchmidke
Hello,
as you can see, I am digging deeper into the Seam Mail thing.
By now, I have a POJO Seam component, event scoped, with an @Asynchronous method send(), which sends a mail (by calling renderer.render).
>From the application, this method is called twice one immediately after the other.
This results in some strange behaviour (and no mails being sent).
It seems I solved this by adding "@Synchronized" to the component (since it is a timing issue, I can never be really sure ...)
But I have a question:
Obviously when called two times simultaneously, the one renderer interferes with the other. In my mail class I could solve this by synchronizing it, but what about the front page renderer? If accidentally in the same moment a mail is rendered also a page is rendered?
Will I have some very random-caused irreproducible strange problems in the future?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118700#4118700
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118700
18 years, 3 months
[JBoss Seam] - Re: Wildcard for pages action
by mmichalek
Thanks. JIRA opened: http://jira.jboss.org/jira/browse/JBSEAM-2481
Two other quick things on this:
1) One thing that surprised me when I first used Seam navigation was that you cannot define navigation cases based on the outcome of an action. I know that rules can operate on outcomes, but I like to define navigation cases based on a known action and then have rules which inspect the state within that case. (Otherwise I get strange behavior where a user can back up and click through a wizard using any links because the state to satisfy the rules in still in the conversation).
Here's a code snippet that demonstrates what I mean (in Pages.navigate). Does something like this make sense in general for Seam?
| Navigation navigation = page.getNavigations().get(actionExpression);
| if (navigation==null)
| {
| // New Code here:
| if (actionOutcomeValue != null) {
| navigation = page.getNavigations().get(actionOutcomeValue);
| }
|
2) For anyone interested in doing something like this, you can always provide a custom "org.jboss.seam.navigation.pages" component. For example, I have:
| @Scope(ScopeType.APPLICATION)
| @BypassInterceptors
| @Name("org.jboss.seam.navigation.pages")
| @Install(precedence=APPLICATION, classDependencies="javax.faces.context.FacesContext")
| public class Pages extends org.jboss.seam.navigation.Pages {
|
| @Override
| public boolean navigate(FacesContext context, String actionExpression, String actionOutcomeValue) {...}
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118699#4118699
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118699
18 years, 3 months
[JBoss Portal] - PortletBridge: Facelets not working
by ebephil
Hi,
I thought I'd give the new RichFaces JSR-301 PortletBridge a try to finally have proper support for RichFaces components in my portlets, but it seems like my Facelets CompositionComponents aren't displayed anymore. No error, it just shows nothing in the portlet. It used to work when using the AjaxFacesPortlet class directly.
Anyone experiencing the same behavior? It might easily be a configuration error, took me quite a while to get this far. Or isn't it implemented yet (still in beta as far as I know anyway). The ajaxPortlet sample that comes with the richfaces-source also doesn't seem to be using Facelets.
I am using the JBoss Portal 2.6.3.GA bundle with the included JBoss 4.2.2GA, the latest Facelets jar (1.1.3) and self compiled richfaces and portletbrige jars (built from the richfaces-ui-3.1.3.GA source zip).
My web.xml (with the FaceletPortletViewHandler set):
| <web-app >
|
| <display-name>FooPortlets</display-name>
| <description>Foo Portlets</description>
|
| <context-param>
| <param-name>com.sun.faces.validateXml</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <param-name>com.sun.faces.verifyObjects</param-name>
| <param-value>true</param-value>
| </context-param>
|
| <context-param>
| <param-name>facelets.DEVELOPMENT</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <param-name>facelets.SKIP_COMMENTS</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <param-name>facelets.VIEW_MAPPINGS</param-name>
| <param-value>*.xhtml</param-value>
| </context-param>
|
| <context-param>
| <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
| <param-value>
| org.ajax4jsf.portlet.application.FaceletPortletViewHandler
| </param-value>
| </context-param>
|
| <context-param>
| <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
| <param-value>server</param-value>
| </context-param>
| <context-param>
| <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
| <param-value>.xhtml</param-value>
| </context-param>
|
| <filter>
| <display-name>Ajax4jsf Filter</display-name>
| <filter-name>ajax4jsf</filter-name>
| <filter-class>org.ajax4jsf.Filter</filter-class>
| </filter>
| <filter-mapping>
| <filter-name>ajax4jsf</filter-name>
| <servlet-name>FacesServlet</servlet-name>
| <dispatcher>FORWARD</dispatcher>
| <dispatcher>REQUEST</dispatcher>
| <dispatcher>INCLUDE</dispatcher>
| </filter-mapping>
|
| <servlet>
| <servlet-name>FacesServlet</servlet-name>
| <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
| <servlet-mapping>
| <servlet-name>FacesServlet</servlet-name>
| <url-pattern>/faces/*</url-pattern>
| </servlet-mapping>
|
| </web-app>
|
My faces-config.xml (with the viewhandler, statemanager and contextfactory set):
| <faces-config>
|
| <!-- Richfaces configuration -->
| <application>
| <view-handler>
| org.ajax4jsf.portlet.application.PortletViewHandler
| </view-handler>
| <state-manager>
| org.ajax4jsf.portlet.application.PortalStateManager
| </state-manager>
| </application>
| <factory>
| <faces-context-factory>
| org.ajax4jsf.portlet.context.FacesContextFactoryImpl
| </faces-context-factory>
| </factory>
| ...
| </faces-config>
|
And finally my portlet.xml:
| <portlet>
| <portlet-name>AlarmPortlet</portlet-name>
| <display-name>Alarm Portlet</display-name>
|
| <portlet-class>
| javax.portlet.faces.GenericFacesPortlet
| </portlet-class>
| <init-param>
| <name>javax.portlet.faces.defaultViewId.view</name>
| <value>/jsf/alarm/view.xhtml</value>
| </init-param>
| <init-param>
| <name>javax.portlet.faces.defaultViewId.help</name>
| <value>/jsf/alarm/help.xhtml</value>
| </init-param>
| <!-- disable portlet caching -->
| <expiration-cache>-1</expiration-cache>
| <supports>
| <mime-type>text/html</mime-type>
| <portlet-mode>VIEW</portlet-mode>
| </supports>
| <supported-locale>en</supported-locale>
| <supported-locale>de</supported-locale>
| <resource-bundle>AlarmResourceBundle</resource-bundle>
| <security-role-ref>
| <role-name>Admin</role-name>
| <role-link>Admin</role-link>
| </security-role-ref>
| <security-role-ref>
| <role-name>User</role-name>
| <role-link>User</role-link>
| </security-role-ref>
| </portlet>
|
Any help is appreciated :-)
Thanks in advance
Cheers
Phil
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118693#4118693
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118693
18 years, 3 months
[JBoss Seam] - EntityManager trouble
by ErikSlagter
I'm in some trouble with testing my DAO in Eclipse. I'm using TestNG and Eclipse europe together with Seam 2.0.0GA.
I have to got the following test funtion:
| @Test
| public void test(){
| dao = new PaymentDeviceDAO();
| String terminalProvider = "Malle Japie";
| String terminalId = "12345";
|
| device = dao.findById(terminalProvider, terminalId);
| assert device != null;
| }
|
| private EntityManagerFactory emf;
| @Out
| EntityManager em;
|
| protected String datasourceJndiName;
| public EntityManagerFactory getEntityManagerFactory(){
| assert emf != null;
| return emf;
| }
|
| @BeforeClass
| @Parameters("datasourceJndiName")
| public void setDatasourceJndiName(String datasourceJndiName) {
| this.datasourceJndiName = datasourceJndiName;
| init();
| }
|
| public void init(){
| emf = Persistence.createEntityManagerFactory(datasourceJndiName);
| em = emf.createEntityManager();
| assert emf != null;
| }
|
| @AfterClass
| public void destroy(){
| emf.close();
| assert emf.isOpen() == false;
| }
|
What is tries to do is find a PaymentDevice using the two arguments. Nothing special...
datasourceJndiName is defined in the testng.xml filed as "testDb".
When I run this test I get the following Exception:
javax.persistence.PersistenceException: No Persistence provider for EntityManager named testDb
I tried to figure it out myself, by following the dvd example of seam and various forums.
I can't find out anymore where it goes all wrong!?
Can anybody help me?
My configs are defined as following:
persistence.xml
|
| <persistence-unit name="testDb">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/testDataSource</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.show_sql" value="false"/>
|
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/testEntityManagerFactory" />
| </properties>
| </persistence-unit>
|
components.xml
<persistence:managed-persistence-context name="entityManager"
| auto-create="true"
| persistence-unit-jndi-name="java:/testEntityManagerFactory" />
mps-ds.xml
<local-tx-datasource>
| <jndi-name>testDataSource</jndi-name>
| <connection-url>jdbc:postgresql://localhost:5432/mps</connection-url>
| <driver-class>org.postgresql.Driver</driver-class>
| <user-name>postgres</user-name>
| <password>secretPassword:)</password>
| <!--
| <exception-sorter-class-name>
| org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
| </exception-sorter-class-name>
| <metadata>
| <type-mapping>mySQL</type-mapping>
| </metadata>
| -->
| </local-tx-datasource>
hibernate.cfg.xml
<hibernate-configuration>
| <session-factory>
|
| <property name="show_sql">false</property>
| <property name="connection.datasource">java:/testDataSource</property>
| <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
| <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
| <property name="cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
| <property name="hbm2ddl.auto">create-drop</property>
|
| </session-factory>
| </hibernate-configuration>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118685#4118685
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118685
18 years, 3 months
[JBoss jBPM] - jBPM in EJB environment
by TMK
Hello,
I want to ust jBPM for controlling the state and the state transitions from a particular business object.
These business objects are represented by entity beans and my client application accesses the server via a stateless session bean. I am a bit confused about the best way to integrate jBPM in my application because I currently ask myself where I have to start the jBPM engine. I can't start the jBPM engine in a stateless session bean because the bean woild forget its state when the request is over.
I think I need a way to integrate jBPM in the way that it lives the whole time over many client requests which are made through my session bean.
Can someone of you help me with this problem?
Regards,
TMK
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118682#4118682
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118682
18 years, 3 months