[JBoss Seam] - Re: How to use conversationPropagation=
by tazo
Came here as soon as i checked cvs log :)
Looks like conversationPropagation="none" works fine now. Just one note! My original code (look at my first post) didn't work: 'entity' is conversational component and it was unavailable in postback because of disabled propagation. <s:link> works fine in this situation.
And, Gavin, your recent changes in Manager.java broke workspace management:
| <h:dataTable value="#{conversationList}" var="entry">
| <h:column>
| <h:commandLink action="#{entry.select}" value="#{entry.description}"/>
|
| <h:outputText value="[current]" rendered="#{entry.current}"/>
| </h:column>
| </h:dataTable>
|
| ERROR 31-08 02:17:08,875 (Log4JLogger.java:error:119) -Servlet.service() for servlet Faces Servlet threw exception
| javax.faces.FacesException: #{entry.select}: javax.faces.el.EvaluationException: /template.xhtml @46,80 action="#{entry.select}": java.lang.NullPointerException
| at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
| at javax.faces.component.UICommand.broadcast(UICommand.java:332)
| at javax.faces.component.UIData.broadcast(UIData.java:677)
| at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
| at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
| at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
| at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:59)
| 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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| 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.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
| at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
| at java.lang.Thread.run(Unknown Source)
| Caused by: javax.faces.el.EvaluationException: /template.xhtml @46,80 action="#{entry.select}": java.lang.NullPointerException
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
| at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
| ... 28 more
| Caused by: java.lang.NullPointerException
| at org.jboss.seam.core.Manager.encodeParameters(Manager.java:864)
| at org.jboss.seam.core.Manager.redirect(Manager.java:912)
| at org.jboss.seam.core.Manager.redirect(Manager.java:841)
| at org.jboss.seam.core.ConversationEntry.select(ConversationEntry.java:175)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
| at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
| at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
| at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
| ... 29 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968499#3968499
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968499
19 years, 7 months
[JBoss Portal] - Single Sign-On
by grimesp@suu.edu
Our institution is looking into various portal products trying to decide what the best route is. We need a portal and we specifically need to be able to have single sign-on capability for applications that do not run in the JBoss application server. For example, we have an application written in Oracle Forms that runs on Oracle's Application Server. Is there a way to use the JBoss portal as a single sign-on point and then automatically authenticate to the Oracle Forms application? Also let's say we want our employees to be able to be authenticated to a third party web site by logging into their portal. Is there a way to do that?
I am having a hard time finding any documentation on the single sign-on capability of the JBoss Portal. Maybe someone can point me in the right direction.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968495#3968495
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968495
19 years, 7 months
[JBoss Seam] - Problem with myfaces-1.1.3 exceptions not returned to Browse
by gverner
I have a problem where under some conditions, uncaught application exceptions are not returned to the browser when using myfaces-1.1.3. To best describe the problem I have created a simple example.
The example is a page with a dataTable that has an slink on each row. When this link is pressed it calls a method that throws a RuntimeException. I copied the exception-test into the Seam Hibernate Example application which uses myfaces-1.1.1 and everything works as expected, meaning I receive an exception page after pressing the buttons.
Then I upgrade the Hibernate example to myfaces-1.1.3 by adding myfaces-impl-1.1.3.jar to the war and setting myFacesLifecycleBug=false in components.xml. After which pressing the slink button on a table row doesn?t return the exception page, it only logs the error.
Now a second more serious problem occurs if you are using Jbpm. After pressing the button on the table row a couple of times you receive the error (java.lang.IllegalStateException: No active conversation context). What makes this more serious is that it is usually impossible to get the application to recover no matter what page you go to, without closing your session. To test this with the Hibernate example add Jpbm by coping the jbpm.jar into the war file and enabing Jbpm in components.xml. no need to create any page flows.
What follows is the example code with more details on making the changes to the Seam Hibernate example.
Install the test page into the Seam Hibernate Example
Create exception-test.xhtml in examples/hibernate/view
exception-test.xhtml
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html 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">
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
| <title>Conversation Test</title>
| <link href="css/screen.css" rel="stylesheet" type="text/css" />
| </head>
| <body>
|
| <div id="document">
| <div id="header">
| <div id="title">Exception Test</div>
| <div id="status"></div>
| <div id="pagetitle" styleClass="pagetitle"><ui:insert name="pagetitle">Exception Test</ui:insert></div>
| </div>
| <div id="container">
| <div id="sidebar"><ui:insert name="sidebar">
| </ui:insert></div>
|
| <div id="content"><ui:insert name="content">
| <h:form>
| <h:dataTable value="#{exceptionTestList}" var="exp">
| <h:column>
| <f:facet name="header">Name</f:facet>#{exp.name}</h:column>
| <h:column>
| <f:facet name="header">Value</f:facet>#{exp.value}</h:column>
| <h:column>
| <s:link id="tdlink" action="#{exceptionTest.throwException}" value="Throw Exception in phase RENDER_RESPONSE(6) BeforeRender">
| </s:link>
| </h:column>
| </h:dataTable>
| <h:commandButton id="tx1" action="#{exceptionTest.throwException}" value="Throw Exception in phase INVOKE_APPLICATION(5)" styleClass="button" />
| </h:form>
| </ui:insert></div>
| </div>
| <div id="footer">Created with JBoss Hibernate, Seam, MyFaces, and Facelets</div>
| </div>
| </body>
| </html>
|
Create exceptionTestAction.java in examples\hibernate\src\org\jboss\seam\example\hibernate
exceptionTestAction.java
| package org.jboss.seam.example.hibernate;
|
| import java.io.Serializable;
| import java.util.ArrayList;
| import java.util.List;
|
| import javax.interceptor.Interceptors;
|
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Factory;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.annotations.datamodel.DataModel;
| import org.jboss.seam.annotations.datamodel.DataModelSelection;
| import org.jboss.seam.ejb.SeamInterceptor;
|
| @Name("exceptionTest")
| @Scope(ScopeType.CONVERSATION)
| @Interceptors(SeamInterceptor.class)
| public class ExceptionTestAction implements Serializable {
| private static final long serialVersionUID = 1730978625993910679L;
|
| @DataModel
| private List<ExceptionTestItem> exceptionTestList;
|
| @DataModelSelection("exceptionTestList")
| private ExceptionTestItem selectedExceptionTest;
|
| @Factory("exceptionTestList")
| public void createList() {
| // create some data for the screen
| exceptionTestList = new ArrayList<ExceptionTestItem>();
| exceptionTestList.add(new ExceptionTestItem("1", "one"));
| exceptionTestList.add(new ExceptionTestItem("2", "two"));
| }
|
| /**
| * Throw Exception to see how does Seam and myFaces handle it.
| *
| * @throws Exception
| *
| */
| public void throwException() {
| if (1 == 1)
| throw new RuntimeException("Test Throw Exception from ExceptionTextAction.throwException");
| }
| }
|
Create exceptionTestItem.java in examples\hibernate\src\org\jboss\seam\example\hibernate
exceptionTest.java
| package org.jboss.seam.example.hibernate;
|
| public class ExceptionTestItem {
| private String name;
| private String value;
| public ExceptionTestItem(String name, String value) {
| this.name = name;
| this.value = value;
| }
| public String getName() {
| return name;
| }
| public void setName(String name) {
| this.name = name;
| }
| public String getValue() {
| return value;
| }
| public void setValue(String value) {
| this.value = value;
| }
| }
|
Deploy the Seam Hibernate example and run the new page http://localhost:8080/seam-hibernate/exception-test.jsf. Try the datatable button ?Throw Exception in phase RENDER_RESPONSE(6) BeforeRender? a few times. Your still running myfaces-1.1.1 and should receive an Exception Page each time. Try the command button "(Throw Exception in phase INVOKE_APPLICATION(5) )", This button will display the exceptions page and works correctly with both versions of myfaces but is handled during a different phase.
Upgrade the Hibernate example to use myfaces-1.1.3
Add myfaces-impl-1.1.3.jar to the jboss-seam-hibernate.war file. I did this by modifying the examples/hibernate/build.xml file as follows.
Add a zipfileset, this should be placed in the file near the other zipfilesets.
| <!-- Myfaces 1.1.3 -->
| <zipfileset id="example.war.webinf.lib.myfaces"
| prefix="WEB-INF/lib"
| dir="../../lib">
| <include name="myfaces-impl*.jar"/>
| </zipfileset>
|
Find the following section and add the refid for example.war.webinf.lib.myfaces.
| <jar destfile="${build.dir}/${example.name}.war">
| <zipfileset refid="example.war.docroot"/>
| <zipfileset refid="example.war.webinf.lib"/>
| <zipfileset refid="example.war.webinf.lib.myfaces"/>
| <zipfileset refid="example.war.webinf.lib.extra"/>
| <zipfileset refid="example.tomcat.seam.jar"/>
| <zipfileset dir="${build.dir}/resources">
| <include name="WEB-INF/**/*.*"/>
| </zipfileset>
| <zipfileset dir="${build.dir}" prefix="WEB-INF/lib">
| <include name="${example.name}.jar"/>
| </zipfileset>
| </jar>
|
Modify examples\hibernate\resources\WEB-INF\components.xml and set myFacesLifecycleBug=false.
| <component name="org.jboss.seam.core.init">
| <property name="myFacesLifecycleBug">false</property>
| <property name="debug">true</property>
| </component>
|
Deploy the Seam Hibernate example again and run the page http://localhost:8080/seam-hibernate/exception-test.jsf. Try the datatable button ?Throw Exception in phase RENDER_RESPONSE(6) BeforeRender? a few times. Your now running myfaces-1.1.3 and will NOT receive an Exception Page each time but it will be logged. The command button "(Throw Exception in phase INVOKE_APPLICATION(5) ), will work correctly and display the exception page.
Enable Jbpm in the Hibernate example
Add jbpm-3.1.1.jar to the jboss-seam-hibernate.war file. I did this by modifying the examples/hibernate/build.xml file, adding the line to the zipfileset added above.
| <!-- Myfaces 1.1.3 -->
| <zipfileset id="example.war.webinf.lib.myfaces"
| prefix="WEB-INF/lib"
| dir="../../lib">
| <include name="myfaces-impl*.jar"/>
| <include name="jbpm*.jar"/>
| </zipfileset>
|
To enable jbpm add the following section to examples\hibernate\resources\WEB-INF\components.xml . Note no page flows are required.
| <component class="org.jboss.seam.core.Jbpm">
| </component>
|
Deploy the Seam Hibernate example again and run the page http://localhost:8080/seam-hibernate/exception-test.jsf. Try the datatable button ?Throw Exception in phase RENDER_RESPONSE(6) BeforeRender? a few times. Your now have Jbpm enable and will receive java.lang.IllegalStateException: No active conversation context.
any help will be appreciated
Thanks
Glenn
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968494#3968494
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968494
19 years, 7 months
[JBoss Seam] - Re: How do I test simple SLSBs?
by chuckadams
I looked at SeamTest and felt kind of silly for not putting any of the test logic in a script. I changed it thusly:
| public class GreeterTest extends SeamTest {
|
| @Test
| public void testGreeterHello() throws Exception {
| new Script() {
| @Override
| protected void invokeApplication() {
| Greeter g = (Greeter) Component.getInstance("greeter");
|
| assert "Hello, world!".equals(g.getHello());
| }
| }.run();
| }
| }
|
And at least I got a more familiar error.
|
| org.jboss.seam.InstantiationException: Could not instantiate Seam component: greeter
| at org.jboss.seam.Component.newInstance(Component.java:1440)
| at org.jboss.seam.Component.getInstance(Component.java:1350)
| at org.jboss.seam.Component.getInstance(Component.java:1324)
| at org.jboss.seam.Component.getInstance(Component.java:1318)
| at bizint.fiat.test.GreeterTest$1.invokeApplication(GreeterTest.java:18)
| at org.jboss.seam.mock.SeamTest$Script.run(SeamTest.java:242)
| at bizint.fiat.test.GreeterTest.testGreeterHello(GreeterTest.java:22)
| Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
| at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
| at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
| at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
| at javax.naming.InitialContext.lookup(InitialContext.java:392)
| at org.jboss.seam.Component.instantiate(Component.java:809)
| at org.jboss.seam.Component.newInstance(Component.java:1436)
| ... 23 more
| ... Removed 17 stack frames
|
I've always wondered at the generality of "could not instantiate Seam component". Why not? Was the underlying class not found? Name not resolved? Bad Mood? Stars not in alignment? Doesn't seem to be name related, because when I try Component.getInstance("kwyjibo") I get the ubuquitous NullPointerException instead (Java seems to give me more of those than I ever got in C or C++)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968493#3968493
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968493
19 years, 7 months